Created
May 2, 2020 15:42
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a Twitter giveaway, say.