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 bgImgs = [ | |
'/images/foo.png' | |
, '/images/bar.png' | |
, '/images/foobar.png' | |
]; | |
$(function () { | |
if (bgImgs.length > 1) { | |
var bgImage = $('#bgImage') | |
, index = 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
class StateMachine(object): | |
"""the brain - manages states""" | |
def __init__(self): | |
self.states = {} | |
self.active_state = None | |
def add_state(self, state): | |
"""Adds a new state""" | |
self.states[state.name] = state |
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
String::endswith = (str) -> @match new RegExp "#{str}$" | |
String::startswith = (str) -> @match new RegExp "^#{str}" | |
String::splitLines = () -> @split /\r\n|\r|\n/ | |
# not unlike jQuery.extend. | |
# adds new properties in object to target. | |
# does not override anything any target properties. | |
# TODO: test! | |
exports.extend = (target, object) -> |
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
# credit http://stackoverflow.com/a/1920585/962091 | |
# sorts keys and pretty prints | |
echo '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool |
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
// this isn't all the possible valid periods, but it's a good batch | |
var periods = [] | |
, seed = ['pm', 'p', 'p.m.', 'pm.', 'p.m']; | |
for (var i=0; i<seed.length; i++) { | |
var s = seed[i]; | |
periods.push(s); | |
periods.push(s.toUpperCase()); | |
periods.push(s.replace('m', 'M')); | |
periods.push(s.replace('p', 'P')); |
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 http = require('http'); | |
var fs = require('fs'); | |
var helloModuleString = "exports.world = function() { return 'Hello World\\n'; }"; | |
fs.writeFile('./hello.js', helloModuleString, function (err) { | |
if (err) return console.log(err); | |
var hello = require('./hello'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); |
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
# credit: http://stackoverflow.com/a/7849648/962091 | |
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch unwanted-dir/*" --prune-empty -- --all |
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
[user] | |
name = Zack Dever | |
email = [email protected] | |
[github] | |
user = zever | |
[core] | |
editor = vim | |
excludesfile = /Users/dp/.gitignore_global | |
[help] | |
autocorrect = -1 |
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
""" Vundle """"""""""""""""""""""""""""""""""""""""""""" | |
" | |
" Brief help | |
" :BundleList - list configured bundles | |
" :BundleInstall(!) - install(update) bundles | |
" :BundleSearch(!) foo - search(or refresh cache first) for foo | |
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" NOTE: comments after Bundle command are not allowed.. |
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 local node packages | |
export PATH="./node_modules/.bin:$PATH" | |
# paint with all the colors of the wind | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
# ref: http://www.ibm.com/developerworks/linux/library/l-tip-prompt/ | |
export PS1="\u@\h \[\e[37m\]\W \[\e[36m\]$ \[\e[0m\]" |