Skip to content

Instantly share code, notes, and snippets.

View sss's full-sized avatar

SASAKI Suguru sss

  • Kyoto, Japan
View GitHub Profile
@sss
sss / draft.rb
Created June 23, 2011 02:53 — forked from no6v/draft.rb
module Earthquake::Input
def drafts
@drafts ||= []
end
end
Earthquake.init do
d = drafts
subcommands = {
apply: ->(index){Readline::HISTORY.push(d.at(Integer(index)))},
@sss
sss / imgur.rb
Created April 21, 2011 14:12 — forked from jugyo/imgur.rb
earthquake.gem imgur command
Earthquake.init do
config[:imgur] ||= {api_key: '5cb04404b1ff26a88cbfe42de5aba23f'}
command :imgur do
require 'tempfile'
image_path = Tempfile.open('imgur').path
puts "capture an image from the screen!"
system 'screencapture', '-s', image_path # NOTE: Mac only :(
unless File.size(image_path) == 0
input ":imgur #{image_path}"
@sss
sss / screen_name_prompt.rb
Created April 21, 2011 14:12 — forked from ryumu/screen_name_prompt.rb
Earthquake.gemのプロンプトにユーザー名を出すよ!プラグイン
# coding: UTF-8
Earthquake.init do
once do
config[:prompt] = twitter.info['screen_name'] + config[:prompt]
end
end
@sss
sss / event_notifier.rb
Created April 21, 2011 14:11 — forked from jugyo/event_notifier.rb
event_notifier.rb
# event_notifier plugin
Earthquake.init do
output do |item|
if item["event"] && item["source"]["screen_name"] != twitter.info["screen_name"]
notify "#{item["source"]["screen_name"]} => #{item["target"]["screen_name"]}" +
(item["target_object"] ? " : #{item["target_object"]["text"].u}" : ""),
:title => "[#{item["event"]}]"
end
end
end
@sss
sss / keyword.rb
Created April 21, 2011 14:11 — forked from jugyo/keyword.rb
keyword
# keyword plugin
# ====
#
# config example:
#
# Earthquake.config[:keyword] = {:pattern => /ruby|rails|earthquake/i}
#
Earthquake.init do
config[:keyword] ||= {}
config[:keyword][:pattern] ||= /ruby|rails|earthquake/i
@sss
sss / user_filter.rb
Created April 21, 2011 14:11 — forked from jugyo/user_filter.rb
user_filter
# user_filter plugin
# ====
#
Earthquake.init do
_ = config[:user_filter] ||= {}
_[:enable] ||= true
_[:default] ||= :show # :show or :hide
_[:excludes] ||= []
_[:includes] ||= []
@sss
sss / bitly.rb
Created April 21, 2011 14:11 — forked from ryumu/bitly.rb
shoten url earthquake.gem plugin
# earthquake.gem plugin
# shorten url using bit.ly
Earthquake.init do
_ = config[:bitly] ||= {}
_[:username] ||= ''
_[:api_key] ||= ''
_[:domain] ||= 'j.mp'
_[:only_long_tweet] ||= false
@sss
sss / tsunami_mode.rb
Created April 21, 2011 14:11 — forked from masarakki/tsunami_mode.rb
plugin for earthquake.gem
# -*- coding: utf-8 -*-
#
# Earthquakeを実況モードにするプラグインです
# 普通に起動した後
# :tsunami #K-ON #tbs
# のようにして実況モードに入ります
#
# すると #K-ON (空白区切りで最初のキーワードのみ) で検索した結果が
# リアルタイムに更新されます
#
###
# This is a demonstration of using SQLite3's Virtual File System API in Ruby.
#
# == Synopsis
#
# This program will store it's SQLite database after the __END__ line.
#
# === In Detail
#
# SQLite3 uses the DATABase class as a proxy for our IO object. Upon
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"