Skip to content

Instantly share code, notes, and snippets.

View amatsuda's full-sized avatar

Akira Matsuda amatsuda

View GitHub Profile

tl;dr

高円寺の南のほうのあたりで、ちょっとした新築共同住宅プロジェクトを立ち上げてみたいと思っています。つきましては、このプロジェクトの趣旨とノリに賛同してくださって居住してくださる方をふわっと募集します。

My New Gear...

最近、高円寺の南のほうのあたりに築古賃貸物件を買ってみました。物件概要はざっくり以下のような感じです。

  • 立地: 丸の内線東高円寺駅徒歩5分、JR中央線中野駅徒歩12分(Google調べ)
  • 地積: 110平米と120平米の間ぐらい
  • 建物: 築およそ30年の2階建て木造アパートを賃貸運用中

この建物には問題がある!

@amatsuda
amatsuda / t.rb
Created August 26, 2021 08:57
Rails 6.1 + triple nested sub_test_case on test-unit-rails
# frozen_string_literal: true
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', github: 'rails/rails', branch: 'main'
diff --git a/lib/reline.rb b/lib/reline.rb
index a7bd4d9..61001f9 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -168,10 +168,12 @@ module Reline
Reline::IOGate.get_screen_size
end
- def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
+ def readmultiline(prompt_ = '', add_hist_ = false, prompt: '', use_history: false, &confirm_multiline_termination)
class A
def f(x: nil)
p x
end
end
class Wrapper
def initialize
@a = A.new
end
@amatsuda
amatsuda / kwargs_allocation.rb
Last active June 27, 2017 22:03
Object Allocation in Ruby kwargs
require 'allocation_tracer'
require 'active_support/core_ext/array/extract_options'
require 'pp'
# Active Support
def foo1(options = {})
options[:x] || 1
end
# Ruby
@amatsuda
amatsuda / doesnot_work.rb
Last active January 4, 2017 02:26
`using` in Refinements should be physically placed before the refined method call
class String
def bar() foo; end
end
using Module.new {
refine String do
def foo() p self; end
end
}
# Question: which module would raise an error?
module I
include
end
module P
prepend
end
require 'benchmark/ips'
require 'json'
require 'oj'
require 'multi_json'
Benchmark.ips do |x|
hash = 100.times.inject(Hash.new) {|h, i| h["key#{i}"] = i; h}
x.report('to_json') do
hash.to_json
end
@amatsuda
amatsuda / t.rb
Last active July 13, 2016 01:04
What happens when you def translate in IRB
def b() binding; end
eval 'def translate() end', b
eval '1'
# => t.rb:3:in `eval': wrong number of arguments (given 1, expected 0) (ArgumentError)