From c8e7406fd19c78ca1e355ddffd1474f5796fa90d Mon Sep 17 00:00:00 2001 From: elioat Date: Fri, 7 Oct 2022 23:45:39 +0000 Subject: * --- coffee/NOTES.md | 13 +++++++++++++ coffee/build.sh | 5 +++++ coffee/starfish.coffee | 4 ++++ coffee/starfish.js | 15 +++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 coffee/NOTES.md create mode 100755 coffee/build.sh create mode 100644 coffee/starfish.coffee create mode 100644 coffee/starfish.js (limited to 'coffee') 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); -- cgit 1.4.1-2-gfad0