Skip to content

Instantly share code, notes, and snippets.

View brianroth's full-sized avatar

Brian Roth brianroth

  • Inver Grove Heights, Minnesota
View GitHub Profile
@brianroth
brianroth / gist:7901930
Created December 10, 2013 22:57
Initializer to patch Arel to properly break apart IN clauses with more than 1000 values
module Arel
module Visitors
class Oracle < Arel::Visitors::ToSql
private
def visit_Array o
if o.empty?
'NULL'
else
listtype = o[0].to_s =~ /\D/ ? 'odcivarchar2list': 'odcinumberlist'
quoted_chunks = o.in_groups_of(999, false).map do |chunk|
@brianroth
brianroth / gist:1755095
Created February 6, 2012 21:44
Fruit Basket
#!/usr/bin/ruby
module Round
end
class Fruit
end
module NotRound
end
#!/usr/bin/ruby
require 'socket'
hostname = ARGV[0]
port = ARGV[1]
filename = ARGV[2]
begin
socket = TCPSocket.new( hostname, port )
socket.send( "zINSTREAM\0", 0)
#!/usr/bin/ruby
require 'socket'
hostname = ARGV[0]
control_port = ARGV[1]
filename = ARGV[2]
begin
control_socket = TCPSocket.new( hostname, control_port )
control_socket.send( "STREAM\n", 0)