Skip to content

Instantly share code, notes, and snippets.

$ rvm --version
rvm 1.19.5 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [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
# 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
@no6v
no6v / v.rb
Last active December 15, 2015 04:29
# encoding: UTF-8
str = <<'EOT'
連続する、、句読点。
どう扱えば、いいのか。。
末尾に、、、句読点がなくても
大丈夫だょ
EOT
punc = "、。,."
h = "ー「」→↑←↓=…"
# encoding: UTF-8
str = <<'EOT'
連続する、句読点。
どう扱えば、、いいのか。。。
EOT
punc = "、。,."
h = "ー「」→↑←↓=…"
v = "|¬∟↓→↑←॥:"
hv = (h + v)
@no6v
no6v / vertical.rb
Last active December 15, 2015 02:29
# 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 = "||--"
@no6v
no6v / api_v1_1.rb
Last active December 14, 2015 09:29
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|
@no6v
no6v / m.rb
Created February 28, 2013 13:11
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
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|
@no6v
no6v / emojimoji.rb
Created June 11, 2012 03:26
named_emoji decoder
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 + "]")
# 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