Skip to content

Instantly share code, notes, and snippets.

@mrcsparker
Created September 28, 2011 01:01
Show Gist options
  • Save mrcsparker/1246729 to your computer and use it in GitHub Desktop.
Save mrcsparker/1246729 to your computer and use it in GitHub Desktop.
Sample hacky Ruby progress bar
def progress(percent)
left = 100 - percent
STDOUT.write "\r\e[0K" # clear cursor to the end of line
STDOUT.write "[#{'#' * percent}#{'.' * left}]\t[ #{percent}/100 ]"
STDOUT.flush
end
1.upto(100) do |i|
progress(i)
sleep(1)
end
@thirdreplicator
Copy link

Awesome! That's what I'm talking about.

@mrcsparker
Copy link
Author

mrcsparker commented Sep 28, 2011 via email

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