Skip to content

Instantly share code, notes, and snippets.

describe 'LTPhotos'
describe 'given a photo form with a request method PUT'
before
form = $(fixture('photo-form'))
$.LTPhotoUpload.preserveFormParams(form)
file = form.find('input[type=file]')
ret = $.LTPhotoUpload.adjustFormParameters( file )
end
* The length of an identifier determines its scope. Use one-letter
variables for short block/method parameters, according to this
scheme:
a,b,c: any object
d: directory names
e: elements of an Enumerable
ex: rescued exceptions
f: files and file names
i,j: indexes
# use e for elements of an Enumerable
Item.all.each { |e| puts e.name }
# use f for files
Dir["app/**/*.rb"].each { |f| require f }
# use ex for rescued Exceptions
begin
open(uri)
rescue OpenURI::HttpError => ex
def on(error, message = (block_given? ? yield : raise(ArgumentError)))
handle(error) do
@output << message
end
end
protected
def handle(error)
if (errors = @errors.select {|e| error === e }).any?
require 'test/unit'
class RootTest < Test::Unit::TestCase
temp = Class.new(self)
temp.class_eval do
def test_false
assert ! false
end
end
rvm gemset create FooBarApp
mkdir FooBarApp
echo "rvm 1.9.1%FooBarApp" > FooBarApp/.rvmrc
cd FooBarApp
echo $GEM_HOME
rvm 1.9.1%global
gem list
# something like this would be displayed if you have an empty global list
#
# *** LOCAL GEMS ***
#
# START INSTALLING GEMS!
# I use the following for all of my projects in ruby1.9
cd /Applications/PeepOpen.app/Contents/Resources/
ack ignore
# This returns the following in my copy
# FuzzyRecord.rb
# 65: ignorePatterns = /^(\.DS_Store|\.git|\.hg|\.svn|build|tmp|log|vendor\/(rails|gems|plugins))\b/i
# 66: next if relativeFilename.match(ignorePatterns)
# 69: # TODO: Should ignore dot directories
desc "redis ENV", "Start the redis server in the supplied environment"
def redis(env = ENV['RACK_ENV'] || 'development')
verify_config env
exec "redis-server config/redis/#{env}.conf"
end
:noremap ,l <C-w>l
:noremap ,h <C-w>h
:noremap ,j <C-w>j
:noremap ,k <C-w>k
:noremap ,v :vsp<CR>:enew<CR>
:noremap ,s :split<CR>:enew<CR>
" Maximize current window
:noremap ,- <C-W>_