View EntryPoint.ts
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
import {assign} from 'lodash' | |
function startModule() { | |
//etc. | |
} | |
global['Project'] = assign(global['Project'] || {}, { | |
startModule | |
}); |
View 0_reuse_code.js
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View memorySizeOfObject.js
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 memorySizeOf(obj) { | |
var bytes = 0; | |
function sizeOf(obj) { | |
if(obj !== null && obj !== undefined) { | |
switch(typeof obj) { | |
case 'number': | |
bytes += 8; | |
break; | |
case 'string': |
View hxn.sh
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
export OLDPATH=$PATH | |
export HAXE_NIGHTLY=$HOME/bin/haxe_nightly | |
export USE_HAXE_NIGHTLY=false | |
hxn(){ | |
if [ -z "$USE_HAXE_NIGHTLY" ] || $USE_HAXE_NIGHTLY; then | |
echo "Changing to Haxe stable version" | |
export HAXE_STD_PATH=$OLD_HAXE_STD | |
export PATH=$OLDPATH | |
export USE_HAXE_NIGHTLY=false | |
else |
View EventEmitter.coffee
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
class EventEmitter | |
emit: (event, args...) -> | |
return false unless @events?[event] | |
listener args... for listener in @events[event] | |
return true | |
addListener: (event, listener) -> | |
@emit 'newListener', event, listener | |
((@events?={})[event]?=[]).push listener |