Business logic in a controller is reachable from exactly one place: an HTTP request. The first time the same operation is needed from a console command, a queue…
Applying a transformation to every scalar in a nested array — trimming decoded JSON, casting numeric strings — usually produces a small recursive function that gets copied between…
Building a string out of several variables in JavaScript has meant a chain of + and a careful audit of the spaces. Backtick strings interpolate directly and, more…
indexOf only works when you already have the value you are looking for. Finding the first element matching a predicate has meant either a filter() that builds a…
Two hundred and forty require_once calls where load order was load-bearing, moved onto an autoloader one namespace at a time without a big-bang rewrite.
Converting a NodeList or an arguments object into a real array has been Array.prototype.slice.call(x) for a decade — an incantation that works because of how slice was specified…
$.each hands the callback the index first and the value second. Array.prototype.forEach hands it the value first and the index second. Both signatures are two arguments of convenient…