This file contains hidden or 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
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? |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 + "]") |
This file contains hidden or 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
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 |
This file contains hidden or 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
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] |
This file contains hidden or 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
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+)| |
This file contains hidden or 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
Earthquake.init do | |
output_filter do |item| | |
if retweeted_status = item["retweeted_status"] | |
!cache.exist?("status:#{retweeted_status["id"]}") | |
end | |
end | |
end |
This file contains hidden or 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 'open-uri' | |
require 'tmpdir' | |
Earthquake.init do | |
command :aview do |m| | |
if File.exist?(m[1]) or m[1] =~ /^http/ | |
url = m[1] | |
else |
This file contains hidden or 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
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) |
This file contains hidden or 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
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 |