I see it time and time again. A new developer comes to Angular. She wants to, say, display a list of things and a button that sorts them. So she asks her fellow—more Angular savvy—colleagues how on earth to do that. Write a directive, they say. Your logic…
Going Functional: Three Tiny Useful Functions - Some, Every, Pluck
Some, Every Every now and then in your everyday programmer’s life you come across an array and you need to determine something, usually whether all the elements in the array pass a certain test. You know, something like: var allPass = true; for (var i = 0; i < arr.length;…
Taming Gruntfiles
Every software project needs plumbing. If you write your code in JavaScript chances are you’re using Grunt [http://gruntjs.com/]. And if your project has been around long enough, chances are your Gruntfile is huge. Even though you write comments and indent properly, the configuration is starting to look…
Speeding Up Grunt Builds Using Watchify
Grunt [http://gruntjs.com/] is a great tool for automating boring tasks. Browserify [http://browserify.org/] is a magical bundler that allows you to requireyour modules, Node.js style, in your frontend code. One of the most useful plugins for grunt is grunt-contrib-watch [https://github.com/gruntjs/grunt-contrib-watch]. Simply put,…
Going Functional: Reduce
Reduce (a.k.a. foldl) is one of my all-time favorite higher-order functions. It’s kinda sorta thecrane stance [http://www.youtube.com/watch?v=pYE4fNQKTs4] of the functional style kung-fu: you don’t want to use it a lot but when you do it can save the day. Every…