This file contains 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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "libnotify" | |
require "daemons" | |
class IrssiNotifier | |
def initialize(host, tail_script, opts = {}) | |
@host = host | |
@script = tail_script |
This file contains 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
** Execute kernel/signature.rb | |
rake aborted! | |
no such file to load -- ext/digest/sha1/sha1 | |
/home/jari/src/rubinius/lib/digest/sha1.rb:6:in `require' | |
/home/jari/src/rubinius/lib/digest/sha1.rb:6:in `<top (required)>' | |
/home/jari/src/rubinius/rakelib/kernel.rake:105:in `require' | |
/home/jari/src/rubinius/rakelib/kernel.rake:105:in `block in <top (required)>' | |
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:634:in `call' | |
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:634:in `block in execute' | |
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each' |
This file contains 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 foo(*args) | |
args | |
end | |
require "benchmark" | |
TESTS = 1_000_000 | |
Benchmark.bmbm do |results| | |
results.report("hash:") { TESTS.times { foo(:foo => 'bar') } } |
This file contains 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 "rubygems" | |
require "selenium-webdriver" | |
d = Selenium::WebDriver.for :firefox | |
p d.bridge.capabilities | |
d.get "http://jquery.org" | |
p d.execute_script('return $("div")[0];') |
This file contains 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
$ java -jar jruby-complete-1.5.0.RC2.jar -S rake -T | |
file:/Z:/git/selenium2/third_party/jruby/jruby-complete-1.5.0.RC2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rake (>= 0) (Gem::LoadError) | |
from file:/Z:/git/selenium2/third_party/jruby/jruby-complete-1.5.0.RC2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:211:in `activate' | |
from file:/Z:/git/selenium2/third_party/jruby/jruby-complete-1.5.0.RC2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:1056:in `gem' | |
from file:/Z:/git/selenium2/third_party/jruby/jruby-complete-1.5.0.RC2.jar!/META-INF/jruby.home/bin/rake:18 | |
from file:/Z:/git/selenium2/third_party/jruby/jruby-complete-1.5.0.RC2.jar!/META-INF/jruby.home/bin/rake:12:in `load' | |
from file:/Z:/git/selenium2/third_party/jruby/jruby-complete-1.5.0.RC2.jar!/jruby/commands.rb:12:in `rake' | |
from rake:1 |
This file contains 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 Object | |
def should(matcher) | |
if matcher.matches? self | |
# ok | |
else | |
raise matcher.positive_failure_message | |
end | |
end | |
def should_not(matcher) |
This file contains 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 "rubygems" | |
require "selenium-webdriver" | |
def wait(timeout = 10, &blk) | |
end_time = Time.now + timeout | |
until Time.now >= end_time | |
begin | |
return yield | |
rescue Selenium::WebDriver::Error::NoSuchElementError |
This file contains 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
>> ObjectSpace.each_object.include? 1 | |
=> true | |
>> ObjectSpace.each_object.include? 1 | |
=> false | |
>> ObjectSpace.each_object.include? 1 | |
=> true | |
>> ObjectSpace.each_object.include? 1 | |
=> false | |
>> ObjectSpace.each_object.include? 1 | |
=> true |
This file contains 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 bitsize | |
@bitsize ||= ( | |
if defined?(FFI::BITSIZE) | |
FFI::BITSIZE | |
elsif defined?(FFI) | |
FFI.type_size :pointer | |
elsif jruby? | |
Integer(ENV_JAVA['sun.arch.data.model']) | |
else | |
1.size == 4 ? 32 : 64 |
This file contains 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 "java" | |
require "fileutils" | |
FileUtils.mkdir_p("com/test") | |
java = <<JAVA | |
package com.test; | |
class MyClass { |