Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@peterc
Created May 2, 2020 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterc/9b75f035c9dad2a1fc2050a04f890989 to your computer and use it in GitHub Desktop.
Save peterc/9b75f035c9dad2a1fc2050a04f890989 to your computer and use it in GitHub Desktop.
Given a list of names, pick a winner at the terminal in a visually appealing way
require 'curses'
include Curses
init_screen
curs_set(0)
users = %w{
put twitter handles of people who enter here
}
def write_person(user)
erase
setpos(5, 5)
addstr(user.center(16))
refresh
end
30.times do
write_person(users.sample)
sleep 0.1
end
attron(A_REVERSE)
attron(A_BLINK)
write_person(users.sample)
attroff(A_REVERSE)
attroff(A_BLINK)
getch
close_screen
@peterc
Copy link
Author

peterc commented May 2, 2020

For a Twitter giveaway, say.

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