A simple convenience function for adding together an array of numbers.
//
// Iterates over an array of numbers and returns the sum. Example:
//
// _.sum([1, 2, 3]) => 6
//
_.sum = function(obj) {
if (!$.isArray(obj) || obj.length == 0) return 0;
return _.reduce(obj, function(sum, n) {
return sum += n;
});
}
View the Gist
Filed under javascript underscore web development code
Sushi Sunrise (Taken with Instagram at Uchiko)
Crab Cake (Taken with Instagram at The Front Room)
Holy mother of Shipley! Twitter is not a chunk-encoded blog!
Took a few minutes out of my afternoon today to make some small cleanups to the site for MatrixView. I redesigned the header and included an inline example to the top of the page.
Still need to clean up the rest of the page (below the blue header), but that will have to wait for another day.
Filed under design matrixview