Skip to content

Instantly share code, notes, and snippets.

Avatar

Stuart Lynn stuartlynn

  • Two Sigma
  • Brooklyn
View GitHub Profile
@parrish
parrish / unique_classifiers.js
Created May 15, 2014
MongoDB unique classifiers per day
View unique_classifiers.js
var userMap = function() {
day = Date.UTC(this.created_at.getFullYear(), this.created_at.getMonth(), this.created_at.getDate());
emit({ day: day, user_id: this.user_id }, { count: 1 });
}
var userReduce = function(key, values) {
var count = 0;
values.forEach(function(v) {
count += v['count'];
@binarymax
binarymax / canvasfloodfill.js
Created Nov 14, 2012
Javascript Canvas FloodFill functions
View canvasfloodfill.js
//MIT License
//Author: Max Irwin, 2011
//Floodfill functions
function floodfill(x,y,fillcolor,ctx,width,height,tolerance) {
var img = ctx.getImageData(0,0,width,height);
var data = img.data;
var length = data.length;
var Q = [];
var i = (x+y*width)*4;
@tecoholic
tecoholic / osm2geo.js
Created Nov 27, 2011
OSM2GEO - A JS Converter to convert OSM to GeoJSON
View osm2geo.js
/**************************************************************************
* OSM2GEO - OSM to GeoJSON converter
* OSM to GeoJSON converter takes in a .osm XML file as input and produces
* corresponding GeoJSON object.
*
* AUTHOR: P.Arunmozhi <aruntheguy@gmail.com>
* DATE : 26 / Nov / 2011
* LICENSE : WTFPL - Do What The Fuck You Want To Public License
* LICENSE URL: http://sam.zoy.org/wtfpl/
*