Skip to content

Instantly share code, notes, and snippets.

View toshia's full-sized avatar

Toshiaki Asai toshia

View GitHub Profile
@toshia
toshia / quoted_tweet.yml
Created June 11, 2015 15:34
コメント付きリツイート
---
event: quoted_tweet
created_at: Thu Jun 11 15:24:38 +0000 2015
source:
id: 5885172
id_str: '5885172'
name: SYUU BY ROCK!
screen_name: syuu1228
location: "山梨県八王子市"
url: http://d.hatena.ne.jp/syuu1228/
@toshia
toshia / gist:8b4647ac119f7dad5f73
Created December 24, 2014 13:58
お手軽画像ダウンロード
istream = Plugin.filtering(:openimg_raw_image_from_display_url, 'http://twitpic.com/d250g2/', nil).last
File.open(File.join(Environment::TMPDIR, 'd250g2.jpg'), 'w') do |ostream|
ostream.write(istream.read)
end
istream.close
@toshia
toshia / gist:245f9857c990c8914ae3
Created December 24, 2014 13:02
やめるやめる詐欺
# twitpic
defimageopener('twitpic', %r<^http://twitpic\.com/[a-zA-Z0-9]+>) do |display_url|
connection = HTTPClient.new
page = connection.get_content(display_url)
next nil if page.empty?
doc = Nokogiri::HTML(page)
result = doc.css('img').lazy.find_all{ |dom|
%r<https?://.*?\.cloudfront\.net/photos/(?:large|full)/.*> =~ dom.attribute('src')
}.first
open(result.attribute('src'))
@toshia
toshia / .mikutter.yml
Created December 21, 2014 05:40
mikutter 3.2で可能になった、抽出タブの条件拡張する機能のサンプル
---
slug: :strange_extractor
depends:
mikutter: 3.2.0
plugin: [extract]
version: '1.0'
author: toshi_a
name: 'strange extractor'
description: 'add some strange extract conditions.'
@toshia
toshia / mikutter.el
Created December 13, 2014 08:59
mikutter-modeロードするために俺が書いてるelisp
(add-to-list 'load-path
"~/.emacs.d/packages/mikutter-mode")
(require 'mikutter)
(setq mikutter:dir (expand-file-name "~/mikutter/"))
;; mikutterパースペクティブ使うならこれもいる↓
(require 'e2wm-mikutter)
(e2wm:add-keymap
e2wm:pst-minor-mode-keymap
@toshia
toshia / favorited_retweet.yml
Last active August 29, 2015 14:09
自分がretweetしたstatusに対してfavoriteが発生した時に自分に飛んでくるイベント?こんなの見たこと無いのでしれっと実装されたのだろうか(2回発生)
---
event: favorited_retweet
created_at: Wed Nov 12 00:36:58 +0000 2014
source:
id: 949438177
id_str: '949438177'
name: "ちょまど@11/16ホモ執筆中@文フリ"
screen_name: chomado
location: "(((o(*゚▽゚*)o)))"
profile_location:
@toshia
toshia / rbgtk2-2.2.2test.rb
Last active August 29, 2015 14:08
Ruby2.1.3p242、gtk2 2.2.2では動かないけど2.2.0では動くカウントアップタイマー
# coding: utf-8
#require 'bundler/setup'
require 'gtk2'
window = Gtk::Window.new
w_text = Gtk::Label.new("...")
w_btn = Gtk::Button.new("click")
counter = 0
@toshia
toshia / gist:eb3be3bc824b53e50466
Created September 11, 2014 14:12
戒名判定正規表現を作ろうとして失敗
\A(?<院号>[一-龠]+院)(?<道号>[一-龠]+)(?<戒名>[一-龠]+)(?<位号>居士|信士|信女|童子|童女|水子|禅尼)\Z
Plugin.create(:mikutter_profile_media) do
profiletab :usermediatimeline, _("最近の画像つきツイート") do
set_icon Skin.get("aclog.png")
uid = user.id
i_timeline = timeline nil do
order do |message|
retweet = message.retweeted_statuses.find{ |r| uid == r.user.id }
(retweet || message)[:created].to_i end end
Service.primary.search(q: "from:#{user[:idname]} filter:images",
@toshia
toshia / 0_reuse_code.js
Created May 16, 2014 11:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console