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 tweet(o) | |
match(o) { | |
with(o.name == "garybernhardt") { raise TrollError } | |
with(Image i) { tweet ShortLink.for_image(i) } | |
with(Text t) { actually_tweet_here } | |
} | |
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
Dear Gary, | |
Thank you for contacting Comcast Email Support. My name is Jean and I | |
appreciate your time and effort in contacting us. I hope you are having | |
a great day. | |
I understand that you would like us to put your name and your number, | |
xxx-xxx-xxxx, right at this moment. I truly understand how this must | |
have been frustrating to you and I do apologize for any inconvenience | |
this has caused you. I can certainly understand how important it is for |
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 'a' do | |
it "raises an error when no source is found for an argument" do | |
klass = Class.new { def f(unknown_argument); end } | |
expect do | |
injector.call(klass.new.method(:f)) | |
end.to raise_error(Syringe::UnknownInjectable) | |
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
failbowl:temp(master+!?) $ git st | |
# On branch master | |
# Changes to be committed: | |
# (use "git reset HEAD <file>..." to unstage) | |
# | |
# modified: a | |
# new file: c | |
# | |
# Changes not staged for commit: | |
# (use "git add <file>..." to update what will be committed) |
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
#!/bin/ruby | |
guard 'spork' do | |
watch(%r{^config/.*\.rb$}) | |
watch(%r{^config/environments/.*\.rb$}) | |
watch(%r{^config/initializers/.*\.rb$}) | |
watch(%r{^features/support/.*\.rb$}) | |
watch('spec/spec_helper.rb') | |
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
Last login: Mon Jan 30 16:54:38 on ttys000 | |
failbowl:~(master!?) $ rvm install ree | |
Installing Ruby Enterprise Edition from source to: /Users/grb/.rvm/rubies/ree-1.8.7-2011.12 | |
ree-1.8.7-2011.12 - #fetching (ruby-enterprise-1.8.7-2011.12) | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 7773k 100 7773k 0 0 2447k 0 0:00:03 0:00:03 --:--:-- 2513k | |
ree-1.8.7-2011.12 - #extracting ruby-enterprise-1.8.7-2011.12 to /Users/grb/.rvm/src/ree-1.8.7-2011.12 | |
Applying patch 'tcmalloc' (located at /Users/grb/.rvm/patches/ree/1.8.7/tcmalloc.patch) | |
Applying patch 'stdout-rouge-fix' (located at /Users/grb/.rvm/patches/ree/1.8.7/stdout-rouge-fix.patch) |
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
# Hash form: | |
{ | |
:current_user => "CurrentUser.current_user" | |
} | |
# Discovery form with inverted app structure: | |
module Injectables | |
def current_user(session) | |
User.find(:id => session['current_user_id']) | |
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
# Rails controller | |
def create | |
@profile = ProfileManager.create(params[:profile]) | |
rescue ProfileManager::CreationFailed => e | |
render :new, :errors => e.errors | |
end | |
# Raptor route | |
create :to => "ProfileManager#create", ProfileManager::CreationFailed => render(:new) |
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
Python array methods: | |
>>> [m for m in dir([]) if not m.startswith("_")] | |
['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', | |
'sort'] | |
Ruby array methods: | |
>> ([].methods - Object.methods).sort | |
=> ["&", "*", "+", "-", "<<", "[]", "[]=", "all?", "any?", "assoc", "at", |
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
# Make a user that we'll add a book to. | |
user = User.create! | |
controller.stub(:current_user) { user } | |
# This prints []. The book list is empty. | |
p user.books | |
# Expect a book to be added to the user. This fails (see below) | |
expect { | |
post :create, :id => asin |