The ReactJS Controller View Pattern

TL;DR Making a top level component that holds all state and passes it to children as props is really nice. Not to be confused with MVC, a "view controller" or "controller view" is a top level component that holds all state and passes it to children as props. For…

How to Copy Only Changed Files With Gulp

Recently I had to keep two folders in sync with gulp. I needed to copy all files from one folder to another, and keep them up to date when changes were made. The easy way is just to copy the entire folder every time. gulp.task('watch-folder', function() { gulp.watch(…

How to Debug Mocha Tests With Chrome

This post assumes you're familiar with Chrome's developer tools. Take That, WebStorm! I've long lamented that Vim will never have IDE style debugging, which is more powerful than any Vim feature. Until… I was browsing the Mocha documentation on a whim while waiting patiently for death, when I came across…

How To Set Up Devise AJAX Authentication With Rails 4.0

For whatever reason, there are several blog posts on how to accomplish this, and they all get it completely wrong. If you've found this page, I sincerely hope you haven't had to experience those. Learn from my pain. Devise can almost do this out of the box. We just have…

How to Clone a (Nested) Array in Javascript

The Problem David Walsh has a quick tutorial on how to clone an array in Javascript: var clone = myArray.slice( 0 ); This has an unmentioned danger. If your array contains nested arrays, the "clone" will contain references to the old arrays. Observe: var original = [ [1] ]; var cloned = original.slice( 0…

Free 3D Primitive Icon Set

While designing a 3D user interface, I came across the desire for some icons representing 3D primitives. I wanted a cube icon, torus icon, sphere icon, etc. After some searching I came up empty handed. So I made some! Here, you can have them. Preview You can just download one…