Skip to content

Instantly share code, notes, and snippets.

@samwillis
samwillis / y-pouchdb.ts
Last active December 20, 2023 23:11
(Alpha) PouchDB integration for Yjs
import * as Y from 'yjs'
import * as mutex from 'lib0/mutex.js'
import { Observable } from 'lib0/observable.js'
import PouchDB from 'pouchdb';
// This is the name of the top level Y.Map that is used to construct the main pouchDB
// JSON document.
const topDataYMapName = 'data';
@samwillis
samwillis / keybase.md
Created August 5, 2017 22:31
keybase.md

Keybase proof

I hereby claim:

  • I am samwillis on github.
  • I am samwillis (https://keybase.io/samwillis) on keybase.
  • I have a public key ASDaqwqQUM5wI96Yz_Q6Pot6Uq9pMkqfH90gGPWxGnnH5wo

To claim this, I am signing this object:

@samwillis
samwillis / storage.py
Last active December 10, 2019 21:17
Django Subresource Integrity
import base64
import hashlib
import json
import os
import posixpath
import re
from collections import OrderedDict
from urllib.parse import unquote, urldefrag, urlsplit, urlunsplit
from django.conf import settings
@samwillis
samwillis / use.py
Last active August 29, 2015 14:06
'use' Django template tag, a cross between 'include' and 'extends'.
from django.template.base import TemplateSyntaxError, Library, Node, Variable, token_kwargs
from django.template.loader import get_template
from django.template.loader_tags import BlockNode, BLOCK_CONTEXT_KEY, BlockContext
from django.utils import six
from collections import defaultdict
import contextlib
register = Library()