evancz Mar 23, 2017 00:43
Just so folks are aware, one of the hard things about having ports just be a Task is the following. Right now, a Task is guaranteed to terminate with an error or a result.
The only way it could be otherwise is if you have something of type Task Never Never
Now, if you are calling out to random JS that is written by anyone, that guarantee goes away.
You have to call some callback to give the value back to Elm, but what if that is never called?
Maybe there's an error, maybe there is a weird code path.
Now Elm code can "leak" tasks that never get completed because of problems in JS code.
One way to protect against this is to have timeouts, such that there is some guaranteed end.
My point here is just that it is more complicated than "what if it was a task?" and then everything would be nice.
(async function generateReplies(document) { | |
// https://conventionalcomments.org/#labels | |
const LABEL = { | |
praise: "praise", | |
nitpick: "nitpick", | |
suggestion: "suggestion", | |
issue: "issue", | |
todo: "todo", | |
question: "question", | |
thought: "thought", |
sbt> eval new scala.sys.SystemProperties().foreach(x => println(x)) | |
sbt> eval scala.sys.env.foreach(x => println(x)) |
// -------------------------------------------------- | |
// Flexbox LESS mixins | |
// The spec: http://www.w3.org/TR/css3-flexbox | |
// -------------------------------------------------- | |
// Flexbox display | |
// flex or inline-flex | |
.flex-display(@display: flex) { | |
display: ~"-webkit-@{display}"; | |
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox |
Type crontab -l
to see your cron jobs. Type crontab -e
to edit them. You have to use Vim apparently.
Add a line like this:
0,30 * * * * /Users/YOURNAME/Documents/scripts/stretch.sh
That is on every 0th and 30th minute of the hour. Make sure all the separators in there are tabs!
Back in December 2017, I started working on something I called Elmish-Wasm, which was just an experimental repo to compile something Elm-like to Wasm. I made some progress, but the helpful people I talked and I came to the conclusion that most of what I had so far (Haskell and Regex to interpret .elm files into rudimentary wasm) was something the Elm compiler and the Elm AST already did. Writing that code was a lot of fun, but maybe not the most valuable way to explore Elm and WebAssembly. Before jumping back into this project I would like to record the important facts and questions related to compiling Elm to Wasm.
A lot of people talk about Web Assembly as if its C++ that runs in the browser. Thats not the case. This belief must come from that fact that C can currently compile to web assembly. Wasm is human-unreadable bytecode. There is a human-readable version of wasm, called wat. It looks like this..
;; A function that adds two numbe
var gulp = require('gulp'); | |
var elm = require('gulp-elm'); | |
var plumber = require('gulp-plumber'); | |
var del = require('del'); | |
// builds elm files and static resources (i.e. html and css) from src to dist folder | |
var paths = { | |
dest: 'dist', | |
elm: 'src/*.elm', | |
staticAssets: 'src/*.{html,css}' |