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
#!/bin/bash | |
# Choose your favorite table | |
# classic | |
SIGNS=( a b c d e f g h i j k l m n o p q r s t u v w x y z ) | |
# advanced | |
#SIGNS=( a b c d f e h g j i l k m n o p q r s t u v w x y z . - ? ! "#" "+" ) |
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
function namespace(str) { | |
var L = str.split('.'); | |
function ns(last, L) { | |
if (!L.length) return; | |
ns(last[L[0]] = last[L[0]] || {}, L.splice(1)) | |
} | |
ns(window[L[0]] = window[L[0]] || {}, L.splice(1)) | |
} | |
namespace("x.y.z"); | |
namespace("x.b.c"); |
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
Object.defineProperty( | |
Object.prototype, | |
"2", | |
{ | |
get: function() { | |
/* some crazy side-effect */ | |
} | |
} | |
); | |
new Float64Array(1)[2] |
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 http = require('http') | |
, fs = require('fs'); | |
fs.readFile('image.jpg', function(err, data) { | |
if (err) throw err; // Fail if the file can't be read. | |
http.createServer(function(req, res) { | |
res.writeHead(200, {'Content-Type': 'image/jpeg'}); | |
res.end(data); // Send the file data to the browser. | |
}).listen(8124); | |
console.log('Server running at http://localhost:8124/'); |
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 page = require('webpage').create(); | |
page.open('http://jsbin.com/ifuma#noedit', function () { | |
setTimeout(function () { | |
page.sendEvent("mousedown", 10, 10); | |
page.sendEvent("mousemove", 200, 200); | |
page.sendEvent("mouseup", 200, 200); | |
page.render('ss.png'); | |
phantom.exit(); | |
}, 3000); | |
}); |
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
Sets | |
i activity | |
/ | |
free-lunch, | |
mixed-nuts, | |
orange-juice, | |
heavy-ddr-session, | |
cheese-snacks, | |
cookies, | |
mexican-coke, |
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
phantom.injectJs(phantom.casperPath + '\\bin\\bootstrap.js'); | |
var casper = require('casper').create(); | |
casper.start('http://localhost:1200/charts/ChartWrapperTest.htm', function() { | |
// setup options here | |
this.evaluate(function () { | |
document.getElementById('chartType').value = 4; | |
}); | |
}); |
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
Function.prototype.curry = function() { | |
var fn = this; | |
var args = [].slice.call(arguments, 0); | |
return function() { | |
return fn.apply(this, args.concat([].slice.call(arguments, 0))); | |
}; | |
} |
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
'use strict'; | |
// Add ECMA262-5 method binding if not supported natively | |
// | |
if (!('bind' in Function.prototype)) { | |
Function.prototype.bind= function(owner) { | |
var that= this; | |
if (arguments.length<=1) { | |
return function() { | |
return that.apply(owner, 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'watir-webdriver' | |
browser = Watir::Browser.new :chrome, :switches => %w[--enable-memory-info --enable-popup-blocking] | |
browser.goto 'file:///Users/npow/code/hydrogen/test.html' | |
browser.execute_script "document.getElementById('usedJSHeapSize').innerHTML = console.memory.usedJSHeapSize;" | |
hs = browser.div(:id => 'usedJSHeapSize') | |
puts hs.text |
OlderNewer