Skip to content

Instantly share code, notes, and snippets.

View Luukdegram's full-sized avatar

Luuk de Gram Luukdegram

  • The Netherlands
  • 18:30 (UTC +02:00)
View GitHub Profile
@dominictarr
dominictarr / await.js
Last active November 17, 2023 03:43
wasm zig async example
const fs = require('fs');
const source = fs.readFileSync("./await2.wasm");
const typedArray = new Uint8Array(source);
;(async function () {
var callback, frame
var buffer = Buffer.from("hello world!!!\n")
var result = await WebAssembly.instantiate(typedArray, {
env: {
print: function (ptr, len) {
@andrewrk
andrewrk / adapted_hash_maps.zig
Last active July 23, 2021 07:13
how to use hash map contexts to save memory when doing a string table
const std = @import("std");
const mem = std.mem;
const Foo = struct {
string_bytes: std.ArrayListUnmanaged(u8),
/// Key is string_bytes index.
string_table: std.HashMapUnmanaged(u32, void, IndexContext, std.hash_map.default_max_load_percentage),
};
const IndexContext = struct {