Skip to content

Instantly share code, notes, and snippets.

View mattyoho's full-sized avatar

Matt Yoho mattyoho

  • Portland, OR, USA
View GitHub Profile
# mechanize just enough of campfire to get what i need
require 'mechanize'
class Campfireanize
def initialize(subdomain)
@subdomain = subdomain
@client = Mechanize.new
@logged_in = false
end
#!/usr/bin/ruby
require 'rubygems'
require 'rbench'
require 'find'
def glob(dir)
hash = {}
Dir.glob("#{dir}/**/*.rb") do |f|
hash[f] = File.mtime(f) rescue next
def collatz_number(n, ncalls=1)
return ncalls if n <= 1
n.even? ? collatz_number(n / 2, ncalls + 1) : collatz_number(3 * n + 1, ncalls + 1)
end
Given /^I will confirm on next step$/ do
begin
evaluate_script("window.alert = function(msg) { return true; }")
evaluate_script("window.confirm = function(msg) { return true; }")
rescue Capybara::NotSupportedByDriverError
end
end
def javascript_confirm(answer)
page.evaluate_script 'window._confirm = window.confirm'
page.evaluate_script "window.confirm = function(x) { return #{answer} }"
yield
page.evaluate_script 'window._confirm && (window.confirm = window._confirm)'
page.evaluate_script 'window._confirm = null'
end
def all_specs
"spec/models/ spec/lib/ spec/integration/"
end
trap 'INT' do
if $interrupted
exit! 0
else
puts "Interrupt a second time to quit"
$interrupted = true
com.gargoylesoftware.htmlunit.ScriptException: Syntax error, unrecognized expression: ([data-remote]) (http://test-site.triato-test.localhost:9887/javascripts/jquery.js?1276616210#2904) (NativeException)
(drbunix:///tmp/akephalos.26549.sock) -e:1
./features/support/subdomains.rb:12:in `visit_in_subdomain'
./features/step_definitions/owner_sign_in_steps.rb:7:in `/^I sign into my site$/'
features/owner_administers_site_appearance.feature:8:in `And I sign into my site'

My reply to @marcpeabody's tweet here:

"@marcpeabody: For @mattyoho and you other Inception fanboys - why the movie sucked: http://gist.github.com/501827 #spoileraler" http://twitter.com/marcpeabody/status/19972669611

His claims and my replies:

  1. Getting trapped in a dream means going to limbo. You're stuck in limbo forever… or up until you kill yourself - in which case you'll simply wake up in real life. So why was everyone so afraid of going to limbo?

Going into limbo, due to the time dilation of the dreamworld, meant, to the perceiver, a near-infinite span of time spent in the deep dream world. Meaning you would not only grow old a thousand times over, but the repetition, ennui, and unfathomable duration of the experience would likely drive the person insane; imagine going to sleep feeling 30 and waking up feeling impossibly ancient, your mind having crumbled to dust. Of course you cannot imagine it, which is why it would obliterate the mind.

@mattyoho
mattyoho / gist:583108
Created September 16, 2010 20:30 — forked from headius/gist:579505
~/projects/jruby ➔ jruby -rreal_unix -e 'trap("INT") { puts :there; exit }; puts :here; select(nil, nil, nil, nil)'
here
^Cthere
~/projects/jruby ➔ jruby -rreal_unix -e 'puts $$; exec "echo $$"'
461
461
~/projects/jruby ➔ cat real_unix.rb
require 'ffi'
def all_specs
"spec/models/ spec/lib/ spec/integration/"
end
trap 'INT' do
if $interrupted
exit! 0
else
puts "Interrupt a second time to quit"
$interrupted = true