Skip to content

Instantly share code, notes, and snippets.

@kodaitakahashi
kodaitakahashi / 0_reuse_code.js
Last active October 5, 2016 08:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kodaitakahashi
kodaitakahashi / catch_throw.rb
Last active October 5, 2016 08:52
catch throwを使った時の大域脱出
catch (:escape) do
loop do
puts 'loop1'
loop do
puts 'loop2'
throw (:escape, 'escape loop1 & loop2)
end
end
end
@kodaitakahashi
kodaitakahashi / break.rb
Last active October 5, 2016 08:52
複数のbreak文を用いた脱出
# ruby 2.3.0
loop do
puts 'loop1'
loop do
puts 'loop2'
break
end
puts 'escape loop2'
break
@kodaitakahashi
kodaitakahashi / catch_syntax.rb
Created October 5, 2016 09:09
Kernel.#catch Kernel.#throwの構文
# catchの構文
catch (tag) do
# tag => 終了する場ためのオブジェクト throwから送られてくるものと一致する必要がある。
@kodaitakahashi
kodaitakahashi / include.rb
Last active October 16, 2016 06:38
includeの説明
module M
def hoge
puts 'hoge'
end
end
class C
include M
end
@kodaitakahashi
kodaitakahashi / prepend.rb
Created October 16, 2016 06:50
prependの説明
module M
class hoge
puts 'hoge'
end
end
class C
prepend M
end
@kodaitakahashi
kodaitakahashi / include_prepend.rb
Created October 16, 2016 06:59
includeとprependを使ったメソッド探索
module M1; end
module M2; end
class C
include M1
prepend M2
end
a = C.new
@kodaitakahashi
kodaitakahashi / extend.rb
Last active October 16, 2016 07:22
extendの説明
module M
def hoge
puts 'hoge'
end
end
class C
extend M
end
10分以内でおねがいします。
部屋は就職資料室 15704でお願いします。
鍵は事務室にあります。
昼は避けてください。
学校名と名前をよろしくおねがいします。
自己PRをお願いします。
学生時代に頑張ったことはなんですか? (気になることは深掘りありです。)
なぜ弊社を希望されましたか?
@kodaitakahashi
kodaitakahashi / hoge.rb
Created October 28, 2016 00:22
HANAMI ControllerとViewのデータの共有の仕方
# apps/web/controllers/hoge/hoge.rb
module Web::Controllers::hoge
class Index
include Web::Action
expose :hoge #Viewと共有するインスタンス変数のシンボルを渡す
def call(params)
@hoge = 'Hello Hoge' # exposeに明示されているためViewに共有される。
@huga = 'Hello Huga' # exposeに明示されていないためViewには共有されない。
end