Skip to content

Instantly share code, notes, and snippets.

View zerowidth's full-sized avatar

Nathan Witmer zerowidth

View GitHub Profile
# as of 2010-04-01
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/mysql/bin:$PATH:/Users/nathan/scripts
export PATH=/Users/nathan/bin:/Users/nathan/bin/gitflow:/opt/local/lib/postgresql84/bin:$PATH
export LD_LIBRARY_PATH=/opt/local/lib
# export EDITOR="/Users/nathan/bin/mate_wait"
# export EDITOR="/Users/nathan/bin/mvim -f" # -f means don't fork, wait for changes
export EDITOR="/opt/local/bin/vim -f"
# export EDITOR="/opt/local/bin/mvim -f"
@zerowidth
zerowidth / super_semantics.rb
Created March 4, 2010 16:26
ruby 1.8.7 p249 bug
class A
def foo
"foo!"
end
end
class B < A
def foo
lambda { super }
end
class ParentDocument
include MongoMapper::Document
# parent document has ... well, whatever.
timestamps!
many :nodes do
# root documents only
def roots
@zerowidth
zerowidth / module ancestry.txt
Created November 17, 2009 23:09
ancestry in ruby
$ irb
>> module A; end
=> nil
>> module B; end
=> nil
>> module C; end
=> nil
>> module B; include A; end
=> B
>> class X; include B; end
@zerowidth
zerowidth / rack-streaming-proxy.rb
Created November 15, 2009 20:17
rack-streaming-proxy example code
require "servolux"
require "net/http"
require "uri"
# see: http://github.com/aniero/rack-streaming-proxy for the latest code
# or: sudo gem install rack-streaming-proxy --source http://gemcutter.org
module Rack
class StreamingProxy
@zerowidth
zerowidth / git_prompt.sh
Created September 22, 2009 22:43
bash promptery for git + custom colored dirty flags
# assuming you have the +bash_completion variant of git installed (macports)
# and are including bash completion's setup:
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
TEXT_BLACK='\[\e[0;30m\]' # Black - Regular
TEXT_RED='\[\e[0;31m\]' # Red
TEXT_GREEN='\[\e[0;32m\]' # Green
TEXT_YELLOW='\[\e[0;33m\]' # Yellow
" size the window so it fills the macbook screen
set columns=181
set lines=53
set gfn=Andale_Mono:h12
" colorscheme twilight2
colorscheme vibrantink
set transparency=5
#!/bin/sh
#
# This shell script passes all its arguments to the binary inside the
# MacVim.app application bundle. If you make links to this script as view,
# gvim, etc., then it will peek at the name used to call it and set options
# appropriately.
#
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic. This
# version is the fault of Benji Fisher, 16 May 2005 (with modifications by Nico
# Weber and Bjorn Winckler, Aug 13 2007).
~ ➔ sudo easy_install simplejson
Password:
Searching for simplejson
Reading http://pypi.python.org/simple/simplejson/
Reading http://undefined.org/python/#simplejson
Best match: simplejson 2.0.9
Downloading http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz#md5=af5e67a39ca3408563411d357e6d5e47
Processing simplejson-2.0.9.tar.gz
Running simplejson-2.0.9/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Irpzrr/simplejson-2.0.9/egg-dist-tmp-T_rpGb
No eggs found in /tmp/easy_install-Irpzrr/simplejson-2.0.9/egg-dist-tmp-T_rpGb (setup script problem?)
require "ostruct"
describe "wtf" do
it "fails" do
o = OpenStruct.new :foo => "lol", :bar => "what"
o.stub!(:gem)
o.gem
o.gem "foo"
end
end