Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'mysqlplus'
m = Mysql.real_connect('localhost','root')
m.send_query("SELECT 1")
p m.stat # should raise error?
m.get_result() # hangs
require 'rubygems'
require 'eventmachine'
require 'em-http'
require 'dataflow'
Thread.new {
EM.run{}
}
module EventMachine
require 'rubygems'
require 'eventmachine'
require 'dataflow'
# Experimenting with dataflow + EM
def do_pop_stuff
pop_client = EventMachine::POP::POP3Client.new('pop.gmail.com', 995, true, 'username', 'password')
print "stat: #{pop_client.stat}\n"
pop_client.mails.each do |m|
print m.raw + "\n"
require 'rubygems'
require 'spec'
include Spec::Matchers
a = (1..10).to_a
b = (5..15).to_a
matcher = MatchArray.new(a)
matcher.matches?(b) # => false