วันศุกร์, พฤษภาคม 30, 2551

someone notices that binary of Google I/O t-shirts spell GOOGLEKO which should be GOOGLEIO.

Let test with my Ruby.

#googleio.rb
#!/usr/bin/env ruby
module TextToBinary
def TextToBinary.encode(text)
text.scan(/./m) do |char|
(@bin ||= []) << char.unpack('B8').first.scan(/./m).map { |bit| bit = bit.eql?('1') ? '0' : 'o' }
end
return @bin
end
end

name = 'GOOGLEIO'
on_tshirt = 'GOOGLEKO'

outputs = TextToBinary.encode(name)
puts "-----#{name}-----"
outputs.each { |out| p out }

puts "BUT!"

puts "-----#{on_tshirt}----"
result = TextToBinary.encode(on_tshirt)
result.each { |res| p res }

Funny.