Skip to content

Instantly share code, notes, and snippets.

@kapowaz
Created May 11, 2019 21:02
Show Gist options
  • Save kapowaz/915ccae696518a49e25700c78185e5e5 to your computer and use it in GitHub Desktop.
Save kapowaz/915ccae696518a49e25700c78185e5e5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# encoding: utf-8
unless ARGV.length == 0
output = ARGV.join(' ').downcase.split('').map do |l|
case l.to_i
when 0..9
":bunting_#{l}:"
end
case l
when ' '
":bunting_line:"
when '#'
":bunting_numbersign:"
when '`'
":bunting_grave:"
when '~'
":bunting_tilde:"
when '|'
":bunting_verticalpipe:"
when '{'
":bunting_opencurlybrace:"
when '}'
":bunting_closecurlybrade:" # ARRRGGHH
when '_'
":bunting_underscore:"
when '^'
":bunting_caret:"
when '\\'
":bunting_backslash:"
when '['
":bunting_opensquarebrackets:"
when ']'
":bunting_closesquarebrackets:"
when '€'
":bunting_euro:"
when '='
":bunting_equals:"
when '>'
":bunting_greaterthan:"
when '<'
":bunting_lessthan:"
when ';'
":bunting_semicolon:"
when ':'
":bunting_colon:"
when '/'
":bunting_forwardslash:"
when '.'
":bunting_period:"
when '-'
":bunting_minus:"
when '+'
":bunting_plus:"
when '*'
":bunting_asterisk:"
when '('
":bunting_openbracket:"
when ')'
":bunting_closebracket:"
when '’'
":bunting_closesinglequote:"
when '‘'
":bunting_opensinglequote:"
when '&'
":bunting_ampersand:"
when '%'
":bunting_percent:"
when "“"
":bunting_openquotes:"
when "”"
":bunting_closequotes:"
when "$"
":bunting_dollar:"
when "£"
":bunting_pound:"
when "?"
":bunting_question:"
when "@"
":bunting_at:"
when "!"
":bunting_exclamation:"
else
":bunting_#{l}:"
end
end.join
`echo #{output} | pbcopy`
else
puts "Usage: bunting [string]"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment