Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryo Nakamura r7kamura

View GitHub Profile
@r7kamura
r7kamura / space_probe.rb
Last active Sep 25, 2020
A Ruby script to print cop names which include "space".
View space_probe.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'activesupport'
gem 'rubocop', '0.84.0'
gem 'rubocop-performance', '1.6.0'
gem 'rubocop-rails', '2.5.2'
View benchmark_require_time.rb
module Kernel
alias_method :original_require, :require
def require(path)
time = ::Time.now
original_require(path).tap do
puts "%3.6f\t#{path}" % (Time.now - time)
end
end
end
View raise_kwargs_test.rb
class MyError < StandardError
def initialize(**options)
p options
end
end
raise MyError, foo: :bar
View test_rails_format_accept.rb
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rails', '5.1.7'
end
View active_record_nested_dependents.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'activerecord', '6.0.0'
gem 'sqlite3'
end
require 'active_record'
View active_record_time_default.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'activerecord', '6.0.0'
gem 'sqlite3'
end
require 'active_record'
View active_storage_test.rb
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rails', '6.0.0'
gem 'sqlite3'
end
View r7kamura-hatenablog-com.css
/* <system section="theme" selected="life"> */
@import url("/css/theme/life/life.css");
/* </system> */
body {
color: rgba(0, 0, 0, 0.8);
line-height: 1.7;
}
h1,
View dota-auto-chess-items-graph.dot
digraph G {
graph [
nodesep = 0.5
rankdir = LR
ranksep = 0.8
]
node [
fontsize = 18
shape = polygon
View activerecord-6-0-0-beta1-habtm-validation.rb
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "activerecord", "6.0.0.beta1", require: "active_record"
gem "sqlite3"
end
ActiveRecord::Base.logger = Logger.new(STDOUT)