Skip to content

Instantly share code, notes, and snippets.

View YumaInaura's full-sized avatar

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

View GitHub Profile
@YumaInaura
YumaInaura / file0.sql
Last active November 11, 2015 09:35
SQL: show columns を 13文字分 短く打つ方法 ref: http://qiita.com/Yinaura/items/13b1d861f253ae92e350
SHOW COLUMNS FROM table_name;
@YumaInaura
YumaInaura / book.rb
Created November 18, 2015 07:02
Rails: ActiveAdmin で has_many なフォーム ( nested resouces ) を作るための最小構成 ref: http://qiita.com/Yinaura/items/e4cad1b59afe08b7de11
ActiveAdmin.register Book do
permit_params :title, images_attributes: [:kind]
form do |f|
f.inputs do
f.input :title
end
f.inputs do
@YumaInaura
YumaInaura / file0.txt
Last active November 19, 2015 08:02
Rspec: mock と double の違い ref: http://qiita.com/Yinaura/items/4aa239c95fca7da6d6b0
- mock(name: 'Jack')
+ double(name: 'Jack')
@YumaInaura
YumaInaura / example.rb
Last active November 20, 2015 03:56
Rspec で クラスメソッドのスタブを作る方法 ref: http://qiita.com/Yinaura/items/dfc09fd6d4b953181e2d
class Example
def self.class_method
'This is real class method'
end
end
@YumaInaura
YumaInaura / file
Last active November 27, 2015 08:34
Rails | コード内のコメントを見つける方法 (TODO、FIXME、OPTIMIZE、HACK、REVIEW) ref: http://qiita.com/Yinaura/items/69584a09fee58efd163e
# DANGER: 注意!
@YumaInaura
YumaInaura / file2.txt
Last active November 27, 2015 09:59
Rspec | メソッドチェーンの検証方法 ( expect_any_instance_of ) ref: http://qiita.com/Yinaura/items/678c5163c0aa6cba6272
{ name: 'John' }.to_a.class # => Array
@YumaInaura
YumaInaura / file0.sql
Created December 1, 2015 03:55
SQL | GROUP BY と WHERE の順番 ref: http://qiita.com/Yinaura/items/a69b4fd41a9b20b8f4ae
SELECT id
FROM user
WHERE name = 'John'
GROUP BY id
@YumaInaura
YumaInaura / file0.txt
Last active May 14, 2016 01:14
Slack | APIに使う「チャンネルID」を取得する方法 ref: http://qiita.com/Yinaura/items/bd28c7b9ef614696fb7e
{
"id": "xxxxxxxxx",
"name": "example",
"is_channel": true,
"created": 1448847829,
"creator": "yyyyyyyyy",
"is_archived": false,
"is_general": false,
"is_member": true,
"members": [
@YumaInaura
YumaInaura / color.sh
Last active December 3, 2015 07:37
シェルスクリプトに環境変数を渡して表示する方法 ref: http://qiita.com/Yinaura/items/978b8c44cbddae1b8df7
#!/bin/sh
echo $COLOR
@YumaInaura
YumaInaura / file0.txt
Last active December 5, 2015 14:33
Ruby | first / last / begin / end / min / max の違い ref: http://qiita.com/Yinaura/items/77cc63a335b618fc5e90
[5,4,3,2,1].first
# => 5