Some inspirational [lines of code](https://gist.github.com/marchaefner/5098243).