15Oct2010

Hacker Slide: Anatomy of a 4 Hour Miniapp

Hacker Slide is a new miniapp I launched this morning after a few hours of development (rounded up to 4 after doing a little design work on this this afternoon). It lets you view the Hacker News front page over time with the time selectable with a slider so you can see stories come and go.

Hacker Slide was an off the cuff idea blatantly ripped from Reddit Snapshot. After the fad of producing "Instant" sites after YouTube Instant launched, I knew someone would probably make an HN Snapshot site pretty quickly so I decided I wanted to be that guy this time.

I'm no JavaScript guru but I searched for jQuery based "date sliders" and quickly discovered selectToUISlider which seemed to offer a similar experience to the slide on Reddit Snapshot.

I set up a quick Sinatra app in Ruby and got the slider working with some dummy data in about 15 minutes. From there I built a "crawler" based on the ruby-hackernews library (found via Google - I had no idea it existed previously) to fetch the front page items and save them to JSON files. Next, I worked up some basic jQuery powered JavaScript to fetch the JSON files based on the slider's selection and render it. The basic mechanic was done.

Initially I had it only crawling once per day but I realized I wouldn't be able to show it off for at least a few days if I kept it that way so I switched it to hourly and went to bed. On waking there were about 8 hours of data ready to "slide" through.

In retrospect, hourly works great because Hacker News's front page moves so quickly and it's useful to scan back hour by hour to find things that I missed while asleep/working/whatever. Hopefully some of you will find it useful for the same reason.

This afternoon someone posted Hacker Slide to Hacker News so I followed up by posting it to the Hacker News Facebook group and it went from there. It's only been a few hours but it's had around 3000 visitors so far and the feedback is generally positive (though people want to see how the items move around over time more elegantly - I'm still thinking on how to do this). I've also released the source onto GitHub.

So that's it. Nothing too intense. Just seeing someone else's idea, being inspired, and rolling out a "miniapp" after some Googling and head scratching. It's not just a great way to stretch your coding muscles but a good exercise in short term discipline or even a way to promote yourself - just ask Feross Aboukhadijeh about that.

Comments are closed.