Skip to content

Instantly share code, notes, and snippets.

View iain's full-sized avatar

iain iain

View GitHub Profile
@iain
iain / user.rb
Created October 19, 2009 19:05
Weird RSpec issue
1)
'User should get all active users' FAILED
expected any? to return false, got true
./spec/models/user_spec.rb:26:
@iain
iain / colors.rb
Created August 30, 2009 12:15
CSS colors by name
# CSS colors supported by all major browsers.
# Source: http://www.w3schools.com/CSS/css_colornames.asp
module Colors
extend self
def alice_blue; "#f0f8ff"; end
def antique_white; "#faebd7"; end
def aqua; "#00ffff"; end
def aquamarine; "#7fffd4"; end
def azure; "#f0ffff"; end
@iain
iain / Automated Vim sessions
Created July 24, 2009 09:15
A piece of vimrc
" Save session and close vim by pressing SQ.
" When you open vim again, without arguments, it opens the saved session.
nmap SQ <ESC>:mksession! ~/.vim/Session.vim<CR>:wqa<CR>
function! RestoreSession()
if argc() == 0 "vim called without arguments
execute 'source ~/.vim/Session.vim'
end
endfunction
@iain
iain / smotje.recipe.rdoc
Created July 13, 2009 17:07
Smotje, gerecht van mijn oma, erg lekker!
$ time dd if=/dev/zero bs=1024 count=1000000 of=~/1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes transferred in 15.577478 secs (65735929 bytes/sec)
real 0m15.609s
user 0m1.299s
sys 0m6.948s
$ rake spec
(in /home/iain/code/remarkable/remarkable)
Exemplo desativado: não deve conter os valores fornecidos
Example disabled: single contain
Example disabled: should contain the given values
Example disabled: should not contain the given values
...............*................................................
Pending:
@iain
iain / Rake spec with normal Remarkable procedure
Created May 24, 2009 09:56
Remarkable 3.1.2 on Ruby 1.9.1
$ rake spec
/home/iain/code/sail/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant Remarkable::ActiveRecord (NameError)
from /home/iain/code/sail/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing_with_dependencies'
from /usr/local/lib/ruby/gems/1.9.1/gems/remarkable_rails-3.1.2/lib/remarkable_rails/active_orm.rb:17:in `<top (required)>'
from /home/iain/code/sail/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
from /home/iain/code/sail/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/remarkable_rails-3.1.2/lib/remarkable_rails.rb:25:in `<top (required)>'
from /home/iain/code/sail/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
from /home/iain/code/sail/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
from /home/iain/code/sail/spec/spec_helper.r
@iain
iain / gist:87691
Created March 30, 2009 08:45
Dutch version of default webrat steps
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
# Commonly used webrat steps
# http://github.com/brynary/webrat
# Dutch webrat steps translated by Iain
# http://iain.nl/
Stel /^ik ben op (.+)$/ do |page_name|
visit path_to(page_name)
end
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
@iain
iain / gist:63953
Created February 13, 2009 15:31
First try Rails template
# File management
run "rm README"
file "README.rdoc", "TODO add readme content"
run "cp config/database.yml config/database.example.yml"
run "rm public/index.html"
# RSpec as plugin, because it won't freeze easily as gem
plugin "rspec", :git => "git://github.com/dchelimsky/rspec.git"
plugin "rspec-rails", :git => "git://github.com/dchelimsky/rspec-rails.git"