This file contains hidden or 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
# coding: utf-8 | |
require 'socket' | |
describe IO do | |
describe 'memo' do | |
before do | |
@test = nil | |
Thread.new { @test = "test" }.join | |
end |
This file contains hidden or 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
# coding: utf-8 | |
require 'rspec' | |
require 'fiber' | |
describe 'FiberTest' do | |
let(:fiber) do | |
Fiber.new do |name| | |
last_name = Fiber.yield("#{name}") | |
"#{name} #{last_name}" |
This file contains hidden or 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
# coding: utf-8 | |
require 'rspec' | |
require 'fiber' | |
describe 'FiberTest' do | |
let(:fiber) do | |
Fiber.new do |name| | |
last_name = Fiber.yield("#{name}") | |
puts "#{name} #{last_name}" |
This file contains hidden or 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 MyException extends Exception { | |
public String errMsg; | |
MyException(String msg) { errMsg = msg; } | |
} |
This file contains hidden or 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 User < AR::Base | |
has_many :birthday_events, ->(user) { where starts_on: user.birthday }, class_name: 'Event' | |
end |
This file contains hidden or 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
->(name) { puts "Pochi " + name }.call("garu") |
This file contains hidden or 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
# coding: utf-8 | |
require "net/http" | |
require "uri" | |
def ping_pong(num) | |
loop do | |
puts "#{num.to_s}" | |
uri = URI.parse 'http://localhost:8080/waiting' | |
res = Net::HTTP.start(uri.host, uri.port).get(uri.path) |
This file contains hidden or 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 'eventmachine' | |
require 'evma_httpserver' | |
port = 8080 | |
port = ARGV.shift.to_i if ARGV.size > 0 | |
@@comet_timeout = 60 | |
@@comet_timeout = ARGV.shift.to_i if ARGV.size > 0 |
This file contains hidden or 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
# coding: utf-8 | |
require "eventmachine" | |
require "em-http" | |
clients = 120 | |
HOST = "localhost" | |
PORT = 4567 | |
class Client < EM::Connection |
This file contains hidden or 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 "eventmachine" | |
require "net/http" | |
clients = 100 | |
HOST = "localhost" | |
PORT = 4567 | |
class Client < EM::Connection | |
attr_accessor :client_id |