Skip to content

Instantly share code, notes, and snippets.

View toshia's full-sized avatar

Toshiaki Asai toshia

View GitHub Profile
@toshia
toshia / fav_defender.rb
Created May 12, 2014 08:30
DropBox遺跡から出土した謎の古代プラグイン
=begin
絶対に使用してはいけません(後述)。
ファイルのタイムスタンプが 2010/12/31 のふぁぼ爆対策プラグインがでてきたので、記録目的で公開します。
== 仕様
ふぁぼられた相手ごとにふぁぼ数をカウントし、3ふぁぼ以上されると、それ以降ふぁぼられる毎に相手に
いい加減にしろとリプライを送ります。
ふぁぼカウントは、ふぁぼが3分途切れたらリセットされます。
== mikutter 3.0で動かした場合の不具合
@toshia
toshia / mikutter_iconbyebye_alt.rb
Created February 20, 2014 15:56
あっきぃが作ってたやつをちょっと変えてみた
# -*- coding: utf-8 -*-
Plugin.create(:mikutter_iconbyebye) do
ALTERNATIVE_IMAGE = "http://pbs.twimg.com/profile_images/434359790551068673/JTrPZYsz_normal.png".freeze
filter_show_filter do |messages|
replaced = messages.map do |message|
if UserConfig[:iconbyebye_sn].include? message.user[:idname]
message[:user] = Message::MessageUser.new(message.user, profile_image_url: ALTERNATIVE_IMAGE)
end
@toshia
toshia / avoid_25939
Last active August 29, 2015 13:56
あっきぃの最近のツイートが見えない不具合の次善策
# あっきぃの最近のツイートが見えない不具合の次善策です。
# 現象: https://dev.twitter.com/discussions/25939
# 祭会場: http://togetter.com/li/629097
Plugin.create(:avoid_25939) do
profiletab :avoid_25939, "avoid 25939" do
set_icon Skin.get("search.png")
uid = user.id
i_timeline = timeline nil do
order do |message|
@toshia
toshia / mikutter-webkit-gtk2.rb
Created December 2, 2013 16:06
mikutterにWebkit埋めて表示する
# -*- coding: utf-8 -*-
require "webkit-gtk2"
Plugin.create(:kancolle) do
tab(:kancolle, "艦これ") do
view = WebKitGtk2::WebView.new
view.load_uri("http://www.dmm.com/netgame/feature/kancolle.html")
nativewidget view.show_all
end
@toshia
toshia / basicmod_installer.rb
Created April 6, 2013 11:50
MinecraftForgeとか、minecraft.jarを書き換えるタイプのMODをインストールするスクリプト。Macでしか動作確認してない
#! /usr/bin/ruby
# -*- coding: utf-8 -*-
# how to use
# (in minecraft directory)
# $ ./basicmod_installer.rb /path/to/minecraft-forge.zip [/path/to/another/mods ...]
require "fileutils"
MC_ROOT = File.expand_path(File.dirname(__FILE__))
JAR_NAME = "minecraft.jar"
.DS_Store
/screenshots/
/texturepacks-mp-cache/
/lastlogin
*.log
/saves/MOD Test
*(navel *
/crash-reports/
/IDChecker/
/stats/stats_toshi_a_unsent.dat
UserConfig[]の戻り値は、freezeされてるから、この戻り値自体に破壊的な変更はできない。
UserConfig[:test] << :value # => なんかエラー
freezeされているオブジェクトは、mikutterではmeltで変更可能になるが、その時内部的にはシャローコピーされてしまうので、UserConfig自体には変更できない
UserConfig[:test].melt << :value # => [:value]
# result
UserConfig[:test] # => []
Plugin.create :twihai_achievements do
defachievement(:red_fav,
description: "1つのツイートに5ふぁぼ以上された",
hint: "おもしろツイートで5fav以上もらおう"
) do |achievement|
on_favorite do |service, user, message|
if message.user.is_me? and message.favorited_by.size >= 5
achievement.take! end end end
end
@toshia
toshia / spellchecker.rb
Created February 4, 2013 13:34
時事ネタは時間の無駄である
Plugin.create :spellchecker do
filter_gui_timeline_selected_messages do |timeline, messages|
messages.each { |message|
raise RuntimeError if /[Ff]ile:\/\/\// =~ message.to_s
}
[timeline, messages]
end
end
@toshia
toshia / laco.rb
Created January 27, 2013 11:13
らこらこらこ〜するmikutterプラグイン
Plugin.create :laco do
command(:laco,
name: 'らこらこらこ〜',
condition: lambda{ |opt| true },
visible: true,
role: :timeline) do |opt|
Service.primary.update(message: "らこらこらこ〜")
end
end