Skip to content

Instantly share code, notes, and snippets.

def paypal_ipn
notify = Paypal::Notification.new(request.raw_post)
donations = Donation.find_all_from_paypal(notify.params)
user = donations.first.user
purchase = Purchase.new(:donations => donations, :user => user)
purchase.paypal_transaction_id = notify.transaction_id
if notify.acknowledge
if notify.complete? and purchase.total_amount == BigDecimal.new(notify.amount.to_s)
>> require 'vlad'
=> true
>> Vlad.load({ :app => :mongrel,
?> :config => 'config/deploy.rb',
?> :core => :core,
?> :scm => :git,
?> :web => :nginx })
MissingSourceFile: no such file to load -- vlad/mongrel
from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
# price
# quantity
class LineItem < ActiveRecord::Base
belongs_to :product
belongs_to :order
def calculate_cost
price * quantity * discount_multiplier
end
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
require 'pp'
# add color with wirble. See http://pablotron.org/software/wirble/
begin
require 'wirble'
Wirble.init
Wirble.colorize
rescue LoadError => err
warn "Couldn't load Wirble: #{err}"
end