The catch with using the Rails 3 Asset Pipeline is that all scripts (javascripts and coffeescripts) in app/assets/javascripts are compiled, merged, and minified into a single file: application.js. But, what if you don’t want a particular script dynamically (lazily) loaded only when necessary? Where do you store it? How do you reference it? Where do...
Read More
When I started architecting the initial JS apps for YouNow, I sought to build structures that could be used both by our Backbone.js applications and one-off scripts/projects. These structures grew quite quickly over time; they became monolithic. In this article, I’ll examine the motivations, pros, and cons of a backend api service layer and suggest/brainstorm...
Read More
All of the jargon and confusingly said theories in textbooks and online resources are quite useless when you’re trying to learn database theory for the first time. Below is a really layperson-focused (almost mechanical) set of rules for when you’re trying to determine the normal form of a database table. Visually, a functional dependency could...
Read More
I’m writing tests for a node.js tool that I’m working on and hit a snag in trying to mock (i.e., simulate) a dynamic npm install of a module within a subdirectory. I tried a bunch of ideas and ended up with a simple, perhaps not ideal, but effective solution. TL;DR: Pre-install all of the potentially...
Read More
Here’s a really useful function that I wrote to detect if a given structure already exists within a list of structures. The gist of the function is that it converts structs to cell matrices of strings and uses the beautiful ismember() function (the version acting on cells of strings) to determine if the “entity” exists...
Read More
This article is cross-posted from Medium and a response to the following article on tech hiring being broken There are some interesting points in the above article on why folks fear and/or should avoid the whiteboard. I think the whiteboard hate is a crutch. It’s like paper, but on a wall Many preparatory materials will tell...
Read More
Eureka! That’s the feeling I had when I finally saw how Object.create could help me in achieving the inheritance-oriented behavior I was after. I’d been reading lots about prototypal inheritance in JS and understood bits and pieces, but it finally started to click recently. Here are some thoughts and (intentionally simplified) explanations that will hopefully help you...
Read More
I architected and built the entire front-end for the new profile app at YouNow. The project served as my first Backbone.js application. I had tried learning the library a handful of times before, to no avail. I kept wondering ”why is Backbone even necessary?” Through a series of posts, I’d like to shed some light...
Read More
This post was featured in JavaScript Weekly #213 When you join large projects and fix bugs or build features, you typically rely on senior (in terms of time at the company) engineers to say “don’t forget to test feature X (that you probably didn’t know existed).” Being new, you have limited knowledge of the entire architecture. Our tools...
Read More
When learning a new programming language, one important question is always “does language X pass arguments by value or by reference?” Javascript behaves closely to Java in its treatment of arguments – in that all types are passed by value. However for certain types (like object types), a pointer is passed in by value –...
Read More