Skip to content

Instantly share code, notes, and snippets.

@ddrscott
Created April 15, 2014 05:18
Show Gist options
  • Save ddrscott/10704146 to your computer and use it in GitHub Desktop.
Save ddrscott/10704146 to your computer and use it in GitHub Desktop.
My son wanted to see colorful letters. This is what I came up with. He actually stayed awake as I type it. It was originally a one liner done in IRB.
az=("A".."z").to_a.map {|m|
"\033[38;5;#{rand(180)+16}m#{m}\033[0m" # wrap char in random color
}
loop {
puts [az*" "] * 25 # fill some of the screen
az<<(az.shift) # rotate chars
sleep(0.3) # slow down
puts "\e[26F" # cursor up 26 lines
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment