Skip to content

Instantly share code, notes, and snippets.

@siyo
Created February 1, 2012 14:42
Show Gist options
  • Save siyo/1717355 to your computer and use it in GitHub Desktop.
Save siyo/1717355 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# auto favorite
Earthquake.init do
output_filter do |item|
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_])(#{twitter.info["screen_name"]})[^a-zA-Z0-9_]/ =~ item["text"] ||
(twitter.info["status"] && twitter.info["status"]["text"] == 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