Skip to content

Instantly share code, notes, and snippets.

@0x1eef
Created November 26, 2022 01:02
Show Gist options
  • Save 0x1eef/fb7dd44817118c8718497fe9a8523a6c to your computer and use it in GitHub Desktop.
Save 0x1eef/fb7dd44817118c8718497fe9a8523a6c to your computer and use it in GitHub Desktop.
require 'io/console'
def getch
c = STDIN.getch
if ('a'..'z').include?(c.downcase)
c
else
io = IO.select([STDIN], [], [], 0)
while io != nil
STDIN.getch
io = IO.select([STDIN], [], [], 0)
end
getch
end
end
p getch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment