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
module A | |
class B | |
end | |
class Object < B | |
end | |
end |
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 'socket' | |
=> true | |
>> TCPServer.new "localhost", 5000 | |
=> #<TCPServer:0x100568370> | |
>> TCPServer.new "localhost", 5000 | |
=> #<TCPServer:0x100530970> | |
>> TCPServer.new "localhost", 5000 | |
=> #<TCPServer:0x10050e5c8> | |
>> TCPServer.new "localhost", 5000 | |
Errno::EADDRINUSE: Address already in use - bind(2) |
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
>> s = []; i = 0; loop { s << TCPServer.new("localhost", 5000); p i+=1 } | |
1 | |
2 | |
3 | |
Errno::EADDRINUSE: Address already in use - bind(2) | |
from (irb):3:in `initialize' | |
from (irb):3:in `new' | |
from (irb):3 | |
from (irb):3:in `loop' | |
from (irb):3 |
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
$ cat bug.rb | |
require "socket" | |
s, i = [], 0 | |
loop do | |
s << TCPServer.new("localhost", 5000) | |
p i += 1 | |
sleep 1 | |
end |
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
$ cat bug.rb | |
require "socket" | |
s, i = [], 0 | |
loop do | |
s << TCPServer.new("localhost", 5000) | |
p i += 1 | |
sleep 1 | |
end |
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
$ cat bug.rb | |
require "socket" | |
loop do | |
s = TCPServer.new("localhost", 5000) | |
p s => Socket.unpack_sockaddr_in(s.getsockname) | |
end | |
$ ruby bug.rb | |
{#<TCPServer:0x100154950>=>[5000, "::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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "selenium-webdriver" | |
module Wait | |
extend self | |
def until(timeout = 10) | |
end_time = Time.now + timeout | |
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
$ echo "æåø" > test.txt | |
$ file test.txt | |
test.txt: UTF-8 Unicode text | |
$ echo "æåø" |iconv -t iso-8859-1 >> test.txt | |
$ file test.txt | |
test.txt: ISO-8859 text | |
$ cat test.txt | |
æåø | |
??? | |
$ |
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 | |
d.get "http://google.com" | |
p d.find_element(:css => 'div') | |
d.quit |