Created
March 11, 2014 16:41
-
-
Save ellemenno/9489706 to your computer and use it in GitHub Desktop.
ascii spinner
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
#!/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