Skip to content

Instantly share code, notes, and snippets.


Jonathan Neal jonathantneal

View GitHub Profile
jonathantneal / color.js
Created Feb 19, 2021
color.js - a color utility useful in a NodeJS terminal, console, command prompt
View color.js
export default new Proxy(
reset: 0,
bold: 1,
dim: 2,
underline: 4,
blink: 5,
invert: 7,
hidden: 8,
black: 30,
View flex-gap-polyfill.js
c = d.createElement('b').style,
a = = 0,
polyfillList = new WeakMap,
ungapful = /^(normal|0px)+$/,
polyfillNode = element => {
if (polyfillList.has(element)) return
polyfillList.set(element, true)
jonathantneal /
Last active Nov 23, 2020
Installing Apps on M1

Before Starting

Install Command Line Tools for macOS:

xcode-select --install

Quick Installs

jonathantneal / createObjectUID.ts
Created Nov 5, 2020
Create a unique identifier from an Object URL
View createObjectUID.ts
/** Returns a unique identifier tied to the document in the window on which it was created. */
const createObjectUID = (): string => URL.createObjectURL(new Blob()).slice(-5)
jonathantneal / filteredObject.ts
Created Nov 5, 2020
filteredObject: Returns a new object with all entries that pass the test implemented by the provided function.
View filteredObject.ts
/** Returns a new object with all entries that pass the test implemented by the provided function. */
function filteredObject<T>(object: { [s: string]: T } | ArrayLike<T>, predicate: (value: T, name: string, array: [string, T][]) => unknown): { [s: string]: T } {
const newObject = Object.create(Object(object).prototype)
const entries = Object.entries(object)
for (const [name, value] of entries) {
if (predicate(value, name, entries)) {
Reflect.set(newObject, name, Reflect.get(object, name))
return newObject
jonathantneal /
Last active Sep 13, 2020
Create Fragment

Create Fragment

The createFragment function returns an HTML fragment from a string.

  { name: 'Hedral', coat: 'Tuxedo', legs: 4 },
  { name: 'Pillar', coat: 'Ticked Tabby', legs: 3 },
  (table, { name, coat, legs }) => {
View HTMLSelectorSlotElement.js
HTMLSelectorSlotElement = ((internal, filter) => class HTMLSelectorSlotElement extends HTMLElement {
constructor() {
internal.set(super(), [
this.attachShadow({ mode: 'open' }),
new MutationObserver(HTMLSelectorSlotElement.prototype.connectedCallback.bind(this)),
jonathantneal /
Created Sep 7, 2020
Fetching Web Platform Data in NodeJS

Fetching Web Platform Data in NodeJS

Should there be a need to fetch web platform data in NodeJS, here are some dependency-less functions that will return feature data from W3C, CanIUse, and MDN Browser Compatibility Data.

Dependency-Free Fetching in NodeJS

NodeJS includes an http and https library which can perform network requests.

const https = require('https')
View augmented.css.json
This file has been truncated, but you can view the full file.
"type": "Comment",
"value": "\n augmented-ui\n BSD 2-Clause License\n Copyright (c) James0x57, PropJockey, 2019\n",
"delimiterStart": "/*",
"delimiterEnd": "*/"
"type": "Space",