2012 year in blogging

I said it before and I will say it again, Automattic is an amazing company and they do a lot of really cool stuff.  Today I received one more confirmation of that – an email with the link to the report of my blogging through the year.

Blog stats

 

I’ve seen plenty reports, graphs, and analysis.  In fact, I have to go through a few pretty much every week.  But I don’t remember seeing anything that awesome!  First of all, the whole page looks beautiful.  It’s an inspiring design with many elements that work nicely with each other.  Secondly, there are no boring graphs or dry numbers.  A few, carefully selected, metrics create a perspective and make it all sound cool.  I don’t know much about other reports yet, but mine said that this blog “had more visits than a small country in Europe”!

On top of that, the report is a technical masterpiece.  Probably, not many would notice the uniqueness of the fireworks at the top of the page.  But if you just spend a moment, you’ll realize that this fireworks display is unique for every report.  It’s a timeline of blog activity.  That’s why there is a month and day shown for every fireworks shoot out.  (If you are interested in the technical aspects of it, have a look at this GitHub repo).

As I said, the whole thing is pretty awesome, original, and inspirational.  I wish more companies were doing this.  It would make the world so much better…

 

To all those people who keep telling me that I am …

To all those people who keep telling me that I am fat: look at you now, you frozen skinnies!  It’s not even below zero, and all you can say is “OMG! It’s so cold!!”.  Fat is awesome when it’s cold.  Summer, on the other hand, is a completely different story…

Git : separating folder into different repository, with history

First things first.  If you don’t use git for version control yet, stop right now and go plan your migration.  You’ll thank me later.  Now.  A few days ago I had a tricky problem.  A chunk of code that was initially all over the project has been refactored into a pretty much separate library.  It was still a part of the same project, but in a folder of its own.

Then, a realization came that this library can be used from a few other projects.  A separate git repository in combination with ‘git submodule‘ would do a better job.  But just initializing a new repository and copying files seemed like a bad hack.  We’d much rather keep all the commit history, contributors and timestamps.  But is that even possible?

Turns out, it is.  And quite simple too.  Stack Overflow to the rescue.  I’ll copy the code here just in case it disappears.

git clone --no-hardlinks file:///SOURCE /tmp/blubb
cd blubb
git filter-branch --subdirectory-filter ./PATH_TO_EXTRACT  --prune-empty --tag-name-filter cat -- --all
git clone file:///tmp/blubb/ /tmp/blooh
cd /tmp/blooh
git reflog expire --expire=now --all
git repack -ad
git gc --prune=now

It worked like a charm! The above lines gave me a local git repository with just the necessary folder and all the relevant commits’ history. All I had to do after is add a remote repository and push the code to GitHub.

This is one of those perfect examples of how powerful git is.  It’s also an example of git usage, which I would have probably never figured out on my own…