This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import produce, { Draft, Immutable } from 'immer' | |
| type Updater<S> = (state: Draft<S>) => void | S | |
| type UpdateCallback<S> = (state: Immutable<S>) => void | |
| type State<T> = { | |
| current: Immutable<T>; | |
| update: (updater: Updater<T>) => void; | |
| onUpdate: (cb: UpdateCallback<T>) => void; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /tmp/ | |
| /lib/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /src/ | |
| /tmp/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: [push] | |
| jobs: | |
| lint-and-test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function nextTick<O> (cb: () => O | Promise<O>): Promise<O> { | |
| return new Promise((resolve, reject) => { | |
| requestAnimationFrame(() => { | |
| Promise.resolve(cb()) | |
| .then(value => resolve(value)) | |
| .catch(e => reject(e)) | |
| }) | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def generate_id do | |
| result = | |
| Ecto.UUID.generate() | |
| |> String.replace(~r/-+/, "") | |
| |> Base.decode16(case: :lower) | |
| case result do | |
| :error -> | |
| throw("Something went wrong generating a uuid") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Example.RandomTest do | |
| use ExUnit.Case | |
| test "loads wasm file" do | |
| {:ok, bytes} = File.read("priv/vendor/needs-random.wasm") | |
| {:ok, agent} = Agent.start_link(fn -> nil end) | |
| {:ok, instance} = | |
| Wasmex.start_link(%{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const handler = require('serve-handler') | |
| const { createServer } = require('http') | |
| const launcher = require('chrome-launcher') | |
| const remoteInterface = require('chrome-remote-interface') | |
| let exitStatus = 0 | |
| const baseURL = 'http://localhost:6000' | |
| const server = createServer((request, response) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Fake immer | |
| /** @template T */ | |
| export class State { | |
| /** @typedef {function(T):void} Callback */ | |
| /** @typedef {function(): T} InitialValueFactory */ | |
| /** | |
| * @param {T | InitialValueFactory} initialValue | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { html, css, globalCSS } from './html.js' | |
| import { State } from './state.js' | |
| const isDraggingOver = new State(false) | |
| let runOnce = false | |
| isDraggingOver.onUpdate(newState => { | |
| const root = document.documentElement | |
| const dropzoneDisplay = newState ? 'block' : 'none' | |
| root.style.setProperty('--dropzone-display', dropzoneDisplay) |