Skip to content

Instantly share code, notes, and snippets.

Avatar
👶
parenting

Shinichi Maeshima willnet

👶
parenting
View GitHub Profile
@willnet
willnet / application_record.rb
Last active Sep 8, 2021
ARのオブジェクトを生成しているところがどこか探すコード
View application_record.rb
class ApplicationRecord < ActiveRecord::Base
@ar_initialize_counter = Hash.new(0)
@ar_find_counter = Hash.new(0)
after_initialize :count_initialize
def count_initialize
return unless ApplicationRecord.enable_counter?
gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) }
caller_in_app = caller.find { |file_and_lineno| file_and_lineno !~ gems_paths}
@willnet
willnet / webpackconfig-from-webpacker5.4.2.js
Last active Aug 23, 2021
webpackconfig.js comparison between webpacker6-rc1 and webpacker5.4.2
View webpackconfig-from-webpacker5.4.2.js
{
"mode": "development",
"output": {
"filename": "js/[name]-[contenthash].js",
"chunkFilename": "js/[name]-[contenthash].chunk.js",
"hotUpdateChunkFilename": "js/[id]-[hash].hot-update.js",
"path": "/Users/willnet/tmp/webpacker5/public/packs",
"publicPath": "/packs/"
},
"resolve": {
@willnet
willnet / rails_6_1_new_features.md
Last active Sep 12, 2021
「Rails 6.1で新しく入る機能について」iCARE Dev Meetup #12 の登壇内容 https://icare.connpass.com/event/183716/
View rails_6_1_new_features.md

Rails 6.1で新しく入る機能について

@willnet

最近のRailsリリース日

  • 6.0.0 (2019/08/06)
  • 5.2.0 (2018/04/09)
  • 5.1.0 (2017/04/27)
  • 5.0.0 (2016/06/30)
View html-template-engine-benchmark.txt
Calculating -------------------------------------
erubi v1.9.0 20.994k i/100ms
slim v4.0.1 20.212k i/100ms
haml v5.1.2 11.562k i/100ms
faml v0.8.1 18.360k i/100ms
hamlit v2.10.0 21.497k i/100ms
-------------------------------------------------
erubi v1.9.0 245.242k (± 1.6%) i/s - 1.239M
slim v4.0.1 233.443k (± 2.2%) i/s - 1.172M
View wrapper_for_kaminari.rb
class WrapperForKaminari
attr_reader :total_count, :per, :page
delegate_missing_to :@models
def initialize(models:, total_count:, per:, page:)
@models = models
@total_count = total_count
@per = per
@page = page
end
View alias_method_chain_and_prepend.rb
module M
def call
puts 'M'
super
end
end
class Parent
def call
puts 'Parent'
View global_spec_helper.rb
def suppress_stdout
original_stdout = $stdout
$stdout = File.open(File::NULL, 'w')
result = yield
ensure
$stdout = original_stdout
result
end
module ObjectExt
@willnet
willnet / Dockefile
Created Dec 17, 2017
Dockerfile for rvm installed environment
View Dockefile
FROM ubuntu:14.04
RUN apt-get update
## Default Packages
RUN apt-get install -y -q ruby1.9.1 ruby1.9.1-dev build-essential
RUN apt-get install -y nano wget links curl rsync bc git git-core apt-transport-https libxml2 libxml2-dev libcurl4-openssl-dev openssl sqlite3 libsqlite3-dev
RUN apt-get install -y gawk libreadline6-dev libyaml-dev autoconf libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
## Ruby
View Gemfile
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
source 'https://rubygems.org'
ruby '2.4.2'
gem 'active_decorator'
View mf_rails.txt
## 感想
全体的に地味
## Adapter
いろいろadapterがある
- db2
- firebird