Skip to content

Instantly share code, notes, and snippets.

View YumaInaura's full-sized avatar

いなうらゆうま ( 稲浦悠馬 ) YumaInaura

View GitHub Profile
@YumaInaura
YumaInaura / file0.txt
Created December 21, 2015 04:30
$ git log --oneline オプションで、ログを一行で表示する ref: http://qiita.com/Yinaura/items/db984a115bcd544732c1
be72210 Update gem 'guard-rspec'
233f60b Create new resoure 'UserGroup'
a54daf3 Update gem 'shoulda-matchers'
@YumaInaura
YumaInaura / file0.txt
Created December 22, 2015 08:51
Rails | 数字をバイト数に変換する ref: http://qiita.com/Yinaura/items/4f6591df5d7c7bf68a90
10.bytes
# => 10
@YumaInaura
YumaInaura / file0.txt
Created December 28, 2015 08:02
Ruby | rbenv でインストールできる全バージョンをリスト表示する ref: http://qiita.com/Yinaura/items/3eaf944e74aac3c20675
Available versions:
1.8.6-p383
1.8.6-p420
1.8.7-p249
1.8.7-p302
1.8.7-p334
1.8.7-p352
1.8.7-p357
1.8.7-p358
1.8.7-p370
@YumaInaura
YumaInaura / file0.txt
Last active December 31, 2015 06:57
Ruby | true と false を反転させる方法 ref: http://qiita.com/Yinaura/items/9df95ec1ff496f28387d
!(true)
# => false
@YumaInaura
YumaInaura / file0.txt
Last active December 31, 2015 07:00
Rails | `bin_path': can't find gem bundler に対処する ref: http://qiita.com/Yinaura/items/6501619c6f5ab79ddaa5
/Users/yinaura/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems.rb:243:in
`bin_path': can't find gem bundler (>= 0) (Gem::GemNotFoundException)
from /Users/yinaura/projects/project/bin/bundle:4:in `<main>'
class World
JAPAN = '日本'
end
@YumaInaura
YumaInaura / file0.txt
Created January 7, 2016 04:05
Rails | バリデーションの値を外部から参照できるようにする ref: http://qiita.com/Yinaura/items/e23040d1a247e2384b56
class Book < ActiveRecord::Base
TITLE_MAXIMUM_LENGTH = 100
validates :title, length: { maximum: TITLE_MAXIMUM_LENGTH }
end
require 'spec_helper'
describe do
subject { Forgery(:basic).text }
before do
allow(Forgery::Basic).to receive(:text).and_return('mocked text')
end
it { should eq 'mocked text' }
@YumaInaura
YumaInaura / en.yml
Last active January 13, 2016 04:01
Rails | i18n で 言語を強制指定する方法 ref: http://qiita.com/Yinaura/items/f8a5efdfa2f975a094ac
en:
message: It is English
@YumaInaura
YumaInaura / file0.txt
Created January 14, 2016 08:12
Ruby | 正規表現でのキャプチャがマッチしなかった場合の NoMethodError に対策する ref: http://qiita.com/Yinaura/items/d40ea26f0f69afc92a81
'Welcome to my DIRTY house.'.match(/(?<match>DIRTY)/)[:match]
# => "DIRTY"