This is now an actual repo:
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
/** | |
* Note that this script is intended to be included at the *end* of the document, before </body> | |
*/ | |
(function (window, document) { | |
if ('open' in document.createElement('details')) return; | |
// made global by myself to be reused elsewhere | |
var addEvent = (function () { | |
if (document.addEventListener) { | |
return function (el, type, 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
// Pluck an object that contains a key and optional value | |
function getBy(enumerable, findProperty, findValue){ | |
return jQuery.map(enumerable, function(el){ | |
if (typeof el[findProperty] !== 'undefined'){ | |
if (typeof findValue === 'undefined' || | |
el[findProperty] === findValue){ | |
return el; | |
} | |
} | |
}); |
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
import re | |
from django.utils.text import compress_string | |
from django.utils.cache import patch_vary_headers | |
from django import http | |
try: | |
import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS |
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
// loop through the 'paper' variable from Raphael JS and build up the JSON object describing all images and paths within it. | |
loadJSON = function(paper, json) { | |
var set = paper.set(); | |
$.each(json, function(index, node) { | |
try { | |
var el = paper[node.type]().attr(node); | |
set.push(el); | |
} catch(e) {} | |
}); | |
return set; |
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
# single image | |
pngcrush -rem alla -brute -reduce src.png dest.png | |
# directory of images | |
pngcrush -rem alla -brute -reduce -d outputdir ./*.png |
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
module.exports = {a: 'async'} | |
console.log('in >> '+__filename) |
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
window._gzip = (function() | |
{ | |
var _matchCount = function(s, word) | |
{ | |
var n = 0, wordLen = word.length, p = -wordLen; | |
while((p = s.indexOf(word, p + wordLen)) > -1) | |
++n; | |
return n; |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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
/* A lightweight templating system. | |
* | |
* Based on Tim (http://github.com/premasagar/tim) and Mustache | |
* (http://github.com/janl/mustache.js). | |
* | |
* Template supports simple value replacement as well as block | |
* functions, iterators and conditionals | |
* | |
* Template strings can contain either plain tokens `{{token}}` | |
* which are replaced with their equivilent value in the data |
OlderNewer