Skip to content

Instantly share code, notes, and snippets.

View brandon-beacher's full-sized avatar
💭
🦑

Brandon Beacher brandon-beacher

💭
🦑
View GitHub Profile
# 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
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 = []
- 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.
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
if Regexp.last_match
PhoneNumber.new(
area_code: Regexp.last_match[1],
prefix: Regexp.last_match[2],
line_number: Regexp.last_match[3])
end
if $~
PhoneNumber.new(
area_code: $1,
prefix: $2,
line_number: $3)
end
/(\d{3})-(\d{3})-(\d{4})/.match("678-248-2440")
=> #<MatchData "678-248-2440" 1:"678" 2:"248" 3:"2440">
☁ 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
☁ 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]
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 } )