Skip to content

Instantly share code, notes, and snippets.


Tom Golden tbjgolden

View GitHub Profile
View hard-reset.css
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
caption, article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
tbjgolden /
Created Oct 12, 2020
[Arch Linux] [Manjaro] How to avoid "Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)

To avoid this error, we need to increase the inotify watcher limit.

The way to do this is different on Arch based distributions than other Linux distributions.

Instructions for Arch Linux/Manjaro

Check for an already existing inotify config file (recent versions of Manjaro include one)

tbjgolden /
Last active May 31, 2020
How to use optionalDependencies in a Rollup library (with ES and TS examples)

Using csso as the example library I'm making an optional dependency

ES Module example (file.js)

let csso = globalThis && globalThis.csso
if (!csso) {
    .then(_csso => {
      csso = _csso.default
tbjgolden /
Created Apr 26, 2020
Low-effort, high-reward browserlist config to avoid vendor prefix hell

Low-effort, high-reward browserlist config to avoid vendor prefix hell

(Stats used from 2020-04-26)

chrome >= 79, and_chr >= 81, safari >= 13, ios_saf >= 12.4, firefox >= 73

...or more generally

tbjgolden / Queue.ts
Created Apr 11, 2020
Fast implementation of a queue in TypeScript/JavaScript
View Queue.ts
class Queue {
private readonly queue: any[];
private start: number;
private end: number;
constructor(array: any[] = []) {
this.queue = array;
// pointers
this.start = 0;
tbjgolden / css-shorthand-map.json
Created Mar 21, 2020
JSON map from CSS shorthand properties to their sub-properties
View css-shorthand-map.json
"animation": [
tbjgolden / bitwardenTidy.js
Last active Dec 1, 2019
Import bitwarden export json, interactive deduplicate and export bitwarden import json
View bitwardenTidy.js
const fs = require('fs');
const path = require('path');
const inquirer = require('inquirer');
const uuidv4 = require('uuid/v4');
const owasp = require('owasp-password-strength-test');
const words = new Set([...require('wordlist-english')['english/10'], ...require('wordlist-english')['english/20']]);
const thingsIDontDoAnyMore = require("./thingsIDontDoAnyMore.json");
const { items } = require('./bitwarden_export_file.json');
tbjgolden / convert.js
Created Nov 8, 2019
A very short way to safely encode arbitrary data as an id friendly, url safe slug
View convert.js
// For node and pre-babel src
const toSafeSlug = str => "_" + encodeURIComponent(str)
.replace(/[.!~*'()_-]/g, match => `%${match.charCodeAt(0).toString(16)}`.toUpperCase())
.replace(/%/g, "_");
const fromSafeSlug = str => decodeURIComponent(str.substring(1).replace(/_/g, "%"));
// ES5 friendly
tbjgolden / debounce.js
Created May 8, 2019
Lightweight JS promise debounce
View debounce.js
const debounce = (func, ms = 500) => {
let timeout;
return function(...args) {
return new Promise(resolve => {
timeout = setTimeout(() => {
}, ms);
tbjgolden / withWindowWidth.jsx
Created May 8, 2019
withWindowWidth React Higher Order Component (HOC) using Hooks
View withWindowWidth.jsx
import React, { useState, useEffect, useRef } from 'react';
window.windowWidthListeners = window.windowWidthListeners || {};
window.prevWidth = window.prevWidth || window.innerWidth;
window.addEventListener('resize', () => {
if (window.prevWidth !== window.innerWidth) {
window.prevWidth = window.innerWidth;
Object.values(window.windowWidthListeners).forEach(fn => fn(window.prevWidth));
You can’t perform that action at this time.