Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
pesterhazy / indexeddb-problems.md
Last active May 13, 2025 15:31
The pain and anguish of using IndexedDB: problems, bugs and oddities

This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).

Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.

Backing file on disk (WAL file) keeps growing (Safari)

When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.

Random exceptions when working with a large number of indexeddb databases (Safari)

// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Unlit/Directional Tint"
{
Properties
{
_MainTex("MainTex", 2D) = "white" {}
_Color("Color", Color) = (1,1,1,1)
_ColorA("ColorA", Color) = (1,1,1,1)
_ColorB("ColorB", Color) = (1,1,1,1)
@borkdude
borkdude / runner.cljs
Created November 9, 2021 13:37
Nbb browser test runner @ Nextjournal
(ns com.nextjournal.tests.browser.runner
(:require [clojure.string :as str]
[clojure.test :as t :refer [test-vars]]
[com.nextjournal.tests.browser.article-test-nbb :as article-test]))
(defmethod t/report [:cljs.test/default :begin-test-var] [m]
(println "===" (-> m :var meta :name))
(println))
(defn print-summary []
@bobbicodes
bobbicodes / example.cljs
Created December 3, 2021 10:02
Use Web Audio API with nbb
(ns example
(:require ["fs" :as fs]
["web-audio-api$default" :as wa]))
(def ^:dynamic context (wa/AudioContext.))
(set! (.-outStream context) (.-stdout js/process))
(fs/readFile "outfoxing.mp3"
(fn [err buffer]
(when err (throw err))
@retrogradeorbit
retrogradeorbit / Makefile
Last active May 16, 2024 16:25
Hot loading C wasm into the browser while preserving the state of the heap
CLANG_DIR = $(HOME)/clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04
CLANG = $(CLANG_DIR)/bin/clang
LLC = $(CLANG_DIR)/bin/llc
LD = $(CLANG_DIR)/bin/wasm-ld
C_SRC := $(wildcard src/c/*.c)
OBJ_SRC := $(patsubst %.c, %.o, $(C_SRC))
%.o: %.c # delete competing implicit rule
@adtac
adtac / Dockerfile
Last active May 16, 2025 08:58
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@adtac
adtac / README.md
Last active April 26, 2025 09:06
Using your Kindle as an e-ink monitor

3.5 fps, Paperwhite 3
@adtac_

step 1: jailbreak your Kindle

mobileread.com is your best resource here, follow the instructions from the LanguageBreak thread

I didn't really follow the LanguageBreak instructions because I didn't care about most of the features + I was curious to do it myself, but the LanguageBreak github repo was invaluable for debugging