Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt McCray mattmccray

  • Elucidata unLTD
  • Dallas, TX
View GitHub Profile
@mattmccray
mattmccray / EntryPoint.ts
Last active Oct 10, 2015 — forked from flq/EntryPoint.ts
Gists for the blog post porting react app to tyescript
View EntryPoint.ts
import {assign} from 'lodash'
function startModule() {
//etc.
}
global['Project'] = assign(global['Project'] || {}, {
startModule
});
@mattmccray
mattmccray / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// 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
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
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
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