This file contains 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
#!/usr/bin/env ruby -wKU | |
# describe "enigma" do | |
# it "fails, but why" do | |
# lambda { begin; 2 / 0 rescue NoMethodError; end }. | |
# should raise_error(ZeroDivisionError) | |
# end | |
# the inline rescue is swallowing the ZeroDivisionError exception and |
This file contains 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
stc_partner_plan ∴ cap staging deploy | |
triggering start callbacks for `staging' | |
* executing `moonshine:configure' | |
* executing `staging' | |
triggering start callbacks for `deploy' | |
* executing `moonshine:configure' | |
* executing `multistage:ensure' | |
triggering after callbacks for `multistage:ensure' | |
* executing `moonshine:configure_stage' | |
* executing `deploy' |
This file contains 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
ruby-1.9.2-p180 :001 > Order.find_or_create_by_id(999999) | |
=> #<Order id: 999999, customer_id: nil, status: nil, created_at: "2011-07-06 16:01:08", updated_at: "2011-07-06 16:01:08"> | |
ruby-1.9.2-p180 :002 > Order.find_or_create_by_id(nil) | |
=> #<Order id: 1000000, customer_id: nil, status: nil, created_at: "2011-07-06 16:01:16", updated_at: "2011-07-06 16:01:16"> | |
ruby-1.9.2-p180 :003 > Order.find 999999 | |
=> #<Order id: 999999, customer_id: nil, status: nil, created_at: "2011-07-06 16:01:08", updated_at: "2011-07-06 16:01:08"> | |
ruby-1.9.2-p180 :004 > Order.find_or_create_by_id(nil) | |
=> #<Order id: 1000001, customer_id: nil, status: nil, created_at: "2011-07-06 16:02:38", updated_at: "2011-07-06 16:02:38"> | |
ruby-1.9.2-p180 :005 > |
This file contains 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
module ProductsHelper | |
def print_price(price) | |
number_to_currency(price) | |
end | |
def print_stock(quantity) | |
if quantity > 0 | |
content_tag :span, "In Stock (#{quantity})", :class => "in_stock" | |
else | |
content_tag :span, "Out of Stock", :class => "out_stock" |
This file contains 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
class Order < ActiveRecord::Base | |
attr_accessible :customer_id, :status | |
has_many :order_items | |
def total | |
order_items.inject(0) do |acc, order_item| | |
acc += order_item.subtotal | |
end | |
end |
This file contains 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
%table | |
%tr | |
%td.optional_class_name | |
Text | |
Text | |
Text |
This file contains 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
+-zsh:15> . /Users/george/.rvm/scripts/rvm | |
+/Users/george/.rvm/scripts/rvm:9> [[ ":$SHELLOPTS:" -regex-match ":posix:" ]] | |
+/Users/george/.rvm/scripts/rvm:9> true | |
+/Users/george/.rvm/scripts/rvm:12> export HOME rvm_prefix rvm_user_install_flag rvm_path | |
+/Users/george/.rvm/scripts/rvm:13> HOME=/Users/george | |
+/Users/george/.rvm/scripts/rvm:15> : rvm_stored_umask:022 | |
+/Users/george/.rvm/scripts/rvm:16> (( 0 == 0 )) | |
+/Users/george/.rvm/scripts/rvm:18> rvmrc=/etc/rvmrc | |
+/Users/george/.rvm/scripts/rvm:20> [[ -f /etc/rvmrc ]] | |
+/Users/george/.rvm/scripts/rvm:18> rvmrc=/Users/george/.rvmrc |
This file contains 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
~ ∴ source "$HOME/.rvm/scripts/rvm" | |
/Users/george/.rvm/scripts/initialize:50: __rvm_cleanse_variables: function definition file not found |
This file contains 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
~ ∴ (source "$HOME/.rvm/scripts/rvm") | |
~ ∴ set -x source "$HOME/.rvm/scripts/rvm" | |
+omz_termsupport_precmd:1> title '%15<..<%~%<<' '%n@%m: %~' | |
+title:1> [ '' '!=' true ']' | |
+title:2> [[ xterm == screen* ]] | |
+title:4> [[ xterm == xterm* ]] | |
+title:5> print -Pn '\e]2;%n@%m:\ %\~\a' | |
+title:6> print -Pn '\e]1;%15\<..\<%\~%\<\<\a' | |
+-zsh:8> git_prompt_info | |
+git_prompt_info:1> ref=+git_prompt_info:1> ref='' |
This file contains 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
~ ∴ set -x ; . "$HOME/.rvm/scripts/rvm" | |
+-zsh:1> . /Users/george/.rvm/scripts/rvm | |
+/Users/george/.rvm/scripts/rvm:9> [[ ":$SHELLOPTS:" -regex-match ":posix:" ]] | |
+/Users/george/.rvm/scripts/rvm:9> true | |
+/Users/george/.rvm/scripts/rvm:12> export HOME rvm_prefix rvm_user_install_flag rvm_path | |
+/Users/george/.rvm/scripts/rvm:13> HOME=/Users/george | |
+/Users/george/.rvm/scripts/rvm:15> umask | |
+/Users/george/.rvm/scripts/rvm:15> : rvm_stored_umask:022 | |
+/Users/george/.rvm/scripts/rvm:16> (( 0 == 0 )) | |
+/Users/george/.rvm/scripts/rvm:18> rvmrc=/etc/rvmrc |