Code for my tumblr theme (not my ownership, just distributing it for people who can't find the original link).