Skip to content

Instantly share code, notes, and snippets.

View oddlyzen's full-sized avatar
:electron:
Working with Electron

Mark Coates oddlyzen

:electron:
Working with Electron
View GitHub Profile
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
class HoboType::Cents < DelegateClass(Fixnum)
COLUMN_TYPE = :integer
HoboFields.register_type(:cents, self)
def initialize(value)
super(centsify value)
end
Xzibit = Object clone do(
dawg = method(what,
"yo dawg" print.
what print.
"clone" print.
self
).
so_you_can = method(
"so you can print" print.
@oddlyzen
oddlyzen / snippet.rb
Created March 24, 2009 05:00 — forked from anonymous/snippet.rb
Interesting little brain fart.
def speed_bump(&block)
sleep(1)
yield
sleep(1)
end
# 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!