This file contains hidden or 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
[0, ['a', 'b', 'c'], 2, 'd', 4, 5, 'f', 7, ['g', 'h'], 9].reduce(function rec (prev, curr) { | |
if (/array/i.test(curr.constructor)) { | |
return curr.reduce(rec, prev); | |
} else if (/string/i.test(curr.constructor)) { | |
prev.push(curr); | |
} | |
return prev; | |
}, []); |
This file contains hidden or 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
<html> | |
<head> | |
<style> | |
b { | |
font-weight: normal; | |
} | |
</style> | |
<script src="http://cdn.jsdelivr.net/handlebarsjs/2.0.0/handlebars.js"></script> | |
</head> | |
<body> |
This file contains hidden or 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
git init | |
git commit -m 'root commit' --allow-empty | |
touch README.md | |
echo "$(pwd | rev | cut -d"/" -f1 | rev)" >> README.md | |
git add . | |
git commit -m 'initial commit' | |
git remote add origin [email protected]:sdumas/$(pwd | rev | cut -d"/" -f1 | rev).git | |
git push -u origin master |
This file contains hidden or 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 guid = function fn (n) { | |
return n ? | |
(n ^ Math.random() * 16 >> n/4).toString(16) : | |
('10000000-1000-4000-8000-100000000000'.replace(/[018]/g, fn)); | |
}; |
This file contains hidden or 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 makeWorker = function (fn) { | |
var blobURL = URL.createObjectURL( | |
new Blob( | |
[ '(', fn.toString(), ')()' ], | |
{ type: 'application/javascript' } | |
) | |
), | |
worker = new Worker(blobURL); | |
return worker; |
This file contains hidden or 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
<html> | |
<head> | |
<style> | |
b { | |
font-weight: normal; | |
} | |
</style> | |
<script src="http://cdn.jsdelivr.net/handlebarsjs/2.0.0/handlebars.js"></script> | |
</head> | |
<body> |
This file contains hidden or 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
JSON.parse( | |
((window.location.search) ? | |
window.location.search | |
.replace(/^\?/, '{"') | |
.replace(/=/g, '":"?') | |
.replace(/&/g, '"?,"') | |
.replace(/$/, '"}'): | |
'{}') | |
); |
This file contains hidden or 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 partial = function () { | |
var toArray = function (a) { return [].slice.call(a); }, | |
appliedArgs = toArray(arguments), | |
fn = appliedArgs.shift(), | |
placeholderPositions = appliedArgs.map(function (e, i) { | |
if (e === '_') { return i; } | |
}).join('').split(''); | |
return function () { | |
var args = toArray(arguments); |
This file contains hidden or 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 template = function (str, options) { | |
var re = /{{(.+?)}}/g, | |
reExp = /(^( )?(var|if|for|else|switch|case|break|{|}|;))(.*)?/g, | |
code = 'with(obj) { var r=[];\n', | |
cursor = 0, | |
result, | |
add = function (line, js) { | |
js ? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') : | |
(code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : ''); |
This file contains hidden or 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
cd ~ | |
wget http://ftp.gnu.org/gnu/stow/stow-latest.tar.gz | |
tar -xf stow-latest.tar.gz | |
cd ~/stow-latest | |
./configure && make && sudo make install | |
cd ~ | |
wget https://www.kernel.org/pub/software/scm/git/git-2.1.3.tar.xz | |
tar -xf git-2.1.3.tar.xz | |
cd ~/git-2.1.3 | |
./configure && make && sudo make install |