Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created August 21, 2011 20:56
Show Gist options
  • Save typeoneerror/1161152 to your computer and use it in GitHub Desktop.
Save typeoneerror/1161152 to your computer and use it in GitHub Desktop.
TextMate command for generating URL slug from selected text fragment
#!/usr/bin/env ruby
s = STDIN.read
s.downcase!
s.gsub!(/[^A-Za-z0-9_\- ]/, '')
s.gsub!(/ /, '-')
print s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment