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
# an module to redirect a controller to http from https | |
# drop this in lib/httpable.rb | |
module Httpable | |
def self.included(base) | |
base.send :include, InstanceMethods | |
base.before_filter :redirect_to_http | |
end | |
module InstanceMethods |
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 Ledger | |
def initialize(product, page, per_page) | |
@product = product | |
@quantity_in_stock = product.quantity_in_stock | |
@limit = Integer(per_page) | |
@offset = (Integer(page) - 1) * @limit | |
@ledger_lines = [] | |
lines = [] |
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
- title: An example multi-line string in YAML | |
body : | | |
This is a multi-line string. | |
"special" metacharacters may | |
appear here. The extent of this string is | |
indicated by indentation. |
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
match_data = /(?<area_code>\d{3})-(?<prefix>\d{3})-(?<line_number>\d{4})/.match("678-248-2440") | |
if match_data | |
PhoneNumber.new( | |
area_code: match_data[:area_code], | |
prefix: match_data[:prefix], | |
line_number: match_data[:line_number]) | |
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
if Regexp.last_match | |
PhoneNumber.new( | |
area_code: Regexp.last_match[1], | |
prefix: Regexp.last_match[2], | |
line_number: Regexp.last_match[3]) | |
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
if $~ | |
PhoneNumber.new( | |
area_code: $1, | |
prefix: $2, | |
line_number: $3) | |
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
/(\d{3})-(\d{3})-(\d{4})/.match("678-248-2440") | |
=> #<MatchData "678-248-2440" 1:"678" 2:"248" 3:"2440"> |
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
☁ giving101 [master] ⚡ host www.giving101.org | |
www.giving101.org is an alias for giving101.heroku.com. | |
giving101.heroku.com is an alias for proxy.heroku.com. | |
proxy.heroku.com has address 174.129.22.35 | |
proxy.heroku.com has address 174.129.23.128 | |
proxy.heroku.com has address 184.73.171.204 | |
proxy.heroku.com has address 50.16.215.20 | |
☁ giving101 [master] ⚡ host www.mygivehub.org | |
www.mygivehub.org is an alias for appid1455482herokucom-408736963.us-east-1.elb.amazonaws.com. | |
appid1455482herokucom-408736963.us-east-1.elb.amazonaws.com has address 107.21.100.139 |
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
☁ giving101 [master] ⚡ heroku addons:remove ssl:sni | |
-----> Removing ssl:sni from giving101... done, ($5/mo) | |
☁ giving101 [master] ⚡ heroku sharing:transfer [email protected] | |
App ownership transfered. New owner is [email protected] |
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
product = ChargifyProduct.find_or_initialize_by_product_id('17789') | |
product.update_attributes!( | |
:handle => "silver-level", | |
:name => "Silver Level Partner", | |
:rate => "$39 every 30 days", | |
:production => true, | |
:setup_fee => "$0", | |
:data => { :silver => true, :offline => false } ) |