Skip to content

Instantly share code, notes, and snippets.

@ellemenno
Created March 11, 2014 16:41
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ellemenno/9489706 to your computer and use it in GitHub Desktop.
Save ellemenno/9489706 to your computer and use it in GitHub Desktop.
ascii spinner
#!/usr/bin/env ruby
# encoding: UTF-8
@dot_cycle = ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']
#braille random: 0x2800 - 0x28ff
@z_arrow = ['←','↖','↑','↗','→','↘','↓','↙']
@z_b = ['b','ᓂ','q','ᓄ']
@z_d = ['d','ᓇ','p','ᓀ']
@z_bar = ['|','/','—','\\']
@z_x = ['x','+']
@z_1 = ['◰','◳','◲','◱']
@z_2 = ['◴','◷','◶','◵']
@z_3 = ['◐','◓','◑','◒']
@y_d = ['d','|','b','|']
@y_q = ['q','|','p','|']
@x_b = ['ᓂ','—','ᓄ','—']
@x_d = ['ᓇ','—','ᓀ','—']
@grow_a = ['|','b','O','b']
@grow_b = ['_','o','O','o']
@grow_c = ['.','o','O','@','*',' ']
@grow_d = ['▁','▃','▄','▅','▆','▇','█','▇','▆','▅','▄','▃']
@grow_e = ['▉','▊','▋','▌','▍','▎','▏','▎','▍','▌','▋','▊','▉']
def spin(seq, sec=0.2)
i = 0
n = seq.length
loop do
print seq[i]
i = (i + 1) % n
sleep sec;
print "\r"
end
end
begin
spin(@grow_c)
rescue Exception => e
print "\nbye!"
end
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment