Skip to content

Instantly share code, notes, and snippets.

@mbulat
Created March 29, 2011 15:21
Show Gist options
  • Save mbulat/892544 to your computer and use it in GitHub Desktop.
Save mbulat/892544 to your computer and use it in GitHub Desktop.
Earthquake plugin to open a link in a tweet
# Pass in a tweet id to open a link in the text
#
# :open $xx
Earthquake.init do
command %r|^:open\s+([^\/\s]+)$|, :as => :open do |m|
twitter.status(m[1]).tap do |s|
if s["text"]
link_match = s["text"].match(/(https?:\/\/\S*)/)
if link_match
Launchy.open(link_match[0])
else
puts "no link found"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment