Skip to content

Instantly share code, notes, and snippets.

@siyo
siyo / zalgo_tweet.rb
Created October 11, 2011 20:43
tweetをマトリックス(映画)っぽくしたくなったとき用 earthquake plugin
# zalgo tweet / earthquake plugin
#
# e.g. :zalgo Hello,World!
#
Earthquake.init do
command :zalgo do |m|
s = open(URI.encode("http://zalgo-text.jgate.de/convert?q=#{m[1]}")){|f| f.read}
input(":update #{s}")
end
end
@siyo
siyo / beer.rb
Created October 13, 2011 13:57
ビール飲んでる時用earthquake.gem plugin
# -*- coding: utf-8 -*-
# beer tweet / earthquake plugin
#
# e.g. :beer うまい #=> ビうまいール
#
Earthquake.init do
command :beer do |m|
input(":update ビ#{m[1]}ール")
end
end
@siyo
siyo / byun.rb
Created October 13, 2011 16:24
=͟͟͞͞ビ=͟͟͞͞ュ=͟͟͞͞ー=͟͟͞͞ンってやりたいとき用earthquake.gem plugin
# -*- coding: utf-8 -*-
# byun tweet / earthquake plugin
#
# e.g. :byun hoge # => update '=͟͟͞͞h=͟͟͞͞o=͟͟͞͞g=͟͟͞͞e' [Yn]
#
Earthquake.init do
command %r|^:byun\s*(\d+)*\s+(.+)$|, :as => :byun do |m|
cmd = m[1] ? ":reply #{m[1]}" : ":update"
input("%s %s" % [cmd, m[2].each_char.inject(""){|s,c| s << "=͟͟͞͞#{c}"}])
@siyo
siyo / expand_url.rb
Created October 15, 2011 23:42
無理矢理短縮URL展開 earthquake.gem plugin
# -*- coding: utf-8 -*-
#
Earthquake.init do
once do
SHORT_URL_REGEXP = %r|https?://\w+\.\w+/\w+[^\W]|
end
output_filter do |item|
next if item.nil? || item["text"].nil? || (urls = item["text"].scan(SHORT_URL_REGEXP)).empty?
@siyo
siyo / rt_rt_filter.rb
Created October 16, 2011 00:28
多段非公式RTフィルタ earthquake.gem plugin
# -*- coding: utf-8 -*-
Earthquake.init do
output_filter do |item|
next if item.nil? || item["text"].nil?
!(/^.+[¥"QR]T(?:[:\s]*@[A-Za-z0-9_]|\(via[:\s]*@[A-Za-z0-9_]).+[¥"QR]T/ =~ item["text"])
end
end
@siyo
siyo / echo.rb
Created October 18, 2011 10:53
パクリツイートを見つけてさらにパクる時用earthquake.gem plugin
# -*- coding: utf-8 -*-
#
# e.g.
# [$ab] foo: yo!
# .
# .
# [$nz] who: yo!
#
# ⚡ :echo
# update 'yo!' [Yn]
@siyo
siyo / echo_notify.rb
Last active September 27, 2015 16:08
パクリツイートを通知するearthquake.gem plugin
# -*- coding: utf-8 -*-
#
Earthquake.init do
output_filter do |item|
("aa".."zz").to_a.each{|v|
break unless id = var2id("$#{v}");
next unless st = cache.read("status:#{id}");
if st["text"] \
@siyo
siyo / growl-all.rb
Created October 19, 2011 05:52 — forked from uu59/growl-all.rb
# -- coding: utf-8
require "fileutils"
require "digest/md5"
Earthquake.init do
dir = File.join(File.dirname(__FILE__), "userimage")
output do |item|
next if item.nil? || item["user"].nil?
begin
@siyo
siyo / at_fav_rt.rb
Created October 19, 2011 04:50
指定ユーザーの最近のtweetに対して(reply|favorite|retweet|delete|thread|replace) したいとき用earthquake.gem plugin
# -*- coding: utf-8 -*-
# (reply|favorite|retweet|delete|thread|repalce) to recent tweet of specified user in cache.
# you can specifiy '-n' index.
#
module Earthquake::Input
def recent_status_id(name,index = -1)
a = ("aa".."zz").to_a.inject([]){|s,v|
break s unless id = var2id("$#{v}");
next s unless st = cache.read("status:#{id}");
@siyo
siyo / format_raw_text.rb
Created October 20, 2011 17:24
複数行のtweetも綺麗に出力したいとき用earthquake.gem plugin (Earthquake.config[:raw_text] = true 時)
# -*- coding: utf-8 -*-
#
# ~/.earthquake/config
#
# Earthquake.config[:raw_text] = true
#
Earthquake.init do
output_filter do |item|