Skip to content

Instantly share code, notes, and snippets.

View spadgos's full-sized avatar
🕶️
I will be slow to respond, if at all.

Nick Fisher spadgos

🕶️
I will be slow to respond, if at all.
View GitHub Profile
@spadgos
spadgos / promises.js
Created March 3, 2014 09:20
Promises causing memory leaks
function bad() {
var promise = somethingAsync();
promise.finally(function () {
logSomeThings();
});
promise = promise.then(function (result) {
return transform(result);
});
@spadgos
spadgos / gist:9356871
Created March 4, 2014 22:11
Marquee code
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+
@spadgos
spadgos / gist:3e0d16518b35eab7ecb1
Created May 14, 2014 09:22
ESLint errors on master
$ git clone git@github.com:eslint/eslint.git
$ cd eslint
$ npm install
$ npm test
1) default-case switch (a) {
case 1: break;
//oh-oh
// no default
}:
@spadgos
spadgos / gist:895bd47747b39f519ce6
Last active August 29, 2015 14:15
Bound vs wrapped functions
var someObj = something();
return {
bound: someObj.fn.bind(someObj), // 4M ops/sec
wrapped: function (a) { // 16M ops/sec
return someObj.fn(a);
}
};
~ npm ###-begin-npm-completion-###
#
# npm command completion script
#
# Installation: npm completion >> ~/.bashrc (or ~/.zshrc)
# Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm
#
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
@spadgos
spadgos / gist:1853227
Created February 17, 2012 12:45
Sublime settings
{
"caret_style": "phase",
"color_scheme": "Packages/User/Nonokai.tmTheme",
"default_new_file_syntax": "Packages/Javascript/Javascript.tmLanguage",
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.pyc",
@spadgos
spadgos / gist:2561726
Created April 30, 2012 19:19
Recreating a SoundManager bug
<html>
<head>
<title>Soundmanager test</title>
<!-- you'll have to correct the paths to SoundManager to get it working for yourself -->
<script src="vendor/soundmanager/soundmanager2-nodebug.js"></script>
</head>
<body>
<button>Start test</button>
@spadgos
spadgos / gist:2761737
Created May 21, 2012 10:29
A check to see if augment.js is required
var methods = {
'every': Array.prototype.every,
'filter': Array.prototype.filter,
'forEach': Array.prototype.forEach,
'indexOf': Array.prototype.indexOf,
'isArray': Array.isArray,
'lastIndexOf': Array.prototype.lastIndexOf,
'map': Array.prototype.map,
'reduce': Array.prototype.reduce,
'reduceRight': Array.prototype.reduceRight,
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
"*.obj",
"*.o",
"*.a",
"*.lib",
<snippet>
<content><![CDATA[
${1:return }${2:ParentClass}.prototype.${3:method}.apply(this, arguments);
$0
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>super</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>