Skip to content

Instantly share code, notes, and snippets.

@juno juno/tinyurlify.rb

Created Feb 14, 2009
What would you like to do?
URL shorten script. require: gem install shorturl
#!/usr/bin/env ruby
# -*- coding:utf-8; mode:ruby-mode -*-
require 'rubygems'
require 'shorturl'
ARGF.each do |line|
puts line.gsub(%r|(s?https?://[-_.!~*'a-zA-Z0-9;/?:@&=+$,%#]+)|) {|s| ShortURL.shorten($1)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.