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
| require 'open-uri' | |
| # url dsl -- the ultimate url dsl! | |
| # | |
| # You just can't beat this: | |
| # | |
| # $ irb -r url_dsl | |
| # >> include URLDSL | |
| # => Object | |
| # >> http://github.com/defunkt.json |
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 HoboType::Cents < DelegateClass(Fixnum) | |
| COLUMN_TYPE = :integer | |
| HoboFields.register_type(:cents, self) | |
| def initialize(value) | |
| super(centsify value) | |
| end |
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
| Xzibit = Object clone do( | |
| dawg = method(what, | |
| "yo dawg" print. | |
| what print. | |
| "clone" print. | |
| self | |
| ). | |
| so_you_can = method( | |
| "so you can print" print. |
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
| def speed_bump(&block) | |
| sleep(1) | |
| yield | |
| sleep(1) | |
| end |
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
| # Cron jobs start here -------------------------------------------------------------- | |
| def self.check_trial | |
| accounts = BillingAccount.find(:all, :include => :user, :conditions => ["kind = 'trial' and status = 'active'"]) | |
| accounts.each do |a| | |
| if a.expires_at.to_s == Time.today.strftime("%Y-%m-%d") | |
| pay_me = execute_payment(:customer_profile_id => a.customer_profile_id, :customer_payment_profile_id => a.customer_payment_profile_id, :user_id => a.user_id) | |
| if pay_me.success? | |
| a.kind = "full" | |
| a.expires_at = 1.year.from_now | |
| a.save! |
NewerOlder