Skip to content

Instantly share code, notes, and snippets.

@eban
Created August 16, 2012 09:41
Show Gist options
  • Save eban/3368872 to your computer and use it in GitHub Desktop.
Save eban/3368872 to your computer and use it in GitHub Desktop.
gti.rb
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
@unak
Copy link

unak commented Aug 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment