This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
class RootTest < Test::Unit::TestCase | |
temp = Class.new(self) | |
temp.class_eval do | |
def test_false | |
assert ! false | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvm gemset create FooBarApp | |
mkdir FooBarApp | |
echo "rvm 1.9.1%FooBarApp" > FooBarApp/.rvmrc | |
cd FooBarApp | |
echo $GEM_HOME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: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>_ |