juno (owner)

Revisions

  • bd89a3 juno Sat Feb 14 00:16:24 -0800 2009
  • 1af0fc juno Sat Feb 14 00:15:44 -0800 2009
gist: 64315 Download_button fork
public
Description:
require: gem install shorturl
Public Clone URL: git://gist.github.com/64315.git
Embed All Files: show embed
tinyurlify.rb #
1
2
3
4
5
6
7
8
9
#!/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)}
end