Skip to content

Instantly share code, notes, and snippets.

@siyo
Forked from hagiyaki/gyaku.rb
Created January 22, 2012 06:32
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 siyo/1655929 to your computer and use it in GitHub Desktop.
Save siyo/1655929 to your computer and use it in GitHub Desktop.
ひっくり返してtweetするしパクってひっくり返すやつ/ earthquake.gem plugin
# -*- coding: utf-8 -*-
# reverse tweet
#
# e.g. :reverse hoge #=> egoh
# or
# :reverse $aa #=> reverse RT
#
Earthquake.init do
command %r|^:reverse\s(.+)$|, :as => :reverse do |m|
txt = if /^\d+$/ =~ m[1]
(st = cache.read("status:#{m[1].to_i}")) ? st["text"] : nil
else
m[1]
end
if txt
input txt.split(//).reverse.join
else
puts "Not found tweet."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment