Skip to content

Instantly share code, notes, and snippets.

@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
*
@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 / a.js
Created July 27, 2012 23:00
Jetpack circular dependency bug
console.log('This is A.');
var b = require('b');
@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 / 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 / barrier.js
Created July 4, 2014 09:21
Barrier demonstration
"use strict";
function longRunningFunction1(onComplete) {
setTimeout(onComplete, 3000);
}
function longRunningFunction2(onComplete) {
setTimeout(onComplete, 2000);
}

User agent:

This bug appears in the latest Nightly (Firefox 34). It behaves correctly in the current stable version (Firefox 31).

Steps to reproduce:

  1. Start with a page that sets a cookie and redirects (HTTP 302) in the same request
  2. Load that page in an iframe
  3. Make sure the page that serves the iframe is on a different host/origin from the page in the iframe

Keybase proof

I hereby claim:

  • I am nmalkin on github.
  • I am nmalkin (https://keybase.io/nmalkin) on keybase.
  • I have a public key whose fingerprint is AE7F 92E6 76DC 764E 44E9 7459 5B32 A1DA B4CB 2894

To claim this, I am signing this object:

#!/usr/bin/env python3
# This snippet provides the code to make an HTTP request using Python 3's
# built-in libraries, with the following properties:
# - POST request
# - send form-encoded data
# - the URL is behind HTTP basic authentication
#
# The motivating example is making API requests to a service such as Mailgun.
#
@nmalkin
nmalkin / docker-cleanup.md
Created February 1, 2016 22:47
Docker cleanup