Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
nolanlawson / fake-indexeddb.js
Created Oct 19, 2020
Demo of emoji-picker-element working in Firefox private browsing
View fake-indexeddb.js
// Built version of fake-indexeddb using Browserify
// browserify -r fake-indexeddb -s FakeIndexedDB
// Also patched to expose FDBKeyRange
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.FakeIndexedDB = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict'
@nolanlawson
nolanlawson / index.html
Created Oct 17, 2020
emoji-picker tooltip example
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>emoji-picker tooltip demo</title>
<style>
.tooltip:not(.shown) {
display: none;
}
</style>
@nolanlawson
nolanlawson / index.html
Last active Jul 9, 2020
Demo heap snapshot retainment
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo heap snapshot retainment</title>
</head>
<body>
<h1>Demo heap snapshot retainment</h1>
<button>Add a memory leak</button>
@nolanlawson
nolanlawson / index.html
Created Jun 4, 2020
Test cross-origin etag
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test cross-origin etag</title>
</head>
<body>
<h1>Test cross origin etag</h1>
<pre id="display"></pre>
<script>
@nolanlawson
nolanlawson / indexeddb-usage.sh
Last active Jun 27, 2020
Calculate IndexedDB disk usage on Ubuntu, for Firefox, Chrome, and Epiphany Browser
View indexeddb-usage.sh
#!/usr/bin/env bash
set -e
if [ -z "$1" ]; then
PORT=3000
else
PORT=$1
fi
View index.html
<html>
<head><title>test fonts</title></head>
<body>
<h1>test fonts</h1>
<h2 style="font-family: Helvetica">Helvetica</h2>
<h2 style="font-family: system-ui">system-ui</h2>
<h2 style="font-family: sans-serif">sans-serif</h2>
<h2 style="font-family: Arial">Arial</h2>
</body>
</html>
@nolanlawson
nolanlawson / spy-add-event-listener.js
Created Nov 24, 2019
Attempt to spy on addEventListener
View spy-add-event-listener.js
window.__numDomListeners = 0
function spyAddListener (proto) {
const addEventListener = proto.addEventListener
proto.addEventListener = function () {
window.__numDomListeners++
console.log('add', this, arguments)
return addEventListener.apply(this, arguments)
}
}
@nolanlawson
nolanlawson / index.html
Created Nov 3, 2019
Demo of a link with tabindex=-1
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<title>Demo of a link with tabindex=-1</title>
</head>
<body>
<h1>Demo of a link with tabindex=-1</h1>
<ul>
@nolanlawson
nolanlawson / index.html
Last active Oct 31, 2019
webpack bundle analyzer demo
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>pinafore [31 Oct 2019 at 8:2]</title>
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z
@nolanlawson
nolanlawson / .gitignore
Last active Oct 20, 2019
test-tesseract-webpack
You can’t perform that action at this time.