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
$ rvm --version | |
rvm 1.19.5 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] | |
$ rvm --create ruby-2.0.0-p0@test | |
$ gem install kgio | |
Fetching: kgio-2.8.0.gem (100%) | |
Building native extensions. This could take a while... | |
Successfully installed kgio-2.8.0 | |
1 gem installed |
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
# encoding: UTF-8 | |
# :verical for earthquake.gem: https://gist.github.com/no6v/5187616 | |
Earthquake.once do | |
begin | |
require "tapp" | |
require "tapp/object_extension" | |
rescue LoadError | |
warn "`gem install tapp` to use :vertical_debug".c(:notice) | |
next | |
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
# encoding: UTF-8 | |
str = <<'EOT' | |
連続する、、句読点。 | |
どう扱えば、いいのか。。 | |
末尾に、、、句読点がなくても | |
大丈夫だょ | |
EOT | |
punc = "、。,." | |
h = "ー「」→↑←↓=…" |
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
# encoding: UTF-8 | |
str = <<'EOT' | |
連続する、句読点。 | |
どう扱えば、、いいのか。。。 | |
EOT | |
punc = "、。,." | |
h = "ー「」→↑←↓=…" | |
v = "|¬∟↓→↑←॥:" | |
hv = (h + v) |
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
# encoding: UTF-8 | |
# basically inspired by melborne@github aka @merborne | |
# https://gist.github.com/melborne/5180832#file-flippy_vertical-rb | |
Earthquake.init do | |
punctuation = "、。,." | |
h = "ー「」→↑←↓=…" | |
v = "|¬∟↓→↑←॥:" | |
hv = (h + v) | |
vh = (v + h) | |
sep = "||--" |
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.once do | |
Module.new do |api_v1_1_forcibly| | |
def request(http_method, path, *arguments) | |
super(http_method, path.sub("/1/", "/1.1/"), *arguments) | |
end | |
OAuth::AccessToken.__send__(:prepend, api_v1_1_forcibly) | |
end | |
Module.new do |api_v1_1| |
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
RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-02-28 trunk 39535) [x86_64-linux]" | |
module PM | |
def m(a, b) | |
end | |
end | |
class PC | |
prepend PM |
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.once do | |
class ::TwitterOAuth::Client | |
def related_results(id) | |
get("/related_results/show/#{id}.json") | |
end | |
end | |
end | |
Earthquake.init do | |
command :conversation do |m| |
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.emojis.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
# encoding: UTF-8 | |
module Earthquake | |
module Input | |
def ask_with_accept_ctrl_yn(message) | |
s = ask_without_accept_ctrl_yn(message) | |
{"\cY" => "Y", "\cN" => "N", "ん" => "N"}.fetch(s, s) | |
end | |
alias_method_chain :ask, :accept_ctrl_yn | |
end |
NewerOlder