Skip to content

Instantly share code, notes, and snippets.

Algorithmic layouts

You are looking at the most important, and most abundant thing on the web. You can't see it, unfortunately, because it's very small… aaaaand it's invisible — so having a magnifying glass doesn't really help here. But still.

I'm talking, of course, about U+0020; not to be confused with the band U2, who are just as ubiquitous, but far less useful.

This unicode point, representing the humble space character, is between every word, in every run of text, on every page of the web. And it has a very special characteristic: it's not sticky like glue. If two words are neighbors but there's not enough room for both of them, the space will free the second word to wrap around and start a new line.

Before getting into flexible containers, viewport meta tags, and @media breakpoints this humble character is what makes the web fundamentally 'responsive'. That is: able to change the layout of its content to suit different devices, contexts, and settings. Browser text does this automa

@creationix
creationix / idb-dat-storage.js
Created August 8, 2017 22:40
A simple abstract-random-access implementation using indexed DB that takes advantage of hypercore's behavior or consistent boundaries/offsets.
/* eslint-env browser */
var Buffer = require('buffer').Buffer
var name = 'dat'
function withStore (type, block, callback) {
var req = indexedDB.open(name + '-db', 1)
req.onerror = () => callback(req.error)
req.onupgradeneeded = () => req.result.createObjectStore(name)
req.onsuccess = () => {
@marcan
marcan / bloom.py
Last active February 29, 2024 19:55
Simple Bloom filter implementation in Python 3 (for use with the HIBP password list)
#!/usr/bin/python3
#
# Simple Bloom filter implementation in Python 3
# Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
# Licensed under the terms of the MIT license
#
# Written to be used with the Have I been pwned? password list:
# https://haveibeenpwned.com/passwords
#
# Download the pre-computed filter here (968MB, k=11, false positive p=0.0005):
@Ravenstine
Ravenstine / aws-couchdb-setup.md
Last active April 19, 2024 15:03
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new

@twilson63
twilson63 / README.md
Last active February 28, 2019 17:24
Offline First Native Web Applications with couchdb or pouchdb

Building Offline First Native Web Applications

Creating Offline First Native Web Applications using PouchDB and CouchDB and replication is a nice approach to remove the challenges keeping the client database insync with the server database.

One thing that always comes up is security, and security is very important and should not be taken lightly. Using implementations like JWT or JsonWebToken and external authentication services like Auth0 and StormPath can create a solid pattern to keep your secrets off of your client.

Using JWT, when the user authenticates with the JWT Server, they receive a token, this token can be used to access