This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(fn, wait) { | |
var timeout; | |
return function() { | |
var context = this, // preserve context | |
args = arguments, // preserve arguments | |
later = function() { // define a function that: | |
timeout = null; // * nulls the timeout (GC) | |
fn.apply(context, args); // * calls the original fn | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Y = function (incubate) { | |
return function (scrutinize) { | |
return function (hacker) { | |
if (hacker.gender == 'male' || scrutinize(hacker)) { | |
incubate(hacker.startup); | |
} | |
return hacker; | |
}; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.apply(null, [1, 2, 3]) | |
> [1, 2, 3] | |
Array.apply(null, [1, 2, 3]).length | |
> 3 | |
Array.apply(null, {length:3}) | |
> [undefined, undefined, undefined] | |
Array.apply(null, {length:3}).length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a wrapped version of a funtion that will run with the original | |
* arguments, once a condition is met. If the condition is not met, it will | |
* be checked on a set interval until it is met. | |
* | |
* @param {Boolean} condition function you expect to eventually return a truthy value | |
* @param {Function} func original function to resolve | |
* @param {Number} interval time to wait between checks | |
* @return {Function} wrapped function you call can call as it it was the original function | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Single-Column Responsive Email Template</title> | |
<style> | |
@media only screen and (min-device-width: 541px) { | |
.content { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ grunt link-cycler --root=archive/json --interval=30000 --link=current --verbose --initial=10 | |
Running "link-cycler" task | |
Cycling through last 3 of 12 children, 1 per 30000ms... | |
Child 10/12: | |
Linking archive/json/current to archive/json/2013-09-23_12-28-32 | |
Child 11/12: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createGame = require('voxel-engine') | |
function sphereWorld(x, y, z) { | |
// return the index of the material you want to show up | |
// 0 is air | |
if (x*x + y*y + z*z > 15*15) return 0 | |
return 3 | |
} | |
var game = createGame({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
function romanify(value) { | |
var numbers, numerals, result, i, len; | |
numbers = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ]; | |
numerals = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]; | |
result = ""; | |
for (i = 0, len = numbers.length; i < len; i++) { |