Skip to content

Instantly share code, notes, and snippets.

View JoeyButler's full-sized avatar

Joey B JoeyButler

  • The Vagabond Programmer
  • A city near you
View GitHub Profile
@JoeyButler
JoeyButler / .bash_profile
Created June 22, 2011 01:41
bash prompt with current rvm gemset & git branch
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
WHITE="\[\033[1;37m\]"
BLACK="\[\033[0;30m\]"
OFF="\[\033[0m\]"
# Download git-completion from https://github.com/rtomayko/dotfiles/blob/rtomayko/.bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-completion.bash
export PS1="$RED\$(~/.rvm/bin/rvm-prompt) $GREEN\w$YELLOW\$(__git_ps1 "[%s]")$OFF \$ "
@JoeyButler
JoeyButler / dynamicly-created-functions.js
Created July 2, 2011 17:30
Example of dynamically creating functions in javascript.
var funcs = ['functionOne', 'functionTwo', 'functionThree'];
for(func in funcs) {
(function (func_name) {
window[func_name] = function () {
console.log('My name is ' + func_name);
}
})(funcs[func]);
}
functionOne();
@JoeyButler
JoeyButler / .gitconfig
Created August 2, 2011 17:48
useful git aliases
[alias]
s = show
b = branch
ba = branch -a
ci = commit
cp = cherry-pick
cia = commit -a --amend
cim = commit -am
co = checkout
cob = checkout -b
@JoeyButler
JoeyButler / chat.html
Created October 24, 2011 00:14
Simple Chat app
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
function debug(str){ $("#debug").append("<p>"+str+"</p>"); };
if(typeof WebSocket === 'undefined') {
alert("Your browser does not support websockets.")
}
@JoeyButler
JoeyButler / .vimrc.local
Created January 22, 2012 23:18
Vim: Remap window mappings to omit the <C-w>
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-H> <C-W>h
map <C-L> <C-W>l
@JoeyButler
JoeyButler / intense.rb
Created April 20, 2012 22:18
Hack Challenge
require "rubygems"
require "ruby-debug"
require "test/unit"
class Object
def intensity
# Implementation goes here
end
end
@JoeyButler
JoeyButler / INSTALL.md
Created July 9, 2012 04:20
Mini Thor app to create a new ruby project

thor install app_create.thor Make sure that the templates__generic_gemfile.erb is renamed and moved to ~/.thor/templates/generic_gemfile.erb

Then you can run thor list to verify that the script was installed successfully. If the command appears in the output, you should be good to run thor app:create APP_NAME.

@JoeyButler
JoeyButler / .vimrc.local
Created August 27, 2012 17:38
Vim config
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'ctrlp'
filetype plugin indent on
" vundle config end
@JoeyButler
JoeyButler / kernel_method.rb
Created March 4, 2013 04:43
Track down source code with Kernel#method
# TL;DR
puts method_find = [].method(:find)
# => #<Method: Array(Enumerable)#find>
if RUBY_VERSION =~ /^1.8/
[method_find.__line__, method_find.__line__]
else
method_find.source_location
end
@JoeyButler
JoeyButler / gist:5807538
Created June 18, 2013 17:35
pv_test.txt
# http://www.catonmat.net/blog/unix-utilities-pipe-viewer/
$ pv log/development.log | gzip > dev.log.gz
50.8MiB 0:00:00 [69.6MiB/s] [=====================================================>] 100%