Skip to content

Instantly share code, notes, and snippets.

@kaosf
Created June 16, 2014 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaosf/701e8c2f37b21e5eb7c8 to your computer and use it in GitHub Desktop.
Save kaosf/701e8c2f37b21e5eb7c8 to your computer and use it in GitHub Desktop.
Earthquake.init do
command :openfirefox do |m|
matches = twitter.status(m[1])['retweeted_status'].nil? ?
URI.extract(twitter.status(m[1])["text"],["http", "https"]) :
URI.extract(twitter.status(m[1])['retweeted_status']["text"],["http", "https"])
unless matches.empty?
matches.each do |match_url|
`firefox #{match_url}`
end
else
puts "no link found".c(41)
end
end
command :browsefirefox do |m|
url = case m[1]
when /^\d+$/
"https://twitter.com/#{twitter.status(m[1])['user']['screen_name']}/status/#{m[1]}"
else
"https://twitter.com/#{m[1][/[^'"]+/]}"
end
`firefox #{url}`
end
end
Earthquake.alias_command ':of', ':openfirefox'
Earthquake.alias_command ':brf', ':browsefirefox'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment