Skip to content

Instantly share code, notes, and snippets.

View 8bitDesigner's full-sized avatar

Paul Sweeney 8bitDesigner

  • Cisco Meraki
  • Los Angeles
View GitHub Profile
web: node index.js
@8bitDesigner
8bitDesigner / install.sh
Created November 27, 2013 21:18
Booting up a fresh Ruby dev environment
# Prep /usr/local
sudo chown $USER:admin /usr/local/
# Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
brew doctor
# Install git, imagemagick, redis, mongodb, postgres
brew install git imagemagick redis mongo postgres
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
@8bitDesigner
8bitDesigner / .powrc
Last active December 28, 2015 22:09 — forked from nbibler/gist:5307941
Everything you need to use RVM _sanely_.
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi
@8bitDesigner
8bitDesigner / _usage.js
Last active December 23, 2015 00:59
"Multiple inheritance" in Javascript
function Parent() {}
Parent.prototype.a = 'Foo'
Parent.prototype.aGetter = function() {
return this.a
}
function Child() {
inherit(this, Parent)
}
@8bitDesigner
8bitDesigner / logger.js
Created September 13, 2013 20:49
Redefine stdout and stderr as writeable file streams
var fs = require('fs')
, logfile = './logs/output.log'
, errfile = './logs/error.log'
function logger(dest) {
return function() {
return fs.createWriteStream(dest, {flags: 'a'});
}
}
@8bitDesigner
8bitDesigner / wrapper.js
Created August 20, 2013 22:40
Supporting AMD and global modules
function MyClass() {
// ...
}
// AMD and window support
if (typeof define === "function") {
define(function () { return new MyClass(); });
} else if (typeof global.alertify === "undefined") {
global.myClass = new myClass();
}
@8bitDesigner
8bitDesigner / pow.sh
Created August 17, 2013 02:09
Link the current directory to ~/.pow
ln -s $(pwd) ~/.pow/$(basename $(pwd))
@8bitDesigner
8bitDesigner / _usage.js
Last active December 21, 2015 05:08
Properly inheriting objects in Javasacript
function Child() {
Parent.call(this);
}
extends(Child, Parent);
@8bitDesigner
8bitDesigner / cookie.coffee
Created August 13, 2013 21:17
Cookie accessor
@8bitDesigner
8bitDesigner / README.md
Last active December 20, 2015 19:59
6-Line Static file server

Simple Static file server

Handy for when working on single-page apps

Usage

  1. npm install -g server-here
  2. here (if you're in a folder with files you want to serve)

Options

here --dir [directory to load files from] --port [port to use]