diff options
Diffstat (limited to 'coffee')
-rw-r--r-- | coffee/NOTES.md | 13 | ||||
-rwxr-xr-x | coffee/build.sh | 5 | ||||
-rw-r--r-- | coffee/starfish.coffee | 4 | ||||
-rw-r--r-- | coffee/starfish.js | 15 |
4 files changed, 37 insertions, 0 deletions
diff --git a/coffee/NOTES.md b/coffee/NOTES.md new file mode 100644 index 0000000..abf9adb --- /dev/null +++ b/coffee/NOTES.md @@ -0,0 +1,13 @@ +# coffeescript + +``` +coffee -c starfish.coffee +``` + +compiles coffeescript code to .js + +``` +node starfish.js +``` + +runs the compiled js diff --git a/coffee/build.sh b/coffee/build.sh new file mode 100755 index 0000000..5388daa --- /dev/null +++ b/coffee/build.sh @@ -0,0 +1,5 @@ +#!/usr/local/bin/bash -e + +rm -rf starfish.js +coffee -c starfish.coffee +node starfish.js diff --git a/coffee/starfish.coffee b/coffee/starfish.coffee new file mode 100644 index 0000000..bfd5f44 --- /dev/null +++ b/coffee/starfish.coffee @@ -0,0 +1,4 @@ +square = (x) -> x * x +cube = (x) -> square(x) * x + +console.log cube(33) diff --git a/coffee/starfish.js b/coffee/starfish.js new file mode 100644 index 0000000..3e6af8b --- /dev/null +++ b/coffee/starfish.js @@ -0,0 +1,15 @@ +// Generated by CoffeeScript 2.7.0 +(function() { + var cube, square; + + square = function(x) { + return x * x; + }; + + cube = function(x) { + return square(x) * x; + }; + + console.log(cube(33)); + +}).call(this); |