This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# スーパークラスを維持しつつ、委譲を行う。 | |
def get_delegated_instance(base_instance) | |
Class.new(base_instance.class) { |klass| | |
@base_instance = nil | |
# 取りあえずインスタンスメソッドを全部移譲先に転送する。 | |
self.instance_methods.each { |method| | |
define_method(method) { |*args| | |
@base_instance.send(method, *args) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: UTF-8 | |
require "net/http" | |
require "json" | |
chaban = File.join(CHIConfig::PLUGIN_PATH, "change_account", "interactive.rb") | |
if File.exist?(chaban) | |
require chaban |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:kurosuke) { | |
class Gdk::MiraclePainter | |
def iob_etc_clicked | |
Delayer.new { | |
Plugin[:kurosuke].timeline(:home_timeline) << Message.new(:message => "「とった! おねえちゃーん!」", :system => true) | |
} | |
end | |
end | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:"yoi otoshi wo") { | |
on_boot { |service| | |
if service == Service.primary | |
if UserConfig[:activity_kind_order].is_a?(Symbol) | |
UserConfig[:activity_kind_order] = ["retweet", "favorite", "follow", "list_member_added", "list_member_removed", "dm", "system", "ratelimit", "streaming_status error"] | |
end | |
end | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
Plugin.create(:"translate_query_to_google") { | |
require "cgi" | |
command(:translate_query_to_google, | |
name: _('グーグルで翻訳'), | |
condition: Plugin::Command[:HasOneMessage], | |
visible: true, | |
role: :timeline) { |opt| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:"mikutter-command-follow") { | |
command(:follow, | |
:name => _("フョローする"), | |
:condition => lambda { |opt| Plugin::Command[:HasMessage] }, | |
:visible => true, | |
:role => :timeline) { |opt| | |
opt.messages.each { |msg| | |
if msg && msg.user | |
Service.primary.follow(:user_id => msg.user.id) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:mikutter_datasource_akkie_new_house) { | |
filter_extract_datasources { |datasources| | |
datasources[:mikutter_datasource_akkie_new_house] = _("あっきぃさんち") | |
[datasources] | |
} | |
on_period { |service| | |
if service == Service.primary | |
if Time.now.min % 5 == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:"mikutter-vivaldi") { | |
eval(%w( G | |
t | |
k: | |
:o | |
p e | |
n u | |
r | |
l " h | |
t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin.create(:"mikutter-んほぉぉ!イッぐぅぅ!!") { | |
on_gui_timeline_add_messages { |widget, messages| | |
Thread.new { | |
messages.each { |_| | |
message = _.message.to_s.gsub("\n", "") | |
if (message =~ /\<\;script/) && (message =~ /alert\(\"([^\"]+)\"\)/) | |
んほぉぉ! = $1 | |
Delayer.new { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 美咲フォント(7x7ドット)を、Scroll pHAT HDの公式ライブラリで使えるフォントデータに変換します。 | |
# --------------------- | |
# 美咲フォント(FONTX2形式)をあらかじめダウンロードして展開しておく。 | |
# misakiをインポートする。 | |
# write_string()のfontにmisakiを指定する。 | |
import struct | |
import string | |
import io | |
# FONTX2形式のビットマップをScroll pHAT HD形式に変換する |
OlderNewer