Skip to content

Instantly share code, notes, and snippets.

@stephancom
Last active December 5, 2021 05:48
Show Gist options
  • Save stephancom/ab70dac4722926462470ecc4c03b34ad to your computer and use it in GitHub Desktop.
Save stephancom/ab70dac4722926462470ecc4c03b34ad to your computer and use it in GitHub Desktop.
a software poem for john langfeld
#! /usr/bin/ruby
pearls = <<~ENDOFPOEM.freeze
Framed, Mounted and Preggers'
22975
6/19/19
Sneaking out of the bedroom in the wee hours he sat,
staring at digits and images and flummox and hope.
Who stared back?
01010100 01101000 01100101 00100000
01000101 01110110 01101001 01101100 00100000
01010001 01110101 01100101 01100101 01101110 00101110
ENDOFPOEM
# how else wouldst thy pearl be cast?
class Swine
def initialize(name)
@name = name
end
def cast(str)
bytes = digest(str)
excrete(bytes)
end
private
def digest(str)
str.scan(/([01]{8})/).flatten.map { |byte| byte.to_i(2).chr }.join
end
def excrete(bytes)
"#{@name} oinks '#{bytes}'\n#{@name} laughs out loud."
end
end
pig = Swine.new('stephan')
puts pig.cast(pearls)
@stephancom
Copy link
Author

╰─➤ ruby delang.rb
stephan oinks 'The Evil Queen.'
stephan laughs out loud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment