Skip to content

Instantly share code, notes, and snippets.

@ajjahn
ajjahn / rps.rb
Last active December 22, 2015 04:39
Ruby Golf - Paper, Rock, Scissors81 bytes between method definition.
def play(n)
s=%w[Paper Rock Scissors].rotate rand 3
s[1]+%w[,Draw ,Lose ,Win][s.index(n)<=>1]
end
#!/usr/bin/env ruby
puts Process.pid
SIGNAL_QUEUE = []
reader, writer = IO.pipe
[:INT, :QUIT, :KILL, :USR1].each do |signal|
Signal.trap(signal) do
writer.write_nonblock('.')
SIGNAL_QUEUE << signal
end

Keybase proof

I hereby claim:

  • I am ajjahn on github.
  • I am ajjahn (https://keybase.io/ajjahn) on keybase.
  • I have a public key ASAXu4nEtPwoxBj_Xd9A3paM_SoYLLbWuS9YeNKZ99-skwo

To claim this, I am signing this object: