Skip to content

Instantly share code, notes, and snippets.

diff --git a/lib/earthquake/input.rb b/lib/earthquake/input.rb
index aaafee8..787a451 100644
--- a/lib/earthquake/input.rb
+++ b/lib/earthquake/input.rb
@@ -78,6 +78,7 @@ module Earthquake
else
raise "type must be :y or :n"
end
+ s = {"\cY" => "Y", "\cN" => "N"}[s]
s = type.to_s if s.empty?
Earthquake.init do
command :history_cleaner do |m|
re = Regexp.new(m[1])
to_be_removed = []
Readline::HISTORY.each_with_index do |entry, index|
if re === entry
puts "to be removed: #{entry}"
to_be_removed << index
end
end
require "named_emoji"
Earthquake.once do
::EMOJIMOJI = NamedEmoji::ALL.each_with_object(Hash.new{|h, k| h[k] = {}}) do |(key, value), hash|
hash[value.size].update(value => ":#{key}:") if value
end
::EMOJI_RE = ::EMOJIMOJI.inject({}) do |regexps, (size, hash)|
re = case size
when 1
Regexp.new("[" + hash.keys.join + "]")
Earthquake.init do
command :sora do |m|
in_reply_to_status_id = m[1]
target = twitter.status(in_reply_to_status_id)
screen_name = target["user"]["screen_name"]
if confirm("sora reply to @#{screen_name}?")
async_e { twitter.update("@#{screen_name}", in_reply_to_status_id: in_reply_to_status_id) }
end
end
end
diff --git a/lib/earthquake/output.rb b/lib/earthquake/output.rb
index a5a19dc..41956e5 100644
--- a/lib/earthquake/output.rb
+++ b/lib/earthquake/output.rb
@@ -30,12 +30,14 @@ module Earthquake
end
def puts_items(items)
- mark_color = config[:colors].sample + 10
+ colors = config[:colors]
diff --git a/lib/earthquake/input.rb b/lib/earthquake/input.rb
index 870cefc..c91519c 100644
--- a/lib/earthquake/input.rb
+++ b/lib/earthquake/input.rb
@@ -141,6 +141,7 @@ module Earthquake
end
input_filter do |text|
+ next text if text.sub!(/\A: /, "")
if text =~ %r|^(:\w+)|
Earthquake.init do
output_filter do |item|
if retweeted_status = item["retweeted_status"]
!cache.exist?("status:#{retweeted_status["id"]}")
end
end
end
@no6v
no6v / aview.rb
Created March 22, 2012 12:54 — forked from jugyo/aview.rb
aview earthquake.gem plugin
# coding: UTF-8
require 'open-uri'
require 'tmpdir'
Earthquake.init do
command :aview do |m|
if File.exist?(m[1]) or m[1] =~ /^http/
url = m[1]
else
@no6v
no6v / object.c.patch
Created March 19, 2012 13:12
{Object,NilClass}#try
diff --git a/object.c b/object.c
index 63af8a2..77ba3e2 100644
--- a/object.c
+++ b/object.c
@@ -615,6 +615,12 @@ rb_obj_tap(VALUE obj)
return obj;
}
+VALUE
+rb_obj_try(int argc, VALUE *argv, VALUE obj)
@no6v
no6v / circle.rb
Created March 12, 2012 08:58 — forked from jugyo/circle.rb
Earthquake.init do
command :circle do |m|
text = m[1].unpack("U*").map {|i|
[*case i
when 97..122 # a-z
i + 0x24d0 - 97
when 65..90
i + 0x24b6 - 65
when 49..57
i + 0x245f - 48