about summary refs log tree commit diff stats
path: root/coffee
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2022-10-07 23:45:39 +0000
committerelioat <elioat@tilde.institute>2022-10-07 23:45:39 +0000
commitc8e7406fd19c78ca1e355ddffd1474f5796fa90d (patch)
treee03eb2f2289434e6d50126b9a5947d82e3e61871 /coffee
parentfe7c24f68626e1e09d333507bb15ff0cb37e0734 (diff)
downloadtour-c8e7406fd19c78ca1e355ddffd1474f5796fa90d.tar.gz
*
Diffstat (limited to 'coffee')
-rw-r--r--coffee/NOTES.md13
-rwxr-xr-xcoffee/build.sh5
-rw-r--r--coffee/starfish.coffee4
-rw-r--r--coffee/starfish.js15
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);