I’ve had the urge to play with some JS on the subway (offline), so I open-sourced a really simple (read-evaluate-print-loop) repl for Android phones. It’s basically eval() wrapped in a native Webview with CodeMirror on top. I call it Andrepl. Here’s the source Code: Andrepl Post-mortem This app started out as a PhoneGap application. That...
Read More
When your system’s API isn’t RESTful, standard ways of grouping actions based on data resources and routing are not guaranteed – if at all considered. Note: I’ll use PHP scripts as an example, but the points aren’t limited to that language. Worst case An API endpoint for your system is a separate file (like getPosts.php)...
Read More
For the last year (on and off), I’ve been working on PackageStats.io: an analytics service for NPM package authors. As an author of 60+ NPM packages, I found it extremely frustrating to gather a holistic understanding of the reach/impact of my packages – resorting to clicking through the 60+ package pages on NPM’s site. I...
Read More
I wanted to use Backbone’s save feature of models, but our non-REST backend apis at YouNow don’t accept a JSON request body and are used across multiple platforms – so tweaking the apis to handle the Backbone.emulateJSON way of sending POST data (stringified model attributes associated with a model key) wasn’t going to cut it....
Read More
I had to roll my own regex solution for translating embedded links within text to clickable html links. Stuff on the web had too many false positives. Hope it helps! Javascript: /(((http(s?)(://))?([w]{3}.)?)([a-z|0-9])+.(com(.au)?|org|me|net|ly|be|gl|info|(co(.))?uk|ca|nz|tv)(/[^s]+)*)+/g PHP: "/(((http(s?)(://))?([w]{3}.)?)([a-z|0-9])+.(com(.au)?|org|me|net|ly|be|gl|info|(co(.))?uk|ca|nz|tv)((/[^s]+)*)+)/" Properly detects the urls in the following formats: Including subpaths:
Read More
In this post, I’ll talk about some shortcut idioms that are used often, basic at their core, and fairly interesting. Have your own JS idioms that you want to share? I started a collaborative repo on github: https://github.com/mrjoelkemp/js-idioms Branching with Inline assignment if (foo = doSomething()) {} The quick explanation of how this works is...
Read More
I’ve been thinking a lot about how to become worthy of the title of “software engineer.” In thinking about how to become great, I’ve had to try to quantify what makes a great engineer. Here’s what I’ve gathered (so far) as the steps to achieving greatness – starting from the beginning (for any up and...
Read More
The pictures in the luxurious two story house hang crooked; rightly so – hanging in the home of hypocrisy. The pictures – remnants of a time when two sisters could speak without fear— malevolent monster. And now, the sisters smile sadly in frames. Even the background trees grow disfigured. For it seems – that green...
Read More
I\’m working on a Redis-like extension to HTML5 Storage objects (localStorage and sessionStorage). When thinking about implementing key expiry, there are two primary solutions: timer and data based implementations. Timer-based Expiration As John Resig brilliantly explains, when you set a timeout using setTimeout(), there is no guarantee that the callback (the function to perform after the timeout is fired)...
Read More