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
find ./conf -type f -name "*.json" -print | xargs -L 1 node -e "var out = '', fs = require('fs'); var out = process.argv[process.argv.length - 1]; var j = JSON.parse(fs.readFileSync(out).toString()); fs.writeFileSync(out, JSON.stringify(traverse(j), null, 2)); function traverse(j) { if (Array.isArray(j)) { return j.map(traverse); } if (typeof j !== 'object' || j === null) { return j; } var r = {}; Object.keys(j).sort().forEach(function(k) { r[k] = traverse(j[k]); }); return r; }" |
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
<?php | |
class Controller_Oauth extends Controller_App { | |
/** | |
* Models | |
* - Consumer (for keeping track of sites which have access to your oAuth provider) | |
* - Token (request token (type 0) or an access token, (type 1)) | |
* | |
*/ |
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
// ==UserScript== | |
// @name Hacker News Steve Filter | |
// @description Filter "Hacker News" items about Steve Jobs | |
// @include http://news.ycombinator.com/* | |
// ==/UserScript== | |
(function(){ | |
var list = ['steve', 'jobs', 'job\'s']; | |
// get spans |
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
// Illustrates a difference in behavior between OSX and Linux | |
// (tested on OSX and Arch) | |
var http = require('http'); | |
var server = http.createServer(); | |
server.on('request', function (req, res) { | |
res.writeHead(200); | |
res.end('Hello world.'); |
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 Animal = function(name) { | |
this.name = name; | |
}; | |
Animal.prototype.move = function(meters) { | |
console.log(this.name+" moved "+meters+"m."); | |
}; | |
var Snake = function() { | |
Animal.apply(this, Array.prototype.slice.call(arguments)); |
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
#/bin/bash | |
git branch -r | while read line ; | |
do | |
echo | |
echo "************" ${line#origin/} | |
echo | |
git log -1 $line | |
done |
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
Pipe curl to: | |
node -e 'var d = "", p=process.stdin; p.resume(); p.on("data", function(c){d+=c;}); p.on("end", function(){ console.log(require("util").inspect(JSON.parse(d), false, null, true))})' |
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 i = 0; | |
function fillLocalStorage(size) { | |
try { | |
window.localStorage.setItem('data'+i++, new Array(size).join('a')); | |
} catch(e) { | |
if(size == 1) { | |
throw e; | |
} else { | |
return fillLocalStorage(Math.floor(size / 2)); | |
} |
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 "AlmondJS shim: " | |
curl --silent https://raw.github.com/jrburke/almond/master/almond.js | uglifyjs --no-copyright | wc -c | |
echo "Browserify shim: " | |
curl --silent https://raw.github.com/substack/node-browserify/master/wrappers/prelude.js | uglifyjs --no-copyright | wc -c | |
echo "Browserbuild shim: " | |
curl --silent https://raw.github.com/LearnBoost/browserbuild/master/lib/require.js | uglifyjs --no-copyright | wc -c | |
echo "GlueJS new shim: " |
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
<html> | |
<script> | |
var m = require("minilog")("web"); | |
require("minilog").enable(); | |
m.error("some err"); | |
</script> | |
</html> |
OlderNewer