Skip to content

Instantly share code, notes, and snippets.

@homelinen
Forked from StarWhite/readitlater.rb
Last active December 12, 2015 07:08
Show Gist options
  • Save homelinen/4733889 to your computer and use it in GitHub Desktop.
Save homelinen/4733889 to your computer and use it in GitHub Desktop.
Earthquake plugin to post urls to Pocket.
# earthquake.gem plugin
# post url to Pocket
require 'open-uri'
Earthquake.init do
_ = config[:ril] ||= {}
_[:apikey] ||= 'your-consumer-key'
# Sign Up for the Pocket API
# https://getpocket.com/developer/apps/new
command :ril do |m|
tweet =twitter.status(m[1])["text"]
tweet.scan(/http[s]?\:\/\/[\w+\$\;\?\.\%\,\!\#\~\*\/\:\@\&\\\=\_\-]+/) do |u|
if confirm "add to Pocket '#{u}?'"
async do
open ("https://pocket.com/v3/add?apikey=#{_[:apikey]}&url=#{u}")
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment