Skip to content

Instantly share code, notes, and snippets.

@jbampton
Created June 15, 2018 22:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbampton/32afcd5d5858ec939770b9e1ce723b4f to your computer and use it in GitHub Desktop.
Save jbampton/32afcd5d5858ec939770b9e1ce723b4f to your computer and use it in GitHub Desktop.
Terminal painting with Ruby and the Paint gem
# https://www.youtube.com/watch?v=vVv81bYkbMc
require 'paint'
paint = 'Paint'.chars.map{|c| Paint[c, Paint.random]}.join
summary = ["Brought to you by #{Paint['Ruby', :red]}: A programmer's best friend",
"and #{paint}: Ruby gem for ANSI terminal colors",
'https://www.ruby-lang.org',
'https://github.com/janlelis/paint']
3.times do |_|
"I love Ruby...Ruby Ruby Ruby !!!\n".chars do |c|
sleep(0.22)
print Paint[c, Paint.random]
end
end
summary.map do |line|
line.chars do |c|
sleep(0.15)
print c
end
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment