Skip to content

Instantly share code, notes, and snippets.

@no6v
Created March 31, 2011 08:51
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 no6v/896054 to your computer and use it in GitHub Desktop.
Save no6v/896054 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# https://twitter.com/#!/jugyo/status/51959560084275200
Earthquake.init do
t = {
"u" => ":update",
"re" => ":reply",
"rt" => ":retweet",
"l" => ":recent",
"show" => ":status",
}
input_filter do |text|
text.tap do
if m = %r|^(#{Regexp.union(t.keys)})(\s+.*)?$|o.match(text)
warn("⚡⚡⚡ Hmm, you are a well-trained termtter user :-(.".c(:notice))
warn("⚡⚡⚡ Use '#{t[m[1]]}' instead of '#{m[1]}' on earthquake.gem.".c(:notice))
break [t[m[1]], m[2].gsub(/\$\w+/){|var| var2id(var) || var}].join
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment