Created
August 16, 2012 09:41
-
-
Save eban/3368872 to your computer and use it in GitHub Desktop.
gti.rb
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
def move_to_top | |
print "\e[7A" | |
end | |
def line_at start_x, s | |
print " " * start_x if start_x > 0 | |
puts s[[-start_x, 0].max, TERM_WIDTH - start_x] | |
end | |
def draw_car x | |
move_to_top | |
line_at x, " ,---------------." | |
line_at x, " / /``````|``````\\\\" | |
line_at x, " / /_______|_______\\\\________" | |
line_at x, "|] GTI |' | |]" | |
if x % 2 == 1 | |
line_at x, "= .-:-. |________| .-:-. =" | |
line_at x, " ` -+- -------------- -+- '" | |
line_at x, " '-:-' '-:-' " | |
else | |
line_at x, "= .:-:. |________| .:-:. =" | |
line_at x, " ` X -------------- X '" | |
line_at x, " ':-:' ':-:' " | |
end | |
end | |
def clear_car x | |
move_to_top | |
7.times do | |
line_at x, " " | |
end | |
end | |
TERM_WIDTH = (ENV["COLUMNS"] || 80).to_i - 1 | |
puts "\n" * 7 | |
-20.step(TERM_WIDTH - 1) do |i| | |
draw_car i | |
sleep 0.02 | |
clear_car i | |
end | |
exec "git", *ARGV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
speed up: https://gist.github.com/3374932/e92f7d187ba242d982c60c74b9b5721110842d0d