Saturday, October 30, 2010

Node.js Miniapp: minim.al bit.ly

tl;dr: The app. The code.

I've developed a habit of creating aggressively editorial miniapps which modify sites I like to make them better. It started with BoingBoing Minus Disneyland, a miniapp on Heroku that for a while presented BoingBoing's RSS feed, filtered to exclude any mention of Disneyland (I just don't get why they think Disneyland is interesting).



This was one of my first monthly miniapps in 2009. It had some bugs, and Heroku gem changes killed the app, and I didn't maintain it. Next came Hacker Newspaper, which is Hacker News plus better typography, and minus any story from a few domains I don't want to read, including TechCrunch, Coding Horror, and some other idiot.



Bans come direct from my arbitrary whims. On the day the iPad was announced, I banned any story mentioning it, because there were just too many, and most of them were ridiculously boring. I'll probably also add Zed Shaw to the banlist when I get around to it. It's not actually a priority, though. The goal is superior legibility; the editorial aspect is just icing on the cake.

After Hacker Newspaper, much more recently, came my Minimal GitHub Dashboard. This is a list of the original projects for a given username. I use GitHub every day and I love it, but there's a lot of shit on the home page that I just don't care about.



My Minimal GitHub Dashboard uses Node.js and the excellent GitHub API. My new miniapp, minim.al bit.ly, uses Node.js and the competent but imperfect bit.ly API. It's almost exactly the same code. The only significant addition was the ability to serve static assets using node-static.



minim.al bit.ly gives you a form which returns a shortened URL. This is bit.ly's core functionality. bit.ly also has some awesome analytical features I very rarely use, plus the usual slew of graphics urging you to tweet this and Like that on Facebook, way more Ajax than I can handle, and a drawing of a puffer fish which looks like an unfortunate, strangled Muppet.



I don't want to look at this fish. His deformity makes me uncomfortable. The guy's got two fins on one side, and less than one fin on the other. You could even call that other side unfinished.



I don't want to see the graphics urging me to tweet, either. I like simplicity.



Fortunately, I can have simplicity, because bit.ly supplies an API, even to aggro critical bloggers like myself. Apologies to bit.ly for my terrible attitude, and big thanks for the API. I should point out, to be fair, that my own Minimal GitHub Dashboard CSS is completely useless on iOS devices. (Update: fixed that.)

minim.al bit.ly is 125 lines of code, including the Node.js miniapp, views written in Jade, some (iOS-friendly) CSS, and some simple jQuery. As with the Minimal GitHub Dashboard, I built this in Node.js in one evening, and it didn't take long, but it did take longer than I thought it would.