Skip to content

Instantly share code, notes, and snippets.

@RuffSeason
RuffSeason / 0_reuse_code.js
Created December 9, 2015 23:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@RuffSeason
RuffSeason / dateRangeArray.js
Created July 7, 2016 17:04
Date Range Timestamps
var moment = require('moment');
// create truncated date ranges to fill with zeros
var enumerateDaysBetweenDates = function(startDate, endDate, granularity) {
var dates = [];
var currDate = startDate.clone().startOf(granularity);
var lastDate = endDate.clone().endOf(granularity);
while(currDate.add(granularity, 1).diff(lastDate) < 0) {
@RuffSeason
RuffSeason / objectKeySum.js
Created July 7, 2016 17:06
Object Key Sum
var _n = require('underscore');
var async = require('async');
//sum all the keys in array of objects
function objectKeySum(object, properties) {
var response = {};
async.forEachOf(
properties,
function(value, key, callback) {
var summed = _n.reduce(_n.pluck(object,value), function (t,h) { return t+h }, 0);

Keybase proof

I hereby claim:

  • I am ruffseason on github.
  • I am aossowski (https://keybase.io/aossowski) on keybase.
  • I have a public key ASCopMMs5jJGn-lP9knogG6iow0gd83UTQYC6TedOrFA4Qo

To claim this, I am signing this object: