I hereby claim:
- I am mattbaker on github.
- I am mattbaker (https://keybase.io/mattbaker) on keybase.
- I have a public key whose fingerprint is 9563 2B6B 6E59 F85F 3B61 2419 40D9 A66D EFF9 425F
To claim this, I am signing this object:
| Object.prototype.tap = function(f){f.apply(this); return this;} | |
| var x = {a:2}; | |
| x.tap(function(){console.log(this.a)}).a = 4; //Prints 2 | |
| console.assert(x.a == 4); |
| This example expects to have d3.min.js and d3.layout.min.js in the same directory as pie.js and pie_serv.js. | |
| Run with node pie_serv.js |
| /* jsdomtest.js: Build a pie chart using d3.js and send the result to stdout | |
| * Requires d3.js and d3.layout.js in same directory | |
| * Requires pie.js from this gist: https://gist.github.com/1509145 | |
| * ex. node jsdomtest.js > pie.svg | |
| */ | |
| var jsdom = require('jsdom'), | |
| scripts = ["file://"+__dirname+"/d3.min.js", | |
| "file://"+__dirname+"/d3.layout.min.js", | |
| "file://"+__dirname+"/pie.js"], |
| /* converttest.js: Send a PNG of a red square to STDOUT | |
| * ex. node converttest.js > test.png | |
| */ | |
| var convert = require('child_process').spawn("convert", ["svg:", "png:-"]), | |
| svgsrc = '<svg><rect height="100" width="100" style="fill:red;"/></svg>'; | |
| convert.stdout.on('data', function (data) { | |
| process.stdout.write(data); | |
| }); | |
| convert.stdin.write(svgsrc); | |
| convert.stdin.end(); |
| function Thunk(fn) { | |
| this.get = function() { | |
| var v = fn(); | |
| this.get = function() { return v }; | |
| return v; | |
| } | |
| } | |
| /* | |
| * > var x = new Thunk(function() { console.log("working..."); return 2 * 2 * 2; }) |
| /* | |
| * A Wealthfront-style Option implementation in Javascript implementing ES6 iterables | |
| * Reference: | |
| * http://eng.wealthfront.com/2010/05/better-option-for-java.html | |
| * | |
| * This only runs in current versions of Firefox. | |
| * It's recommended you use the FF Scratchpad with the web console open to see logging results: | |
| * https://developer.mozilla.org/en-US/docs/Tools/Scratchpad | |
| */ |
I hereby claim:
To claim this, I am signing this object:
| // JavaScript variables belong to one of the following scopes: global or local(function). | |
| // Basically, any variable defined outside of a function is a global variable. Variables | |
| // defined inside of a function are scoped narrowly to that function, and any other | |
| // functions defined within the scope of that function (explicit use of the var keyword assumed). | |
| var myName = "john"; | |
| var capitalizeMyName = function() { | |
| myName = myName.substring(0).toUpperCase() + myName.slice(1); | |
| var name = myName; |
| (define (encode reflector rotor-l rotor-m rotor-r letter) | |
| (list-ref alphabet | |
| (rotor-translate-right (rotate rotor-r 1) | |
| (rotor-translate-right rotor-m | |
| (rotor-translate-right rotor-l | |
| (reflect reflector | |
| (rotor-translate-left rotor-l | |
| (rotor-translate-left rotor-m | |
| (rotor-translate-left (rotate rotor-r 1) | |
| (letter-to-index letter)))))))))) |
| #!/usr/bin/env bash | |
| killall Messages Dock | |
| open /Applications/Messages.app |