Skip to content

Instantly share code, notes, and snippets.

View indirect's full-sized avatar

André Arko indirect

View GitHub Profile
@indirect
indirect / Gemfile
Created February 12, 2010 08:11 — forked from samgranieri/Gemfile
rails 2.3.5 configuration for bundler 0.9.5
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
gem 'sqlite3-ruby', :require => 'sqlite3'
# Devise 1.0.2 is not a valid gem plugin for Rails, so use git until 1.0.3
# gem 'devise', :git => 'git://github.com/plataformatec/devise.git', :ref => 'v1.0'
group :development do
# bundler requires these gems in development
@indirect
indirect / code.rb
Created February 13, 2010 06:57
the difference between class Foo, Foo.class_eval, and Foo.instance_eval
module TopLevel
class Foo
puts "class Foo"
puts "self: #{self}"
puts "nesting: #{Module.nesting.inspect}"
puts "Method definition context: #{self}"
end
puts
@indirect
indirect / tm.sh
Created February 19, 2010 08:00
tm for easy textmate project access
function setup-tm {
mkdir -p ~/Dropbox/Settings/dotfiles/tmproj
ln -s ~/Dropbox/Settings/dotfiles/tmproj ~/.tmproj
}
function tm {
open ~/.tmproj/$1.tmproj
}
complete -W '$(ls ~/.tmproj | sed s/.tmproj//)' tm
@indirect
indirect / gist:315507
Created February 26, 2010 07:38
bundler spec fails with rack 1.1.0 installed
[andre ~/sw/gems/bundler](master⚡)$ spec -u -fs -c spec/cache/gems_spec.rb -e "copies the .gem file to vendor/cache"
bundle cache with gems when there are only gemsources
- copies the .gem file to vendor/cache
Finished in 2.096271 seconds
1 example, 0 failures
@indirect
indirect / gist:318909
Created March 1, 2010 22:58 — forked from defunkt/gist:307193
Dev-mode ruby
# Instead of this:
# $ ruby -rubygems -I lib bin/thing test
# Run this:
# $ druby thing test
function druby() {
ruby -rubygems -I lib bin/$@
}
@indirect
indirect / aliases.sh
Created March 7, 2010 06:12
super-powered mate
# Enhanced mate command that can open and tab-complete tmproj files in ~/.tmproj
# To use, save your TM projects as ~/.tmproj/foo.tmproj, then open with `mate foo`
function mate {
if [ -a "$(cd ~/.tmproj; pwd)/$1.tmproj" ]; then
open "$(cd ~/.tmproj; pwd)/$1.tmproj"
else
/usr/bin/env mate "$1"
fi
}
complete -f -W '$(ls ~/.tmproj | sed s/.tmproj//)' mate
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.engineyard.redis</string>
<key>Program</key>
<string>/usr/local/bin/redis-server</string>
<key>ProgramArguments</key>
<array>
@indirect
indirect / quine.rb
Created March 20, 2010 05:37
a ruby quine
lines = ["puts \"lines = \#{lines.inspect}\"", "lines.each{|l| puts l }"]
puts "lines = #{lines.inspect}"
lines.each{|l| puts l }
@indirect
indirect / debug_proxy.rb
Created March 23, 2010 22:11 — forked from eventualbuddha/debug_proxy.rb
Debug proxy objects
# ruby -rdebug_proxy -e "DebugProxy.new('foo', :string).gsub!(/o/, 'a')"
#
# DebugProxy (string) -------------------------
# | |
# | Method called on proxy object: |
# | gsub!(/o/, "a") |
# | |
# | Stack trace of method call: |
# | -e:1 |
# | |
@indirect
indirect / steps.sh
Created March 25, 2010 23:06
creating an edge rails3 app
mkdir my_app
cd my_app
echo "source :rubyforge\ngem 'rails', :git => 'git://github.com/rails/rails.git'" > Gemfile
gem install bundler
bundle install
bundle exec rails .
bundle exec rails server