Skip to content

Instantly share code, notes, and snippets.

@cobodo
cobodo / .mikutter.yml
Last active October 11, 2018 09:59
リンクをCtrl+クリックでインテントを無視して外部ブラウザで開く
---
slug: :ctrl_click
depends:
mikutter: 3.8.1
plugin:
- intent
- web
- gtk
- gui
version: '1.0'
@cobodo
cobodo / Gemfile
Created October 8, 2018 11:04
GLib constant numbers
source 'https://rubygems.org'
ruby '>= 2.5.0'
git "https://github.com/ruby-gnome2/ruby-gnome2.git" do
gem "glib2"
end
diff --git a/model/account_profile.rb b/model/account_profile.rb
index e9e8397..5acf0af 100644
--- a/model/account_profile.rb
+++ b/model/account_profile.rb
@@ -24,10 +24,6 @@ module Plugin::Worldon
account.created_at
end
- memoize def modified
- Time.at(5000000000000000)
@cobodo
cobodo / Gemfile
Last active October 8, 2018 08:52
GLib2のMIN/MAX系定数を64bit環境で表示
source 'https://rubygems.org'
ruby '>= 2.5.0'
gem 'glib2', '>= 3.2.9'
@cobodo
cobodo / colorful_reply_header.rb
Created September 21, 2018 10:25
リプライヘッダの色を黒固定ではなく、 設定>表示>リプライ先>フォント の色にする。
class Gdk::SubPartsMessageBase < Gdk::SubParts
def render_header(message, context, base_y)
context.save do
context.translate(icon_width + margin*2 + edge, margin + edge + base_y)
context.set_source_rgb(*(UserConfig[:reply_text_color].map{ |c| c.to_f / 65536 }))
hl_layout = header_left(message, context)
if hl_layout
context.show_pango_layout(hl_layout)
hl_w, hl_h = hl_layout.pixel_size
hr_layout = render_header_right(message, context, base_y, hl_w)
@cobodo
cobodo / double_header.rb
Last active September 28, 2018 04:35
display_nameとidnameの行を分ける。ドメイン先頭のmstdnは自明だから消す。すまほんはすまほん。
class Gdk::MiraclePainter < Gtk::Object
alias :original_header_left_markup :header_left_markup
def header_left_markup
user = message.user
if user.respond_to?(:idname)
idname = user.idname
parts = idname.split('@')
if parts[1]
if parts[1].start_with?('mstdn.')
IDN::Idna::IdnaError 文字列準備中で失敗 (1)
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/addressable-2.5.1/lib/addressable/idna/native.rb:38:in `toASCII'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/addressable-2.5.1/lib/addressable/idna/native.rb:38:in `block in to_ascii'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/addressable-2.5.1/lib/addressable/idna/native.rb:36:in `map'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/addressable-2.5.1/lib/addressable/idna/native.rb:36:in `to_ascii'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/addressable-2.5.1/lib/addressable/uri.rb:1092:in `normalized_host'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/addressable-2.5.1/lib/addressable/uri.rb:823:in `freeze'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/diva-0.3.2/lib/diva/uri.rb:75:in `to_uri'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/diva-0.3.2/lib/diva/uri.rb:104:in `method_missing'
{MIKUTTER_DIR}/core/plugin/search/model/search.rb:13:in `block in <class:Search>'
@cobodo
cobodo / emoji_codes.txt
Last active May 25, 2018 14:55
https://unicode.org/emoji/charts/full-emoji-list.html [...document.querySelectorAll('table > tbody > tr > td.code > a')].map(node => node.textContent)
[
"U+1F600",
"U+1F601",
"U+1F602",
"U+1F923",
"U+1F603",
"U+1F604",
"U+1F605",
"U+1F606",
"U+1F609",
@cobodo
cobodo / mikutter.log
Created May 6, 2018 10:51
score_by_screen_name_regexpのバグ?
NoMethodError undefined method `partition' for nil:NilClass
{MIKUTTER_DIR}/core/plugin/twitter/twitter.rb:472:in `score_by_regexp'
{MIKUTTER_DIR}/core/plugin/twitter/twitter.rb:458:in `score_by_screen_name_regexp'
{MIKUTTER_DIR}/core/plugin/twitter/twitter.rb:308:in `block (2 levels) in <top (required)>'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/pluggaloid-1.1.1/lib/pluggaloid/filter.rb:28:in `filtering'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/pluggaloid-1.1.1/lib/pluggaloid/event.rb:59:in `block (2 levels) in filtering'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/pluggaloid-1.1.1/lib/pluggaloid/event.rb:58:in `each'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/pluggaloid-1.1.1/lib/pluggaloid/event.rb:58:in `reduce'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/pluggaloid-1.1.1/lib/pluggaloid/event.rb:58:in `block in filtering'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.5.0/gems/pluggaloid-1.1.1/lib/pluggaloid/event.rb:57:in `catch'
@cobodo
cobodo / twemoji.rb
Created April 26, 2018 14:33
Twemojiプラグイン for mikutter 3.7
# https://github.com/twitter/twemoji/blob/gh-pages/twemoji.js
module Plugin::Twemoji
extend self
class Twemoji < Diva::Model
register :score_twemoji, name: "Twemoji"
field.string :description, required: true
field.uri :url, required: true
memoize def inline_photo