Skip to content

Instantly share code, notes, and snippets.

View TrevorSundberg's full-sized avatar

Trevor Sundberg TrevorSundberg

View GitHub Profile
@TrevorSundberg
TrevorSundberg / demo.gv
Last active April 9, 2019 22:12
Demo GraphViz file for inviz.
digraph
{
rankdir=LR;
I -> n;
n -> v;
v -> i;
i -> z;
I -> z;
i -> i;
v -> I
@TrevorSundberg
TrevorSundberg / download.js
Last active October 30, 2022 19:55
Download a file in JavaScript with Emscripten / WebAssembly.
function download(filenamePtr, dataPtr, size) {
const a = document.createElement('a')
a.style = 'display:none'
document.body.appendChild(a)
const view = new Uint8Array(Module.HEAPU8.buffer, dataPtr, size)
const blob = new Blob([view], {
type: 'octet/stream'
})
const url = window.URL.createObjectURL(blob)
a.href = url