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.
#lang racket | |
;; this is a stand alone simple version of the closure conversion part of the hoist pass from the tarot compiler | |
;; see https://rain-1.github.io/scheme for more. | |
(require data/queue) | |
;; closure conversion for lambda calculus | |
;; | |
;; the input language is: |
uniform float time; | |
uniform vec2 resolution; | |
uniform vec3 spectrum; | |
uniform sampler2D texture0; | |
out vec4 fragColor; | |
#define PHI (sqrt(5)*0.5 + 0.5) | |
//Color function | |
vec3 palette( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d ) | |
{ |
const copySelectedPhabs = () => { | |
let selection = window.getSelection(); | |
if (selection.rangeCount <= 0) { | |
return | |
} | |
const div = document.createElement('div') | |
Array.from(document.querySelectorAll('.phui-oi-frame')) | |
.filter(el => selection.containsNode(el, true)) | |
.forEach(el => { | |
const tmp = el.cloneNode(true) |
#!/usr/lib/env ruby | |
# Acquires a shared lock on a SQLite database file and copies it to a backup | |
# usage: backup-db.rb DBFILE.db BACKUPFILE.db | |
# author: William Benton (willb@redhat.com) | |
# Public domain. | |
require 'sqlite3' | |
require 'fileutils' |
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
#!/usr/bin/env node | |
// A work around to https://github.com/avh4/elm-format/issues/352 | |
// * Use it in place of elm-format (only some flags are supported) | |
// * Run it from a directory containing node_modules/elm-format/bin/elm-format (but you can change it below) | |
function extractFirstRegexMatch(regex, elmCode) { |
You'll need to include two pollyfils before you include a code with your custom elements:
• webcomponents/webcomponentsjs/custom-elements-es5-adapter.js - this is for new browsers in order to understand ES5 syntax
• webcomponents/custom-elements/custom-elements.min.js - this is for old browsers without customElements
support
You can add them to your index.html
file in the following way:
<div id="custom-elements-adapter">
/* | |
* Author: Felipe Herranz (felhr85@gmail.com) | |
* Contributors:Francesco Verheye (verheye.francesco@gmail.com) | |
* Israel Dominguez (dominguez.israel@gmail.com) | |
*/ | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import android.os.Handler; |
I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.
But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.
Svelte is a language.
Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?
A few projects that have answered this question: