Skip to content

Instantly share code, notes, and snippets.

@ryangreenberg
Last active September 3, 2020 20:07
Show Gist options
  • Save ryangreenberg/c319610a4abc5c5d0a68e387ace25d6a to your computer and use it in GitHub Desktop.
Save ryangreenberg/c319610a4abc5c5d0a68e387ace25d6a to your computer and use it in GitHub Desktop.
Slack Launch Topic
#!/usr/bin/env ruby
# set the channel topic: ▓░░░░░░░░░░░░░░░░░░░ 1%
# set the channel topic: ▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░ 50%
# set the channel topic: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100%
blocks = 20
percent = ARGV[0]
abort "#{$PROGRAM_NAME} <0-100>" unless percent
filled = [(percent.to_f / 100.0 * blocks).ceil, blocks].min
empty = [blocks - filled, 0].max
puts "#{'▓' * filled}#{'░' * empty} *#{percent}%*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment