This file contains hidden or 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 ActiveModelAttributesInspector | |
# @return [String] | |
def inspect | |
values = attributes.map { |key, value| "#{key}: #{value.inspect}" }.join(', ') | |
%(<#{self.class.name} #{values}>) | |
end | |
# @param pp [PP] | |
# | |
# @return [void] |
This file contains hidden or 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
# 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", '~> 6.0.0' |
This file contains hidden or 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
# create_table :users do |t| | |
# t.integer :uuid, null: false | |
# t.index :uuid, unique: true | |
# end | |
class User < ApplicationRecord; end | |
User.transaction do | |
User.find_by(uuid: 1) #=> nil | |
# ここで別transactionにて |
This file contains hidden or 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
# .pryrc | |
show_backtrace = Class.new(Pry::ClassCommand) do | |
IGNORE_PATHS = %w[ | |
/pry | |
/byebug | |
].freeze | |
match 'show-backtrace' | |
description 'Filter the caller locations' |
This file contains hidden or 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
begin | |
require 'bundler/inline' | |
rescue LoadError | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' |
This file contains hidden or 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
neovimをnodenvと併用したときのバグを発見してしまった。 | |
vim-jpに投げるか、放置するかどうしようかなー | |
```neovim/0.2.2_1/share/nvim/runtime/autoload/provider/node.vim | |
25c25,31 | |
< let args = [provider#node#Prog()] | |
--- | |
> let args = ['node'] | |
> | |
> if !empty($NVIM_NODE_HOST_DEBUG) |
This file contains hidden or 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
class Automata | |
class Error < StandardError; end | |
class InvalidTransition < Error; end | |
attr_reader :current_state | |
def initialize(initial_state:, &block) | |
@initial_state = initial_state | |
@current_state = nil | |
@events = {} |
This file contains hidden or 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
class Database | |
def initialize | |
@mutex = Mutex.new | |
@value = 0 | |
end | |
def read | |
io_blocking { @value } | |
end |
This file contains hidden or 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
class Database | |
def initialize | |
@value = 0 | |
end | |
def read | |
io_blocking { @value } | |
end | |
def write(value) |