Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
nolanlawson / how-to-link-two-android-projects.md
Last active January 17, 2024 16:04
How to link an Android app to a local library project
@nolanlawson
nolanlawson / couchdb_changes.md
Last active December 21, 2023 03:22
Anatomy of the CouchDB changes feed

Anatomy of the CouchDB changes feed

I just spent a lot of time finally understanding CouchDB's changes feed, so I thought I'd do a short writeup here.

The mystery

Let's imagine the following changes to the database. There are two documents, A and B:

_id seq rev winner?
@nolanlawson
nolanlawson / why_we_dropped_lerna_from_pouchdb.md
Last active December 13, 2023 10:56
Why we dropped Lerna from PouchDB

Why we dropped Lerna from PouchDB

We dropped Lerna from our monorepo architecture in PouchDB 6.0.0. I got a question about this from @reconbot, so I thought I'd explain our reasoning.

First off, I don't want this post to be read as "Lerna sucks, don't use Lerna." We started out using Lerna, but eventually outgrew it because we wrote our own custom thing. Lerna is still a great idea if you're getting started with monorepos (monorepi?).

Backstory:

@nolanlawson
nolanlawson / .gitignore
Created December 10, 2023 18:03
Svelte createRoot with reused props issue (Svelte v4)
bundle.js
bundle.js.map
node_modules
@nolanlawson
nolanlawson / .gitignore
Last active December 10, 2023 18:03
Svelte createRoot with reused props issue (Svelte v5)
bundle.js
bundle.js.map
node_modules
@nolanlawson
nolanlawson / index.html
Last active December 5, 2023 07:14 — forked from bemson/index.html
Web Worker via blob URL
<!doctype html>
<html lang="en">
<body>
<span id="output"></span>
</body>
<script>
(function () {
var workerBlob = new Blob(
[workerRunner.toString().replace(/^function .+\{?|\}$/g, '')],
{ type:'text/javascript' }
@nolanlawson
nolanlawson / index.html
Created November 30, 2014 14:53
IndexedDB test keyPath vs. unique index, using add() instead of put()
<html>
<body>
<h1>IndexedDB test keyPath vs. unique index, using add() instead of put()</h1>
<pre id="display"></pre>
<script src="index.js"></script>
</body>
</html>
@nolanlawson
nolanlawson / .gitignore
Last active September 26, 2023 12:27
Chrome style concatenation benchmark
node_modules
results.json
@nolanlawson
nolanlawson / index.html
Created August 25, 2017 17:49
iframe blob uri src
<!doctype html>
<html lang="en">
<body>
<iframe id="theIframe" width="400" height="600" sandbox="true"></iframe>
<script>
var html = '<html><h1>hello world!</h1></html>'
var blob = new Blob([html], {type: 'text/html'})
var url = URL.createObjectURL(blob)
theIframe.src = url
</script>
@nolanlawson
nolanlawson / index.html
Last active August 27, 2023 00:45
Putting and getting a plaintext attachment
<html>
<body>
<pre id="display"></pre>
<script src="//cdn.jsdelivr.net/pouchdb/latest/pouchdb.min.js"></script>
<script src="index.js"></script>
</body>
</html>