Generated Stack Overflow flair in text

Posted on Jan 25, 2011

Those of you who’ve visited here before would have noticed the list of badges in the right column. These were the standard badges you can find all around the internet. Looking at the output of Pingdom, YSlow and WebSiteOptimization.com I decided that removing a number of images from the site would improve the load time. Furthermore FriendFeed seemed to be having performance problems of their own. Since I’m not a heavy FriendFeed user I decided to remove the badge entirely.

Stack Overflow API

One of the things Stack Overflow provides (besides being the most awesome Q&A site on the web today) is flair, a badge you can put on your web-page showing your avatar, reputation and badge counts. I was aware of the fact that Stack Overflow also provides an API. So I thought to myself let’s combine these two to provide a text-only badge.

The API

Consuming JSON in Ruby

Searching for JSON and Ruby presents this gem as the first result. Looking through the documentation I decided to give it a go. Since Stack Overflow’s API is a web-service I looked up the documentation for Ruby’s http client.