Skip to content

Instantly share code, notes, and snippets.

View robyurkowski's full-sized avatar

Rob Yurkowski robyurkowski

View GitHub Profile
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'),
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)
@robyurkowski
robyurkowski / PrimeNoV2.rb
Created September 29, 2011 19:17 — forked from anonymous/PrimeNoV2
Prime number checker
#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:
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