Skip to content

Instantly share code, notes, and snippets.

function rvm_require_ruby
{
if ! rvm list strings | grep -q "^$1" ; then
echo "ERROR: Requires Ruby Version: '$1'"
return 1
fi
return 0
}
autocmd BufWritePre * :%s/\s\+$//e
@pillowfactory
pillowfactory / partials.rb
Created June 9, 2010 03:49 — forked from lenary/partials.rb
Sinatra Partials
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)