From time to time one comes across a snippet of code or a particular method that transcends the in-the-moment necessity of what you find on StackOverflow, not timeless, but an item to which to return when needed as you are guaranteed to likely need it again.

(These usually appear first on Twitter.)

Tangent Lines & Curves

I’ve referenced this several times throughout the years and need it only at intervals long enough to forget how it was done: How to draw a tangent line to a curved segment


If you ever need to make an ePub file from scratch, the commands to do so with Terminal are below. They need to be executed from within the uncompressed ePub directory. You can then use Amazon’s KindleGen to convert the ePub to a .mobi file.

zip -X filename.epub mimetype
zip -rg filename.epub META-INF -x \*.DS_Store
zip -rg filename.epub OEBPS -x \*.DS_Store


Here’s a neat JavaScript snippet for determining a visitor’s location. Unsure of how accurate it is other than it worked for me.

  • jQuery.getJSON(' ', function(location) {
  • if ( _code == 'US') {
  • console.log("US");
  • }
  • });