Skip to content

Instantly share code, notes, and snippets.

@philholden
philholden / index.js
Last active February 11, 2024 02:39
Automerge WASM in Cloudflare Worker
import wasmBytes from "./automerge_wasm_bg.wasm";
import * as bg from "./automerge_wasm_bg.js";
const {create} = bg;
export interface Env {}
export default {
async fetch(request, env, ctx): Promise<Response> {
// async init cannot happen outside request
// see later for generating bg.imports
// paste in console of any https site to run (e.g. this page)
// sample arguments for registration
// https://fidoalliance.org/specs/fido-u2f-v1.1-id-20160915/fido-u2f-raw-message-formats-v1.1-id-20160915.html#authentication-response-message-success
var createCredentialDefaultArgs = {
publicKey: {
// Relying Party (a.k.a. - Service):
rp: {
name: "Acme"
},
import { clone } from "./clone";
function updateQueue() {
const _queue = [];
function add(update) {
_queue.push(update);
console.log("add", _queue);
_queue.sort((a, b) => a.updateNonce - b.updateNonce);
}
import React from 'react';
import {render} from 'react-dom'
import Todos from 'todos';
import EmbedlyWrapper from 'embedly'
const Embed = () => (
<EmbedlyWrapper>
<Todos />
</EmbedlyWrapper>
)
@philholden
philholden / esnextbin.md
Created September 15, 2016 19:12
esnextbin sketch
Verifying that +philholden is my blockchain ID. https://onename.com/philholden

Selective import as object proposal

Currently imports can be namespaced using import * as:

import * as foo from './fooCrud'
import * as bar from './barCrud'

// bundles:
// 8 functions
@philholden
philholden / index.js
Created April 11, 2016 09:57
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var ed = require('supercop.js')
var keypair = ed.createKeypair()