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 TEST=1 tclsh | |
# Lexical scoping in Tcl | |
proc let {block args} { | |
try { | |
set captured_vars [uplevel [list capture [block args]]] | |
set all_var_names [uplevel {info vars}] | |
foreach var [block args] value $args { | |
uplevel [list catch [list unset $var]] |
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
> package = stitch.createPackage({ paths: ['basecamp-mobile/lib'] }) | |
> package.findRequires(function(err, requires) { console.log(requires) }) | |
> [ 'cinco/application', | |
'cinco/date_time', | |
'cinco/collection', | |
'cinco/util', | |
'basecamp/collections/collection', | |
'basecamp/models/comment', | |
'basecamp/models/company', | |
'basecamp/models/milestone', |
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
$ sudo su - | |
# mkdir /etc/resolver | |
# cat > /etc/resolver/test | |
nameserver 127.0.0.1 | |
port 2155 | |
^D | |
^D | |
$ brew install dnsmasq | |
$ dnsmasq --port=2155 --no-resolv --address=/.test/127.0.0.1 | |
$ ping foo.test |
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
{Script} = process.binding 'evals' | |
natives = process.binding 'natives' | |
Path = require 'path' | |
FS = require 'fs' | |
globals = { | |
Buffer, process, console, | |
setTimeout, clearTimeout, | |
setInterval, clearInterval |
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 detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |
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 dom = require("jsdom/jsdom/level2/core").dom.level2.core; | |
var browser = require("jsdom/jsdom/browser"); | |
exports.createWindow = function() { | |
var bom = browser.browserAugmentation(dom); | |
var window = browser.windowAugmentation(dom); | |
for (var key in bom) window[key] = bom[key]; | |
return window; | |
} |
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
require "coffee-script" | |
require "benchmark" | |
Benchmark.bmbm do |x| | |
x.report("evaluate") do | |
100.times { CoffeeScript.evaluate "a = 1" } | |
end | |
end |
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
window.addEventListener "DOMContentLoaded", -> | |
body = $ "body" | |
canvas = $ "#canvas" | |
chalkboard = $ "#chalkboard" | |
close = $ "#close" | |
ledge = $ "#ledge" | |
lightswitch = $ "#lightswitch" | |
output = $ "#output" | |
shade = $ "#shade" | |
share = $ "#share" |
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
// Safari | |
var f = function() {}, ks = []; | |
f.prototype = {}; | |
for (var k in f) ks.push(k); | |
ks // => ["prototype"] |
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
;; How to unfuck html-helper-mode. | |
(add-hook 'html-helper-mode-hook | |
'(lambda () | |
(auto-fill-mode nil) | |
(set (make-local-variable 'indent-line-function) | |
'sgml-indent-line) | |
(define-key html-helper-mode-map (kbd "RET") 'newline-and-indent) | |
(define-key html-helper-mode-map (kbd "TAB") 'indent-for-tab-command))) |