Skip to content

Instantly share code, notes, and snippets.

Avatar
🆒
ه҈ͣفͤ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͣ҉ͨ҈ͧ҉ͯ҈ͮ҉ͭ҈ͤ҉ͦ҈ͥ҉ͧ҈ͩ҉ͭ҈ͨ҉ͣ҈ͪ҉ͧ҈ͭ҉ͩ҈ͤ҉ͮ҈ͯ҉ͬ҈

Will Leinweber will

🆒
ه҈ͣفͤ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͣ҉ͨ҈ͧ҉ͯ҈ͮ҉ͭ҈ͤ҉ͦ҈ͥ҉ͧ҈ͩ҉ͭ҈ͨ҉ͣ҈ͪ҉ͧ҈ͭ҉ͩ҈ͤ҉ͮ҈ͯ҉ͬ҈
View GitHub Profile
View faking "or left shift" - code from jay fields.rb
def method_stack
@method_stack ||= []
end
def method_missing(sym, *args)
method_stack << [sym, args]
self
end
View gist:21256
#!/usr/bin/env ruby
# datamapper woes
# Case one: adding an object to an association using << blows up
# Case two: setting an association with a new array doesn't clear
# out the old one, it just combines them
# output:
# line 49: post.tags << t1 # => #<DataMapper::Associations::ImmutableAssociationError: You can not modify this association>
# line 74: book.authors == [ a1 ] # => true
View seatcheck.rb
#!/usr/bin/ruby
require "rubygems"
require "scrapi"
url =
"https://ui2web1.apps.uillinois.edu/BANPROD1/bwckschd.p_disp_detail_sched?term_in=120091&crn_in=43437"
seats = Scraper.define do
array :numbers
process "td.dddefault", :numbers=>:text
View helpers.rb
# will leinweber's lib/helpers.rb for webby
def first_post
all_posts.first
end
def next_post(post)
all_posts[ all_posts.rindex(post) - 1 ]
end
View response.txt
On Feb 20, 2009, at 4:24 PM, "Olusegun A.A" <xxxxxx@gmail.com> wrote:
** CRAIGSLIST ADVISORY --- AVOID SCAMS BY DEALING LOCALLY
** Avoid: wiring money, cross-border deals, work-at-home
** Beware: cashier checks, money orders, escrow, shipping
** More Info: http://www.craigslist.org/about/scams.html
Hello,
Do you still have this item available for sale at the moment? Get back asap.
View ugly couchrest hacks.rb
# so ugly, but it makes rails treat CouchRest::Documents correctly
class Hash
class << self
alias :old_trip_equal :===
def ===(other)
return false if other.class.ancestors.include?(CouchRest::Document)
old_trip_equal other
end
end
View celerity_jquery_test.rb
#!/usr/bin/env jruby
require 'rubygems'
require 'celerity'
url = "http://uiuc.us/jquery.html"
puts "url should be #{url}"
[:firefox, :internet_explorer].each do |browser|
b = Celerity::Browser.new :log_level => :severe, :browser => browser
b.goto url
View metric_fu.rake
require 'metric_fu'
task "metrics:all" do
require 'yaml'
require 'couchrest'
require 'grit'
report = File.open( File.join( RAILS_ROOT, "tmp", "metric_fu", "report.yml") ) { |f| YAML::load f }
repo = Grit::Repo.new(Dir.pwd)
commit = repo.commits.first
View twilight_zone.markdown

Twilight Zone Watchlist

fork this list and add/remove suggestions or move things up to the watch queue please!

queue

  1. The Obsolete Man
  • The Monsters Are Due On Maple Street
  • Eye of the Beholder
  • Time Enough At Last
View gist:143969
module Integrity
class Notifier
class Arduino < Notifier::Base
def self.to_haml
""
end
def deliver!
if build.failed?
Arduino.send "r"