Skip to content

Instantly share code, notes, and snippets.

Jonathan Neal jonathantneal

Block or report user

Report or block jonathantneal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jonathantneal
jonathantneal / README.md
Last active Dec 2, 2019
CSS Loose Object Model
View README.md

Loose CSS Object Model

The "Loose" CSS Object Model is a primative object model compatible with the CSS Syntax that preserves every single code point in CSS Objects without sacrificing the usability of those objects to a developer.

The core concept of the "loose" CSS object model is to separate all information into 2 kinds of objects; the CSSDetail and the CSSValue.

CSSDetail

The CSSDetail represents all whitespace and comments in CSS.

@jonathantneal
jonathantneal / README.md
Last active Nov 4, 2019
Surf with Friends - edge://surf
View README.md

Surf with Friends

Surfing is fun. But everything is even more fun with friends.

If you find yourself at edge://surf, be sure to switch to the Konami character selection, open Developer Tools, and try out some of these friends by entering one of the following commands:

Surf with Mario

`
@jonathantneal
jonathantneal / README.md
Created Oct 31, 2019
Naming Things is Hard: Opinionated 3 Letter Abbreviations
View README.md
3 Letter Shorthand Instance
arr Array
bol Boolean
cls class
doc Document
dte Date
ele Element
fun Function
nod Node
@jonathantneal
jonathantneal / Array.from.js
Created Oct 30, 2019
A tiny IE9+ Array.from polyfill
View Array.from.js
Array.from = function from(arrayLike) {
return Function.call.apply(Array.prototype[arguments.length > 1 ? 'map' : 'slice'], arguments);
}
@jonathantneal
jonathantneal / _define.js
Last active Sep 13, 2019
_define: Return an object with a property defined in a class prototype manner
View _define.js
// 209/154 byte/gzip
/**
* Return an object with a property defined in a class prototype manner
* @param {T} object object on which to define the property
* @param {String|Symbol} key name or symbol to be defined
* @param {Descriptor} proto descriptor for the property being defined
* @template T
* @return {T}
*/
@jonathantneal
jonathantneal / es5class.js
Created Sep 13, 2019
An ES5 Class Creator
View es5class.js
// 281 bytes:
/** Return a class with prototype values conditionally inheriting from a super class
* @param {string} name name of the class
* @param {Object<string,any>} prototype prototype values of the class
* @param {Function} [Super] super class inherited by the class
* @return {Function}
*/
function _class(name, prototype, Super) {
var Class = Function('_', 'return function ' + name + '(){return _(this,arguments)}')(
@jonathantneal
jonathantneal / _extends.js
Last active Sep 13, 2019
_extends: Extend a class with a super class
View _extends.js
// 128/122 byte/gzip
/** Extend a class with a super class
* @param {Function} Class - class inheriting from the super class
* @param {Function} Super - super class inherited by the class
* @example <caption>Yayay extends Array</caption>
* function Yaray() {}
* _extends(Yaray, Array)
*/
function _extends(Class, Super) {
@jonathantneal
jonathantneal / README.md
Last active Sep 12, 2019
Minimal Node Servers
View README.md

Minimal Node Servers

A collection of code snippets that create servers in as few steps as possible.

Minimal HTTP Server

// setup (61 bytes):
const http = require('http');
@jonathantneal
jonathantneal / getUnsupportedBrowsersByCaniuseId.js
Last active Jun 20, 2019
Return a list (`[]`) of all unsupported browsers (`"${browser} ${version}"`) by a caniuse id (`"${id}"`)
View getUnsupportedBrowsersByCaniuseId.js
const caniuse = require('caniuse-lite');
// return a list of all unsupported browsers by a caniuse id
function getUnsupportedBrowsersByCaniuseId (caniuseId) {
// get compressed feature details from caniuse-lite by a caniuse id
const featureDetails = caniuse.features[caniuseId];
// if the feature exists
if (featureDetails) {
// get browsers stats for the feature
You can’t perform that action at this time.