Category: Technology
I work in technology sector. And I do round a clock, not only from 9 to 5. It is my bread and butter, it is my hobby, it is the fascination of my life. And with the current rate of change particular in information technology (IT), there is always something new to learn, to try, to talk about. I often post news, thoughts, and reviews. And when I do, this is the category I use.
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.
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…
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…
What is the best comment in source code you have ever encountered?
Instagram Digest : round two
It’s been a couple of month since I mentioned Instagram Digest plugin for WordPress. Â Unfortunately, making it work wasn’t as easy as it seemed at first. Â The thing is that Instagram’s Developer corner shows you four pieces of information, once you register a new Instagram API application. These four pieces are: client ID, client secret token, website URL, and redirect URL. Â Just populating them with sensible values doesn’t necessarily work.
The trick here is to get a little bit of understanding of how OAuth works. Â When a new API application is created, there is an authentication stage, where you, as a logged in Instagram user need to confirm access of the newly created application to your data. Â For that, a redirect URL must handle the request from the Instagram, and, in case of Instagram Digest plugin, you need to save the authentication token.
Too bad the documentation for the plugin is not too clear on that. Â Luckily though, after playing around with an deleting and re-creating the application a few times I managed to make it work …
… just in time for the upgrade of the site to WordPress 3.5. Â What’s so special about WordPress 3.5 then? Well, if you look closer at the announcement of this version, you’ll see that the media manager has been changed heavily. Â It looks very nice now when you are adding the images the old way, but it also doesn’t work too well with the Instagram Digest plugin. Â The gallery is created, but it seems to have all the wrong things in it. Â Manually fixing it takes just a few clicks, but is annoying enough, since the whole point of this plugin is automation.
With that, you do have my first Instagram digest post, and a possibility of a bumpy ride for the next few days until I figure it all out. Â If you have any ideas on how to fix it, please let me know. Â Otherwise, please be patient. Â Maybe spend more time with your family during the Christmas holidays instead of browsing through silly blogs like this one.
