Skip to content

Instantly share code, notes, and snippets.

@masarakki
Created April 23, 2011 20:49
Show Gist options
  • Save masarakki/938969 to your computer and use it in GitHub Desktop.
Save masarakki/938969 to your computer and use it in GitHub Desktop.
TLがみさくら語になるearthquake.gemのプラグイン
# -*- coding: utf-8 -*-
Earthquake.init do
output :tweet do |item|
next unless item["text"]
info = []
if item["in_reply_to_status_id"]
info << "(reply to #{id2var(item["in_reply_to_status_id"])})"
elsif item["retweeted_status"]
info << "(retweet of #{id2var(item["retweeted_status"]["id"])})"
end
if !config[:hide_time] && item["created_at"]
info << Time.parse(item["created_at"]).strftime(config[:time_format])
end
if !config[:hide_app_name] && item["source"]
info << (item["source"].u =~ />(.*)</ ? $1 : 'web')
end
id = id2var(item["id"])
text = item["text"].u
text.gsub!(/\s+/, ' ') unless config[:raw_text]
text = text.coloring(/@[0-9A-Za-z_]+/) { |i| color_of(i) }
text = text.coloring(/(^#[^\s]+)|(\s+#[^\s]+)/) { |i| color_of(i) }
text = text.coloring(URI.regexp(["http", "https"]), :url)
if item["_highlights"]
item["_highlights"].each do |h|
color = config[:color][:highlight].nil? ? color_of(h).to_i + 10 : :highlight
text = text.coloring(/#{h}/i, color)
end
end
mark = item["_mark"] || ""
misakura_text = text.gsub(/です/, 'れしゅ').
gsub(/欲しい/, 'ほひぃの').
gsub(/お願い/,'お願いぃぃぃっっっ゙').
gsub(/おねがい/,'お願いぃぃぃっっっ゙').
gsub(/あ/,'ぁあああ あぉぅ').
gsub(/お/,'お゙ぉおォ あぉぉあォおん').
gsub(/えて/,'えてへぇええぇ゙').
gsub(/な/,'にゃ').
gsub(/して/,'してぇぇぇぇ゙').
gsub(/する/,'するのぉおお').
gsub(/します/,'するのぉおお').
gsub(/精液/,'せーしっせーし でりゅぅ でちゃいましゅ みるく ちんぽみるく ふたなりみるく').
gsub(/出る/,'でちゃうっ れちゃうよぉおお゙').
gsub(/射精/,'でちゃうっ れちゃうよぉおお゙').
gsub(/バカ/,'バカ!バカ!マンコ! ').
gsub(/ばか/,'ばか!ばか!マンコ! ').
gsub(/した/,'したぁのぉおおよぉおお ').
gsub(/いい/,'いぃぃっよぉおお゙').
gsub(/の/,'のぉおお')
status = [
"#{mark}" + "[#{id}]".c(:info),
"#{item["user"]["screen_name"].c(color_of(item["user"]["screen_name"]))}:",
"#{misakura_text}",
(item["user"]["protected"] ? "[P]".c(:notice) : nil),
info.join(' - ').c(:info)
].compact.join(" ")
puts status
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment