Skip to content

Instantly share code, notes, and snippets.

@tkfm-yamaguchi
Last active August 29, 2015 14:01
Show Gist options
  • Save tkfm-yamaguchi/c3c84090eed36561eba7 to your computer and use it in GitHub Desktop.
Save tkfm-yamaguchi/c3c84090eed36561eba7 to your computer and use it in GitHub Desktop.
class Life
@hack: (session, after_all=->) ->
klass = new @()
session(klass)
klass.run(after_all)
constructor: ->
@strs = []
do_something: (something="something") ->
@strs.push "I have done: #{something}"
run: (callback=->) ->
console.log str for str in @strs.reverse()
callback()
Life.hack (my_life) ->
my_life.do_something("Go to bed")
my_life.do_something("TV game")
my_life.do_something("Taking a nap")
my_life.do_something("TV game")
my_life.do_something("Getting up")
, ->
console.log "Wonderful life, it is !!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment