Install https://github.com/vvo/selenium-standalone and start it.
Then run the test script. babel-node test.js
.
const after = t => x => cont => { | |
const id = setTimeout (cont, t, x) | |
return () => clearTimeout (id) | |
} | |
const map = f => run => cont => run(x => cont (f (x))) | |
const chain = f => run => cont => run(x => f (x) (cont)) | |
const run = chain (x => after (2000) (`${x}C`)) | |
(map (x => `${x}B`) |
Install https://github.com/vvo/selenium-standalone and start it.
Then run the test script. babel-node test.js
.
const Future = require('fluture') | |
// I can't guarantee this will work out of the box - it's quite old... but | |
// you should hopefully be able to see how this fits together! | |
const { ReaderT } = require('fantasy-readers') | |
// First of all, you're going to need to "lift" all your `Future` operations | |
// to work within ReaderT. Basically, you just need to call `ReaderT.lift` on | |
// any `Future` values. | |
const doAjaxThing_ = x => ReaderT.lift(doAjaxThing(x)) |
// https://medium.com/@WebReflection/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38 | |
export default class DOMEventHandler { | |
constructor(ctx, node) { | |
if (!ctx) throw new Error("DOMEventHandler: A context is required."); | |
this.ctx = ctx; | |
if (node) this.addEventListeners(node); | |
} | |
get events() { | |
return ( |
even_letters = "bcdfghlmnprstwx" | |
odd_letters = "aeiou" | |
def format_uid_digit (n, level): | |
if n != 0: | |
letters = odd_letters if (level & 1) else even_letters | |
base = len(letters) | |
s = format_uid_digit(n / base, level + 1) | |
return s + letters[(n % base)] | |
return "" |
{ config, pkgs, lib, ... }: | |
{ | |
# NixOS wants to enable GRUB by default | |
boot.loader.grub.enable = false; | |
# Enables the generation of /boot/extlinux/extlinux.conf | |
boot.loader.generic-extlinux-compatible.enable = true; | |
# !!! If your board is a Raspberry Pi 1, select this: | |
# boot.kernelPackages = pkgs.linuxPackages_rpi; | |
# !!! Otherwise (even if you have a Raspberry Pi 2 or 3), pick this: |
var { html, render } = require('nanohtml') | |
var { Component, memo, onupdate } = require('nanohtml/component') | |
// This example illustrates how memo can be used to maintain form state. | |
// On first render, getInitialValues is called and read values either | |
// from the fields argument or from local storage. | |
// Whenever a field changes its value is persisted to local storage. | |
var Form = Component(function (fields, values = memo(getInitialValues)) { | |
var update = onupdate(function (fields, values) { |
I've designed a lot of RPC protocols in my career. One pattern that's worked well basically goes as follows:
// Client calls: print('Hello World\n')
-> [1, "print", "Hello World!\n"]
// Server sends return value (or lack of return vvalue)
<- [-1]
// Client calls: add(1, 2)
-> [2, "add", 1, 2]
Filing an issue is not about delegating your problem to another developer, it’s about helping maintainers solve issues they haven’t encountered yet.
const compose = (f, g) => x => f(g(x)) | |
const Id = x => | |
({ | |
fold: f => f(x), | |
map: f => Id(f(x)) | |
}) | |
Id.of = Id | |
const Tuple = (_1, _2) => |