Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jameswomack
jameswomack / javascript_background_thread.js
Created September 11, 2012 06:41
Extend function prototype to run a function as a WebWorker
Function.prototype.runOnBackgroundThread = function (aCallback) {
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"});
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob));
_worker.onmessage = aCallback;
_worker.postMessage();
}
var _test = function () {
postMessage((1+1).toString());
}
@jakerella
jakerella / create-load.js
Last active November 19, 2015 19:27
Simple load generation script to test web applications.
/**
* This script helps to artifically generate load on a web application through
* weighted requests to various endpoints. It may not be pretty, but it works
* for me. :) Feel free to use however you want.
*
* NOTE: Please use responsibly, don't run this script against a production server!
*
* @author Jordan Kasper (@jakerella)
* @contributor @robcolburn
* @license MIT