This file contains hidden or 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
Meloria.Customer = DS.Model.extend({ | |
name: DS.attr('string'), | |
phone: DS.attr('string'), | |
email: DS.attr('string'), | |
dateOnWaitingList: DS.attr('date'), | |
status: DS.attr('number'), | |
local: DS.attr('boolean'), |
This file contains hidden or 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 OfflineMessages < IRCClient | |
def initialize | |
add_hook(:join) { |m| send_message( m[:user] ) } | |
add_hook(:command) { |m| route m[:target], m[:user], m[:command] } | |
end | |
def route(target, user, command) | |
if /\Atell/i.match user command | |
save_message(user, command) |
This file contains hidden or 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
#retrive a number between 1 and another value - varUpper | |
# R: In Ruby, we strive for legibility. varUpper is an okay variable name, but an even better one would be upper_limit (var is implied by the fact it's a var, and Upper isn't clear as to what it refers). | |
upper_limit = 100 | |
# R: This is one way to do a string, with single quotes. There are also a couple of alternatives, but the primary one is this: | |
# Double quotes let you put variables in a string in between #{} -- this will also automatically call .to_s. | |
puts "Welcome to Keith's Prime Number Checker. Please enter an integer between one and #{upper_limit}" | |
# R: We'll name this something more verbose, too: |
This file contains hidden or 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
desc "Fetch product prices" | |
task :updatepayouts => :environment do | |
require 'mechanize' | |
agent = WWW::Mechanize.new | |
Offer.find_all_by_payout(nil).each do |offer| | |
escaped_offer_name = CGI.escape("\"#{offer.name}\"") | |
agent.get("http://odigger.com/?&q=#{escaped_offer_name}&network_id=") | |
agent.page.search(".payout").each do |offer2| | |
offer.update_attribute(:payout, offer2.text.strip) | |
end |