Skip to content

Instantly share code, notes, and snippets.

# application/moneyhats/test/test_helper.rb
include ActiveMerchant::Billing
# application/moneyhats/test/test_helper.rb
def credit_card_hash(options = {})
{ :number => '1',
:first_name => 'Cody',
:last_name => 'Fauser',
:month => '8',
:year => "#{ Time.now.year + 1 }",
# application/moneyhats/config/environments/development.rb
# We want to use the BraintreeGateway in test mode so
# that we can simulate real transactions during development. The code
# needs to be placed in the to_prepare block so that it is executed on
# each reload of the OrderTransaction model in development mode. If
# the code had been placed in the after_initialize block then Order-
# Transaction.gateway would be properly set on the first request to the
# application, but would be nil on all subsequent requests.
config.after_initialize do
class OrderTransaction < ActiveRecord::Base
belongs_to :order
serialize :params
cattr_accessor :gateway
class << self
def authorize(amount, credit_card, options = {})
process('authorization', amount) do |gw|
gw.authorize(amount, credit_card, options)
end
end
#--------------------------------------------------
# ActiveMerchant Options
#
# :order_id - The order number.
# :ip - The IP address of the customer making the purchase.
# :customer - The name, customer number, or other information that identifies the customer.
# :invoice - The invoice number.
# :merchant - The name or description of the merchant offering the product.
# :description - A description of the transaction.
# :email - The email address of the customer.
MiniSite.copy_site_path_dir
- creates destination directory automatically
- copies 'mini_site/xx_XX/zzz' directory to 'mini_site/yy_YY/zzz'
- allows to copy more than twice
- removes old directory before copying (FAILED - 2)
MiniSite.copy_dir
/home/jan/workspaces/asics/public/system/mini_sites/y1_B1
tar: This does not look like a tar archive
tar: Skipping to next header
@janx
janx / gist:64004
Created February 13, 2009 17:03 — forked from dhh/gist:45076
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName example.com
# ServerAlias *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain