Skip to content

Instantly share code, notes, and snippets.

@nmalkin
nmalkin / coordinates.js
Created November 27, 2013 02:43
Coordinate sorting example
var zip = function(array1, array2) {
return array1.map(function(v, i) {
return {x: v,
y: array2[i]};
});
};
var xs = [8,7,6,5];
var ys = [4,3,2,1];
@nmalkin
nmalkin / authenticate.js
Created December 28, 2012 03:46
Browser-only authentication mechanism (obviously unsecure)
var ENCODED_USERNAME = '098f6bcd4621d373cade4e832627b4f6',
ENCODED_PASSWORD = '5f4dcc3b5aa765d61d8327deb882cf99';
var usernameField = document.getElementById('username'),
passwordField = document.getElementById('password'),
submitButton = document.getElementById('submit');
submitButton.onclick = function() {
var username = usernameField.value,
password = passwordField.value;
@nmalkin
nmalkin / a.js
Created July 27, 2012 23:00
Jetpack circular dependency bug
console.log('This is A.');
var b = require('b');
@nmalkin
nmalkin / flow-sketch.jpg
Created July 2, 2012 20:31
Sketch for Report: user flow over time (nmalkin/kpi-dashboard issue #18)
flow-sketch.jpg
@nmalkin
nmalkin / sample.js
Created June 7, 2012 17:32 — forked from jedp/sample.js
kpiggybank data simulator
#!/usr/bin/env node
/**
* Create sample interaction data, using valid kpiggybank
* data as a seed.
*
* Can use from the command line, like so:
*
* node sample.js 42 # gets 42 data blobs
*