Skip to content

Instantly share code, notes, and snippets.

@siyo
Created February 5, 2012 03:24
Show Gist options
  • Save siyo/1742363 to your computer and use it in GitHub Desktop.
Save siyo/1742363 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# auto favorite
Earthquake.init do
output_filter do |item|
keywords = config[:fav_keywords]
next if item.nil? || item["text"].nil? || item["user"]["screen_name"].nil? || item["retweeted_status"]
if item["user"]["screen_name"] == twitter.info["screen_name"]
twitter.info["status"]["text"] = item["text"]
next
end
if /(^|[^a-zA-Z0-9_@])(#{keywords.join("|")})([^a-zA-Z0-9_]|\s*|$)/ =~ item["text"] ||
(twitter.info["status"] && /#{twitter.info["status"]["text"]}/i =~ item["text"])
twitter.favorite item["id"]
end
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment