Skip to content

Instantly share code, notes, and snippets.

View stouset's full-sized avatar

Stephen Touset stouset

View GitHub Profile
$ gem spec --debug ~/.bundle/ruby/1.8/bundler/gems/sinatra-b525892ea06b9fac17e190c37b6500b2c2378e0b-1.0.a/sinatra-1.0.a.gem
Exception `NameError' at /Library/Ruby/Site/1.8/rubygems/command_manager.rb:163 - uninitialized constant Gem::Commands::SpecificationCommand
Exception `Gem::Exception' at /Library/Ruby/Site/1.8/rubygems/specification.rb:487 - YAML data doesn't evaluate to gem specification
Exception `IOError' at /Library/Ruby/Site/1.8/rubygems/format.rb:50 - closed stream
Exception `NoMethodError' at /Library/Ruby/Site/1.8/rubygems/commands/specification_command.rb:118 - undefined method `version' for nil:NilClass
ERROR: While executing gem ... (NoMethodError)
undefined method `version' for nil:NilClass
/Library/Ruby/Site/1.8/rubygems/commands/specification_command.rb:118:in `execute'
/Library/Ruby/Site/1.8/rubygems/format.rb:50:in `sort_by'
/Library/Ruby/Site/1.8/rubygems/commands/specification_command.rb:118:in `each'
#
# A set of aliases from my global .gitconfig taken from the most useful scripts in
# ddollar/git-utils and elsewhere on the 'net.
#
[alias]
# helper functions
current-branch = "!f() { B=$(git symbolic-ref HEAD) && echo ${B#refs/heads/}; }; f"
current-remote = "!f() { B=$(git config branch.$(git current-branch).remote) && echo ${B}; }; f"
current-merge = "!f() { B=$(git config branch.$(git current-branch).merge) && echo ${B#refs/heads/}; }; f"
current-track = "!f() { R=$(git current-remote) && M=$(git current-merge) && echo ${R}/${M}; }; f"
case
when foo then 1
when bar then 2
when baz then 3
else 4
end
# or
foo ? 1 \
~ $ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
121 364 121 364 0 0 692 0 --:--:-- --:--:-- --:--:-- 1259
Cloning into rvm...
remote: Counting objects: 12843, done.
remote: Compressing objects: 100% (3504/3504), done.
remote: Total 12843 (delta 8450), reused 12335 (delta 8019)
Receiving objects: 100% (12843/12843), 1.87 MiB | 117 KiB/s, done.
Resolving deltas: 100% (8450/8450), done.
class ActionView::Template::Handlers::Sass < ActionView::Template::Handler
include ActionView::Template::Handlers::Compilable
def compile(template)
engine = Sass::Engine.new template.source, options(template)
<<-VCJMIOEP
<<-QCGQCEWG
#{engine.render}
QCGQCEWG
~ $ rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
Installing Ruby from source to: /Users/stouset/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...
ruby-1.9.2-p180 - #fetching
ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/stouset/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #extracted to /Users/stouset/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #configuring
ruby-1.9.2-p180 - #compiling
ruby-1.9.2-p180 - #installing
Removing old Rubygems files...
@stouset
stouset / profile-env
Created April 25, 2011 19:38
Profile environment
export DOT_PROFILE=~/.profile.git
export PROFILE_BIN=$DOT_PROFILE/bin
export PROFILE_HOME_D=$DOT_PROFILE/home.d
export PROFILE_SYSTEM_D=$DOT_PROFILE/system.d
export SYSTEM_BASE=""
export SYSTEM_TYPE=""
export SYSTEM_VERSION=""
case "$(uname -s)" in
@stouset
stouset / profile-update
Created April 25, 2011 19:38
Profile update script
#!/bin/bash
# include profile location variables
. ~/.profile
. ~/.profile.git/profile-env
# update ourself
(cd $DOT_PROFILE && git pull)
# symlink all home.d files into place
@stouset
stouset / reactor.rb
Created June 13, 2011 15:42
Patch to auto-reload generated CSS/JS
def reload_browser(paths = [])
UI.info "Reloading browser: #{paths.join(' ')}"
paths.each do |path|
path = path.gsub %r{ (\.[^.]+) .* }x, '\1'
data = ['refresh', {
:path => "#{Dir.pwd}/#{path}",
:apply_js_live => @options[:apply_js_live],
:apply_css_live => @options[:apply_css_live]
}].to_json
@stouset
stouset / .gitconfig
Created July 5, 2011 12:03
Git Config
[alias]
current-branch = "!f() { B=$(git symbolic-ref HEAD) && echo ${B#refs/heads/}; }; f"
current-remote = "!f() { B=$(git config branch.$(git current-branch).remote) && echo ${B}; }; f"
current-merge = "!f() { B=$(git config branch.$(git current-branch).merge) && echo ${B#refs/heads/}; }; f"
current-track = "!f() { R=$(git current-remote) && M=$(git current-merge) && echo ${R}/${M}; }; f"
remove = "!f() { git ls-files --deleted -z $@ | xargs -0 git rm -r; }; f"
addremove = "!f() { git add -v ${@-.}; git remove $@; }; f"
incoming = "!f() { T=$( [ \"${1}\" == \"\" ] && echo $(git current-track) || echo ${1} ) && git log ..${T}; }; f"
outgoing = "!f() { T=$( [ \"${1}\" == \"\" ] && echo $(git current-track) || echo ${1} ) && git log ${T}..; }; f"
wip = "!f() { git addremove $@; git commit -m 'Work in progress'; }; f"