Skip to content

Instantly share code, notes, and snippets.


darron froese darron

View GitHub Profile
View gist:101789
diff --git a/app/models/order.rb b/app/models/order.rb
index 00799d0..3ae6013 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -70,11 +70,17 @@ class Order < ActiveRecord::Base
def processing_fee
+ # These are the packages with a processing fee.
+ require_processing_fee = ['Package', 'FamilyPackage', 'LadiesPackage', 'CompletePackage']
View gist:101845
class Order < ActiveRecord::Base
def processing_fee
packages_with_processing_fees = ['Package', 'FamilyPackage', 'LadiesPackage', 'CompletePackage']
fee = 0
# Only apply fee if cart contains an item with processing fees
fee = 3.00 if line_items.any? {|line_item| packages_with_processing_fees.include? line_item.item.class.to_s }
if customer
View gist:224488
test 'create' do
@duck = ducks(:basic)
post :create, :duck => @duck.attributes
assert_response :redirect
# is erroring out:
# 1) Error:
View gist:224563
darron-froeses-macbook-pro:Sites darron$ rails -v
Rails 2.3.4
darron-froeses-macbook-pro:Sites darron$ rails dry-scaffold-test
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
View gist:225438
diff --git a/README.textile b/README.textile
index 6ee8d12..57d3c85 100644
--- a/README.textile
+++ b/README.textile
@@ -38,6 +38,9 @@ h4. Testing
* "*shoulda*": - Testing framework
* "*rspec*": - Testing framework
+* "*mocha*": - Mocking and stubbing library
View gist:271448
class Link < ActiveRecord::Base
has_and_belongs_to_many :bundle
validates_presence_of :url
before_save :grab_title
require 'hpricot'
require 'open-uri'
# TODO: There's no error checking at all.
def grab_title
doc = Hpricot(open("#{url}"))
View gist:272514
-@links.each do |link|
%p== <a href="#{link.url}" title="#{link.url}" target="_blank">#{link.title}</a>
%p Send this link to your friends:
%a{:href => "/" } Dude
/ This works, but I am trying to put @instance_variable in the "/" and the "Dude"
View gist:272525
-@links.each do |link|
%p= link_to( link.title, link.url, :title => link.title, :target => '_blank' )
%p Send this link to your friends:
%a{:href => "/" } Dude
/ This works, but I am trying to put @instance_variable in the "/" and the "Dude"
require 'page'
run Sinatra::Application
View gist:309428
# Thanks:
# Thanks: and @aplus
# Log in and uncomment universe lines in /etc/apt/sources.list
# For Git
apt-key adv --recv-keys --keyserver 4CBEDD5A
echo "deb karmic main" >> /etc/apt/sources.list