Skip to content

Instantly share code, notes, and snippets.

View amatsuda's full-sized avatar

Akira Matsuda amatsuda

View GitHub Profile
+----------------------+--------+--------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers | 48726 | 39215 | 522 | 3970 | 7 | 7 |
| Helpers | 14795 | 12125 | 15 | 1399 | 93 | 6 |
| Models | 96678 | 76140 | 1747 | 8548 | 4 | 6 |
| Mailers | 2208 | 1766 | 44 | 206 | 4 | 6 |
| Workers | 639 | 540 | 20 | 31 | 1 | 15 |
| Chanko units | 11713 | 9644 | 6 | 247 | 41 | 37 |
| Libraries | 50409 | 41650 | 592 | 3741 | 6 | 9 |

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
Kernel.class_eval do
#FIXME this is terrible
def static(meth)
define_singleton_method(meth) do |*args, &b|
new.send meth, *args, &b
end
meth
end
def abstract(meth)
@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