You May Find Useful…

In the process of overbuilding my behemoth business card widget, I put together or otherwise acquired a few well-generalized microlibraries that are now up on GitHub. You may find them useful!


If you fat-finger git stats or git comimt, it declines to execute, as you’d expect, but it also kindly suggests some commands that it thinks you might have meant. I wanted a similar effect for my project’s client-side 404 page, so I hit Google. Google led me to Wikipedia, and I settled on Levenshtein Distance, which came with an example implementation in C. I translated it into JavaScript; then I did what I do with cores of impenetrable code that I never want to think about again: I wrapped it in a friendly API.

didYouMean.js is the product, and it makes it incredibly easy to compare a string to a list of strings. There are a bunch of hot-swappable options – a couple flavors of threshold, and a “good enough quit early” flag – and it will happily attach itself to window or to module.exports as available.


Whenever I venture out from within SproutCore’s thick, KVO-happy walls, the first thing I do is figure out how to keep disparate layers (ergo objects) in sync and active without having to know about each other. I was part of a VB.NET shop in a previous life, where it was custom class events; in node, everything is an EventEmitter; and of course it’s bindings in Cocoa, where SproutCore got the idea from in the first place.

For my project, I decided to go raw, no frameworks, no nothin’, but it turns out I can’t live without this one piece. Google this time directed me to Google, whose Maps API includes something called MVCObject, and to this project, a standalone implementation. Credit goes to two silent email addresses named “John” and “Mark”, @ an apparently dead website; they’ve apparently abandoned the project, so I’ve moved it to GitHub, added some examples to the README, and softened its habit of throwing cranky errors in otherwise-safe situations. When even Angular is too much, MVCObject.js is your framework-free framework!™


This is a simple jQuery plugin to provide JavaScript hooks for your responsive designs, for those times when media queries don’t quite cut it. It monitors window size with a single observer, and triggers your callback whenever it crosses the height, width or aspect ratio thresholds you set. If you’re on a platform that doesn’t support media queries, you can also hook it up to apply classes to selected elements instead of triggering a callback.