Skip to content

Instantly share code, notes, and snippets.

View zerowidth's full-sized avatar

Nathan Witmer zerowidth

View GitHub Profile
--- /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb 2008-12-07 13:54:11.000000000 -0700
+++ /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb 2008-12-07 13:54:11.000000000 -0700
@@ -128,6 +128,10 @@
# Gem::Requirement and Gem::Version documentation.
def self.activate(gem, *version_requirements)
+ if ENV["GEM_DEBUG"]
+ STDERR.puts "activating #{gem} #{version_requirements.inspect}"
+ caller[2..-1].each {|c| STDERR.puts " #{c}"}
+ end
function d() {
if [ -n "$1" ]; then
if [ -d "$1" ]; then
pushd $1 >/dev/null
mvim -c :NT
popd >/dev/null
else
echo "$1 is not a directory"
fi
else
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
~ ➔ 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?)
#!/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).
" 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
@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
@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 / 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
class ParentDocument
include MongoMapper::Document
# parent document has ... well, whatever.
timestamps!
many :nodes do
# root documents only
def roots