- Install Xcode (Avaliable on the Mac App Store)
- Install Xcode Command Line Tools (Preferences > Downloads)
- Install depot_tools
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ nano ~/.zshrc
- Add
path=('/path/to/depot_tools' $path)
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 User = (function() { | |
var cache = new WeakMap(); | |
function User( name ) { | |
cache.set( this, {} ); | |
this.name = name; | |
} | |
User.prototype = { |
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
Function.prototype.curry = function curry() { | |
var fn = this, | |
arity = fn.length, | |
slice = Array.prototype.slice, | |
args = slice.call( arguments ); | |
function accumulator() { | |
var locArgs = args; | |
if ( arguments.length > 0 ) { |
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
// needs to be required once per process to set up the hook | |
require('./yaml.js'); | |
// now i can require a yml file. yay! | |
console.log( require('./test') ); |
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
function construct() { | |
if ( this && typeof this.init === 'function' ) { | |
this.init.apply( this, arguments ); | |
} | |
} | |
function extend( obj ) { | |
var proto = Object.create( this && this.prototype || {} ), | |
type = typeof obj, | |
key; |
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
// For more documentation and a newer version, | |
// check out the full repo: https://github.com/kevincennis/TinyMusic | |
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
// Y Combinator | |
// λf.(λg.f(λy.g g y))(λg.f(λy.g g y)) | |
// | |
// derives the fixed-point of the input function | |
// such that Y( f ) and f( Y( f ) ) are computationally equivalent | |
function Y( f ) { | |
return (function( g ) { | |
return f(function( y ) { |
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
// KEWL TEMPLATING LIBRARY | |
function tmpl( fn ) { | |
return function( data ) { | |
return fn( data ); | |
}; | |
} | |
// DEMO... |
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
// assuming a var named `buffer` exists and is an AudioBuffer instance | |
// start a new worker | |
// we can't use Recorder directly, since it doesn't support what we're trying to do | |
var worker = new Worker('recorderWorker.js'); | |
// initialize the new worker | |
worker.postMessage({ | |
command: 'init', |
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
// assuming `rec1` and `rec2` are both instances of Recorder... | |
var buf1L, buf1R, buf2L, buf2R, worker, count = 0; | |
// start a new worker | |
// we can't use Recorder directly, since it doesn't support what we're trying to do | |
worker = new Worker('recorderWorker.js'); | |
// initialize the new worker | |
worker.postMessage({ |