Skip to content

Instantly share code, notes, and snippets.

@auxesis
auxesis / open_gem.sh
Created January 1, 2011 03:11
Quick and dirty shell function to cd to a gem's install location.
# Insert into your .bashrc
function open_gem() {
if [ -z "$1" ]; then
echo "Usage: open_gem <gem>"
return 1
fi
name=$1
src=$(gem which $name)
@auxesis
auxesis / unfuck-lastfm-profile.rb
Created January 9, 2011 13:38
Quick and dirty hack to clean out Last.fm track profile one page at a time.
#!/usr/bin/env ruby
require 'rubygems'
require 'webrat'
require 'rspec'
require 'nokogiri'
Webrat.configure do |config|
config.mode = :mechanize
end
When /^I build the gem$/ do
project_root = Pathname.new(File.dirname(__FILE__)).parent.parent.expand_path
rakefile = project_root.join('Rakefile')
File.exist?(rakefile).should be_true
puts `rake -f #{rakefile} build`
end
When /^I install the latest gem$/ do
project_root = Pathname.new(File.dirname(__FILE__)).parent.parent.expand_path
#!/usr/bin/env ruby
require 'rubygems'
puts "Load paths before requires"
p Gem.path
p $:
puts
puts "Requiring cucumber"

Anatomy of a Cucumber test suite

features/                  # Base directory for all your features
features/step_definitions/ # Generic steps used across multiple features
features/support/          # Cucumber bootstrapping directory

On boot, Cucumber will load up features/support/env.rb. This is where you should include all the libraries you want to use. So features/support/env.rb doesn't get cluttered, it's suggested you split out your customisations into

unix@glenmorangie] -> cucumber request.feature
no such file to load -- spec/expectations (LoadError)
/home/lunix/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/home/lunix/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
/home/lunix/work/bulletproof/projects/cauldron/features/support/env.rb:9
/home/lunix/.rvm/gems/ruby-1.8.7-p330/gems/cucumber-0.10.0/bin/../lib/cucumber/rb_support/rb_language.rb:143:in `load'
/home/lunix/.rvm/gems/ruby-1.8.7-p330/gems/cucumber-0.10.0/bin/../lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file'
/home/lunix/.rvm/gems/ruby-1.8.7-p330/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:176:in `load_file'
/home/lunix/.rvm/gems/ruby-1.8.7-p330/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:78:in `load_files!'
/home/lunix/.rvm/gems/ruby-1.8.7-p330/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:77:in `each'
ssh-dss AAAAB3NzaC1kc3MAAAEBANuhNGNwlwQNzjUiHuHuTEFokl5W8aiMax0Elp6TI11cAQRNIiBNFbcEf+mRLalO+T9wun0x99FsjfCIS/czNq37wzXZUxY7Uea2o/cKBqjoPZd7REyi/TZHuGWAEZBTDEsqIiaAfeUNBwJgkg+MvHQgaoyyGsRhQBsbR9zCIWSyDVm/jeefvMlA9urrBZEsehmzqI59jgWtWIm1QAitLzlDHuFNRsadUDwGz4t9BrBXDP7GYCE5Lp/DH0WCXgMx4Xzw54SVhA8C6SVpqDbcYpEtiWCeg/FyCUfIir55WcfIAQeN0CqQcDUlH9P6C+k/zuwS8Ifc/0TlagKtGeoyNgkAAAAVALEY1QedNp4tfl362is0fmT+/tc3AAABAQDJqWp6Rq964NaHqPAjlfehnl8OrMy6DO6uF2WqFarl0Tjtnt4scbbtfLQU9A0m0tl4hEMENNKjS/UHDt46LOcR9r8yBm52OMatYrPIyrkSmv5hZuwoNkdMb9Y9LKErLHV43pEjdC+8z2N8SnOe4HN9AQfMATnoyjF8NxqBuGCdgfUKpJpMJqvE82Nr9eKfPCgpUEy4wgJ1DITfSWh7UuvRnafA/Z+Xjdw46aZyWtnbkmMJTRS6zwph7LtXhxMF0nWwg+0yz/LCClamA/XkTLwVHLBtt3BDYOHvpLfXWgHpCR8MXntltFJKDW7QChybzqVXtt7GBfW3DC2bSB2/K90sAAABAQCxY45wD1hArQf6te4dwM3LGRNpRYn09LQk3EP9qsob7xYqtQmGNOlPBBqsw3VTnw5cf8RRFZZ4dYrEkHVhENHI1FilwmO5WyXncXIk5VUwGG41cgjdUSbs32pel1zllbpacYmkoPHhmjRr6Md8l9MYNdXWrLwTeK3rMgAUhuqRIprR9Gq0c8jvNL0L7sU/dwcMP9j0M7ahhVQUXA19TxQP3NxFxIjOMjKru9B5FsWddenjwogcFbcZzzb6GHneQ8ugaoUg/TO0
" sessions, backups, temporary files
set backup " Enable creation of backup file.
set backupdir=~/.vim/backups " Where backups will go.
set directory=~/.vim/tmp " Where temporary files will go.
set viminfo='100,f1
" how long key sequences can take to complete
set timeoutlen=250
" color schemes
#!/bin/bash
#
# flock -e -w 0 200 - setup an exclusive lock around every command to be executed (we use fd 200).
# wait indefinitely until the lock is released before doing anything.
set -e
(
flock -e -w 0 200
#!/usr/bin/env ruby
def kill_lingering_daemons
@daemons && @daemons.each do |pipe|
Process.kill("KILL", pipe.pid)
end
end
def spawn_daemon(command)
puts command