Calvin Correli larspind

View post-commit
1 2 3 4 5 6 7 8 9
#! /bin/zsh
 
branch_name=${$(git symbolic-ref HEAD)#refs/heads/}
 
function switch {
echo "Switching to database.yml.branch.${1}"
cp config/database.yml config/database.yml.branch.bak
cp config/database.yml.branch.${1} config/database.yml
}
View middleware.rb
1 2 3
Billing::Application.configure do
config.middleware.insert_before "ActionDispatch::ParamsParser", SendgridWebhookMiddleware
end
View model.rb
1 2 3 4 5 6 7 8 9
def render_to_string
I18n.with_locale(locale) do
Renderer.render(
file: "purchase_mailer/invoice",
layout: nil,
assigns: { charge: self, purchase: purchase, product: product, account: account, payments: payments }
)
end
end
View pusher.js.coffee
1 2 3 4 5 6 7 8 9 10
class window.ZenPusher
@pusher: null
@channel: []
 
constructor: ->
setupPusher: _.once ->
@pusher = new Pusher($('body').data('pusher-key'))
channel: (channel) ->
View spreedly-core-api.txt
1 2 3 4 5 6 7 8 9 10
OPTIONS https://spreedlycore.com/v1/gateways.xml => list supported gateways
POST https://spreedlycore.com/v1/gateways.xml => add a gateway
GET https://spreedlycore.com/v1/gateways.xml => list all added gateways
PUT https://spreedlycore.com/v1/gateways/token.xml => Update gateway
PUT https://spreedlycore.com/v1/gateways/token/redact.xml => Remove sensitive gateway data
POST https://spreedlycore.com/v1/gateways/token/purchase.xml => purchase - supply a payment method token also
POST https://spreedlycore.com/v1/gateways/token/authorize.xml => authorize - supply a payment method token also
 
POST https://spreedlycore.com/v1/payment_methods => Capture credit card from form - transparent redirect magic
GET https://spreedlycore.com/v1/payment_methods.xml => list all retained credit cards
View spreedly-core-api.txt
1 2 3 4 5 6 7 8 9 10
OPTIONS https://spreedlycore.com/v1/gateways.xml => list supported gateways
POST https://spreedlycore.com/v1/gateways.xml => add a gateway
GET https://spreedlycore.com/v1/gateways.xml => list all added gateways
POST https://spreedlycore.com/v1/gateways/token/purchase.xml => purchase - supply a payment method token also
POST https://spreedlycore.com/v1/gateways/token/authorize.xml => authorize - supply a payment method token also
 
POST https://spreedlycore.com/v1/payment_methods => Capture credit card from form - transparent redirect magic
GET https://spreedlycore.com/v1/payment_methods.xml => list all retained credit cards
POST https://spreedlycore.com/v1/payment_methods/token/retain.xml => Store credit card info
POST https://spreedlycore.com/v1/payment_methods/token/redact.xml => Remove credit card info
View cc_fees.rb
1 2 3 4 5 6 7 8 9 10
def estimate_fee(cents, cardtype)
case cardtype.to_s.downcase
when /dankort/
# Dankort:
# http://www.pbs.dk/da/produkter/dankort/Documents/DK_Prisliste_Dankort_eDankort_DK.pdf
# Transaction size Price
# 0 - 50.00 DKK 0.70 DKK
# 50.01 - 100.00 DKK 1.10 DKK
# > 100.01 1.45 DKK + 0.1%
# Using this: 1.45 DKK + 0.10%
View be.sh
1 2 3 4 5 6 7 8 9
#!/bin/zsh
file=`/Users/lars/.rvm/gems/ruby-1.9.3-p0/bin/bundle show $1`
if [ -x "$file" ]
then
mate $file
else
echo "No gem named $1 found" 1>&2
exit -1
fi
View glyphicons.rake
1 2 3 4 5 6 7 8 9 10
task :glyphs => :environment do
glyphs = []
glyphs_hash = {}
longest_name = 0
Dir.glob(Rails.root.join("app", "assets", "images", "glyphicons", "*.png")) do |path|
width, height = `identify -format "%wx%h" #{path}`.strip.split(/x/)
 
# glyphicons_083_random.png
# glyphicons_083_random@2x.png
# glyphicons_halflings_047_bold.png
View Gemfile
1 2 3 4 5 6 7 8 9 10
source 'http://rubygems.org'
 
gem "rails", '3.2.0.rc1'
gem "mysql2"
 
# Assets
 
group :assets do
gem 'sass-rails', git: 'https://github.com/rails/sass-rails.git', branch: '3-2-stable'
gem "coffee-rails"
Something went wrong with that request. Please try again.