Last active
August 29, 2015 14:26
-
-
Save blakek/9777f551d826b06178c3 to your computer and use it in GitHub Desktop.
This file contains 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 | |
def pbcopy(input) | |
str = input.to_s | |
IO.popen('pbcopy', 'w') { |f| f << str } | |
str | |
end | |
output='' | |
ARGV.each_with_index { |arg, index| | |
unless index == 0 | |
output.concat('-') | |
end | |
output.concat(arg.downcase.gsub(/[^[:alnum:]]/,'')) | |
} | |
pbcopy output | |
print output | |
print "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changes a heading (e.g. My New Gist) to something that can be an element id or class (e.g. my-new-gist). Works great when piping to pbcopy.