This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns noc.core | |
(:use quil.core)) | |
(defn setup [] | |
(background 255) | |
(no-loop)) | |
(defn draw [] | |
(pixels) | |
(doseq [x (range 0 (width)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pending_total | |
return 0.00 if not_needed? | |
# everyone gets the member pricing | |
daily_rate = ACCOMMODATION_RATES[room_type][:member] | |
departure_date = departure.to_date | |
arrival_date = arrival.to_date | |
total_days = departure_date - arrival_date | |
before_discounted_days = [[start_date - arrival_date, 3].min, 0].max | |
after_discounted_days = [[departure_date - end_date, 3].min, 0].max | |
discounted_days = before_discounted_days + after_discounted_days |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post | |
include Mongoid::Document | |
field :title, :type => String | |
has_many :comments | |
end | |
class Comment | |
include Mongoid::Document | |
field :body, :type => String | |
belongs_to :post, :inverse_of => :comments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# fork of Kyle Banker's Rails MongoMapper Template (http://gist.github.com/219223) | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" | |
run "rm public/javascripts/dragdrop.js" | |
run "rm public/javascripts/effects.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Appointment < ActiveRecord::Base | |
attr_reader :availability | |
def full? | |
availability < 1 | |
end | |
end | |
# And then in your view | |