This file contains 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
expr_gen = -> (n) { "(?<expr#{n}>[^()]|\\(\\g<expr#{n}>+\\))" } | |
simple = '(?<simple>(?:[()]|[^ski])*)' | |
S = /^#{simple}s#{expr_gen.(1)}#{expr_gen.(2)}#{expr_gen.(3)}(?<rest>.*)/ | |
K = /^#{simple}k#{expr_gen.(1)}#{expr_gen.(2)}(?<rest>.*)$/ | |
I = /^#{simple}i(?<rest>.+)/ | |
P = /^#{simple}\((?<content>#{expr_gen.(1)}*)\)(?<rest>.*)/ | |
$s = '\k<simple>(\k<expr1>\k<expr3>)(\k<expr2>\k<expr3>)\k<rest>' | |
$k = '\k<simple>\k<expr1>\k<rest>' |
This file contains 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/ruby/signature/test/hook.rb b/lib/ruby/signature/test/hook.rb | |
index ef0cc31..4b05887 100644 | |
--- a/lib/ruby/signature/test/hook.rb | |
+++ b/lib/ruby/signature/test/hook.rb | |
@@ -19,6 +19,7 @@ module Ruby | |
INSTANCE_EVAL = BasicObject.instance_method(:instance_eval) | |
INSTANCE_EXEC = BasicObject.instance_method(:instance_exec) | |
METHOD = Kernel.instance_method(:method) | |
+ INSTANCE_METHOD = Module.method(:instance_method).unbind | |
CLASS = Kernel.instance_method(:class) |
This file contains 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 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'octokit' | |
end | |
name = ARGV[0] || `git config --get github.user`.chomp | |
year = ARGV[1] || Time.now.year |
This file contains 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 'net/http' | |
require 'json' | |
class RequestError < StandardError | |
def initialize(errors) | |
@errors = errors | |
end | |
def message |
This file contains 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 'pathname' | |
require 'fileutils' | |
LOG_PATH = Pathname('/tmp/vimbench.log') | |
RE = /(\d+\.\d+)\s*\d+\.\d+:\s*--- N?VIM STARTED ---/ | |
N = 10 | |
def prepare | |
FileUtils.rm LOG_PATH if LOG_PATH.exist? |
This file contains 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 'benchmark' | |
str1 = 'hoge' | |
str2 = 'fuga' | |
str3 = <<~TEXT | |
わがはいは猫である。名前はまだ無い。 | |
どこで生れたかとんと見当けんとうがつかぬ。何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。吾輩はここで始めて人間というものを見た。しかもあとで聞くとそれは書生という人間中で一番獰悪どうあくな種族であったそうだ。この書生というのは時々我々を捕つかまえて煮にて食うという話である。しかしその当時は何という考もなかったから別段恐しいとも思わなかった。ただ彼の掌てのひらに載せられてスーと持ち上げられた時何だかフワフワした感じがあったばかりである。掌の上で少し落ちついて書生の顔を見たのがいわゆる人間というものの見始みはじめであろう。この時妙なものだと思った感じが今でも残っている。第一毛をもって装飾されべきはずの顔がつるつるしてまるで薬缶やかんだ。その後ご猫にもだいぶ逢あったがこんな片輪かたわには一度も出会でくわした事がない。のみならず顔の真中があまりに突起している。そうしてその穴の中から時々ぷうぷうと煙けむりを吹く。どうも咽むせぽくて実に弱った。これが人間の飲む煙草たばこというものである事はようやくこの頃知った。 | |
この書生の掌の裏うちでしばらくはよい心持に坐っておったが、しばらくすると非常な速力で運転し始めた。書生が動くのか自分だけが動くのか分らないが無暗むやみに眼が廻る。胸が悪くなる。到底とうてい助からないと思っていると、どさりと音がして眼から火が出た。それまでは記憶しているがあとは何の事やらいくら考え出そうとしても分らない。 | |
ふと気が付いて見ると書生はいない。たくさんおった兄弟が一疋ぴきも見えぬ。肝心かんじんの母親さえ姿を隠してしまった。その上今いままでの所とは違って無暗むやみに明るい。眼を明いていられぬくらいだ。はてな何でも容子ようすがおかしいと、のそのそ這はい出して見ると非常に痛い。吾輩は藁わらの上から急に笹原の中へ棄てられたのである。 | |
ようやくの思いで笹原を這い出すと向うに大きな池がある。吾輩は池の前に坐ってどうしたらよかろうと考えて見た。別にこれという分別ふんべつも出ない。しばらくして泣いたら書生がまた迎に来てくれるかと考え付いた。ニャー、ニャーと試みにやって見たが誰も来ない。そのうち池の上をさらさらと風が渡って日が暮 |
This file contains 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 'ast' | |
require 'strscan' | |
class RuremaParser | |
def initialize(text, path: nil) | |
@text = text | |
@path = path | |
@index = 0 | |
end |
This file contains 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 'ovto' | |
class MyApp < Ovto::App | |
class State < Ovto::State | |
item :next_node, default: false | |
end | |
class Actions < Ovto::Actions | |
def enable_next_node | |
return {next_node: true} |
This file contains 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/examples/static/Gemfile.lock b/examples/static/Gemfile.lock | |
index f2985fe..01959f6 100644 | |
--- a/examples/static/Gemfile.lock | |
+++ b/examples/static/Gemfile.lock | |
@@ -2,7 +2,7 @@ PATH | |
remote: ../.. | |
specs: | |
ovto (0.4.1) | |
- opal (~> 0.11) | |
+ opal (>= 0.11, < 2) |
This file contains 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
871296 /home/pocke/.rbenv/versions/trunk/lib/ruby/gems/2.7.0/gems/parser-2.6.3.0/lib/parser/lexer.rb:710:Array | |
528480 /home/pocke/.rbenv/versions/trunk/lib/ruby/2.7.0/psych/tree_builder.rb:97:Psych::Nodes::Scalar | |
281108 /home/pocke/.rbenv/versions/trunk/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:54:String | |
201464 /home/pocke/.rbenv/versions/trunk/lib/ruby/gems/2.7.0/gems/parser-2.6.3.0/lib/parser/ruby23.rb:876:Array | |
201464 /home/pocke/.rbenv/versions/trunk/lib/ruby/gems/2.7.0/gems/parser-2.6.3.0/lib/parser/ruby23.rb:1799:Array | |
201156 /home/pocke/.rbenv/versions/trunk/lib/ruby/2.7.0/psych.rb:456:String | |
166489 /home/pocke/.rbenv/versions/trunk/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:54:Regexp | |
111640 /home/pocke/.rbenv/versions/trunk/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:162:Hash | |
95561 /home/pocke/.rbenv/versions/trunk/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:364:String | |
95560 /home/pocke/.rbenv/versions/trunk/lib/ruby/2.7.0/psych/nodes/node.rb:34:Array |