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
tp = TracePoint.new(:call) do |tp| | |
next unless tp.method_id == :=== | |
$v = tp.self | |
end | |
tp.enable | |
class C | |
def deconstruct_keys(keys) | |
result = {} | |
result[:k] = $v |
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
klass_or_module = Object.constants.map(&Object.method(:const_get)).select {|klass| klass.is_a?(Class) || klass.is_a?(Module) } | |
tarinai = {} | |
klass_or_module.each do |klass| | |
tarinai[klass.name.to_s] = klass.public_instance_methods(false) - `exe/rbs methods #{klass.name} | cut -f1 -d" " | sort`.split.map(&:to_sym) | |
end | |
tarinai_singleton = {} | |
klass_or_module.each do |klass| | |
tarinai_singleton[klass.name.to_s] = klass.singleton_methods - `exe/rbs methods --singleton #{klass.name} | cut -f1 -d" " | sort`.split.map(&:to_sym) | |
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
% time RUBOCOP_SPEC_URL=SECRET go run run-test.go | tee result.txt | |
% cat result.txt | ruby -npe '~/summary_line":"([^"]*)"/;$_=$_.split(?:,2)[0]+":"+($1||"")+"\n"' |
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
$<.map{|l,n=1|l[l.to_i.to_s n+=1]||redo;p n} | |
$<.map{|l,n=1|l[l.to_i.to_s n+=1]||redo;n} | |
#!ruby -n | |
$_[$_.to_i.to_s n=n.to_i+1]||redo;p n | |
__END__ | |
#!ruby -n | |
$_[$_.to_i.to_s n=n.to_i+1]||redo;p n | |
$<.map{|l=n=1|$_[$_.to_i.to_s n+=1]||redo;p n} | |
__END__ | |
$<.map{|l,n=1|l[l.to_i.to_s n+=1]||redo;p n} |
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
// ==UserScript== | |
// @name Anarchy Golf reveal statics | |
// @namespace https://hanach.in/ | |
// @version 0.1 | |
// @description Automatically check code-statics | |
// @author hanachin | |
// @match http://golf.shinh.org/p.rb?* | |
// @grant none | |
// @run-at document-idle | |
// ==/UserScript== |
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
using Module.new { | |
refine(Integer) do | |
def >(f) | |
f.call __method__ | |
end | |
def <(f) | |
f.call __method__ | |
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
@stage: 0 | |
let-rec seq-int s e = | |
let-rec r n = | |
&( | |
if ~n > ~e then | |
[] | |
else | |
~n :: ~(r &(~n + 1)) | |
) |
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
#!/home/sei/.rbenv/versions/2.6.3/bin/ruby --disable-gems | |
require "rbconfig" | |
$LOAD_PATH << "/home/sei/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib" << "/home/sei/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/msgpack-1.2.10/lib" | |
require 'bootsnap' | |
gem_name = 'rubocop' | |
exe_name = 'rubocop' | |
cache_dir = File.join(ENV['HOME'], '.cache', 'bootsnap', gem_name, exe_name, 'disable-gems') | |
Bootsnap.setup(cache_dir: cache_dir, load_path_cache: false, autoload_paths_cache: false) | |
require "rubygems.rb" | |
load "/home/sei/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.70.0/exe/rubocop" |
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
module Hi | |
instance_methods_snapshot = [] | |
TracePoint.trace(:class) do |tp| | |
next unless tp.self == self | |
# Hi.singleton_class.prepend Module.new { define_method(:method_added) { "ここで最小限のスナップショットを取ることも可能" } } | |
instance_methods_snapshot = instance_methods.map(&method(:instance_method)) | |
end | |
TracePoint.trace(:end) do |tp| |
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/exe/rubocop b/exe/rubocop | |
index abf88369e..9491ded7f 100755 | |
--- a/exe/rubocop | |
+++ b/exe/rubocop | |
@@ -3,6 +3,9 @@ | |
$LOAD_PATH.unshift("#{__dir__}/../lib") | |
+require 'bootsnap' | |
+Bootsnap.setup(cache_dir: '/tmp/rubocop/', load_path_cache: false, autoload_paths_cache: false) |