Skip to content

Instantly share code, notes, and snippets.

View YumaInaura's full-sized avatar

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

View GitHub Profile
@YumaInaura
YumaInaura / file0.txt
Created September 24, 2015 07:19
rspec: match_array は 多次元配列の順番を検証してしまう ref: http://qiita.com/Yinaura/items/e20fbfee18e34c195f85
expect([1,2]).to match_array [2,1] # => true
@YumaInaura
YumaInaura / example.conf
Last active September 29, 2015 05:00
Rails 4.2以降: Rails+Unicorn で、publicディレクトリの中身が404になる場合の解決策 ref: http://qiita.com/Yinaura/items/d7dc3daefb5825aba474
server {
listen 80;
server_name xxx.xxx.xxx.xxx;
server_name example.com;
root /path/to/public;
location ~ ^/assets/ {
root /path/to/public;
}
}
@YumaInaura
YumaInaura / .travis.yml
Created October 1, 2015 10:23
Travis CI の script で sudo できない時の対処法 ref: http://qiita.com/Yinaura/items/5987b282a56576149502
sudo: true
script:
- sudo make install
@YumaInaura
YumaInaura / ability.rb
Created October 5, 2015 08:31
Rails: CanCanでアクションごとに権限を設定する方法 ref: http://qiita.com/Yinaura/items/1bc839089b627cc3865e
def initialize(user)
can :update, ExampleClass
can :create, ExampleClass
end
@YumaInaura
YumaInaura / file0.sql
Last active April 21, 2016 07:22
BigQuery で WHEN CASE 文が書けない時の対処法 ref: http://qiita.com/Yinaura/items/5cfab23d32a57c259a5c
SELECT
CASE fruit
WHEN 'Apple' THEN 'is apple'
WHEN 'Orange' THEN 'is orange'
ELSE 'none'
END AS fruit_kind;
@YumaInaura
YumaInaura / .rubocop.yml
Last active May 24, 2016 05:02
Rubocop がチェックしてくれるもの一覧表 (Style編) ref: http://qiita.com/Yinaura/items/9928e32fa9fc9092f24c
#例:
Style/RegexpLiteral:
EnforcedStyle: percent_r
@YumaInaura
YumaInaura / file0.txt
Last active October 20, 2015 12:11
Rails: Date / Time / DateTime 型の違い。そしてSQL用の文字列を得る方法。 ref: http://qiita.com/Yinaura/items/9c0cbb7c5d9e0440b111
Date.today
# => Tue, 20 Oct 201
@YumaInaura
YumaInaura / file0.txt
Last active October 22, 2015 07:22
Ruby on Rails で究極の答えを表示する方法 ref: http://qiita.com/Yinaura/items/397dcf9c57f91acc86a1
hundled = [*(1..100)]
@YumaInaura
YumaInaura / Gemfile
Last active October 22, 2015 08:52
rails console で pry を使う方法 ref: http://qiita.com/Yinaura/items/ee6171c29a929d0d8c89
+ gem 'pry-rails'
@YumaInaura
YumaInaura / development.rb
Created October 22, 2015 09:22
Gmail 経由での SMTP メール送信が出来ない時の解決法 (ユーザー名とパスワードは合っているのに。。) ref: http://qiita.com/Yinaura/items/6886682a607951a71bac
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'example.com',
:user_name => 'example@gmail.com',
:password => 'dlapwoeifkbmzksl', # Googleが発行する、12桁のアプリケーションパスワード
:authentication => :login,