Created
June 15, 2018 22:59
-
-
Save jbampton/32afcd5d5858ec939770b9e1ce723b4f to your computer and use it in GitHub Desktop.
Terminal painting with Ruby and the Paint gem
This file contains hidden or 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
# 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