Skip to content

Instantly share code, notes, and snippets.

I really like dogs. They are so fun to play with, simple to care for, and cute.

Jack Giffin anonyco

I really like dogs. They are so fun to play with, simple to care for, and cute.
View GitHub Profile
anonyco / Undo And Redo Mutation Observer Records.js
Last active Apr 22, 2020
This sample code snippet demonstrates how to undo and redo a MutationRecord observed by a MutationObserver
View Undo And Redo Mutation Observer Records.js
//(function(){"use strict";
var Object_freeze = Object.freeze;
* @param {!Array<MutationRecord>} mutationRecords
* @return {undefined}
function redoMutations(undidMutations) {
if (undidMutations) for (var i=undidMutations.length|0, record, type, target, addedNodes, removedNodes, nextSibling, value; i; ) {
anonyco / staticCSSSnapshot.console.js
Created Aug 7, 2019
Quick & dirty way to inline all of the CSS on a page into style attributes from the console.
View staticCSSSnapshot.console.js
const setProps = new WeakMap;
for (const ele of document.getElementsByTagName("*"))
setProps.set(ele, new Set);
function parseRules(ruleSet) {
for (const rule of ruleSet)
if (rule.type === 1) { // STYLE_RULE
for (const ele of document.querySelectorAll(rule.selectorText)) {
const setObj = setProps.get(ele);
anonyco / condensedValidJSVariableName.regex
Created Aug 19, 2018
Condensed javascript variable name validator regex (at the cost of speed)
View condensedValidJSVariableName.regex
anonyco / CodeMirror.Destroy().js
Created Jul 30, 2018
A Destroy Method On All CodeMirror Objects To Ensure Garbage Collection
View CodeMirror.Destroy().js
if (!CodeMirror.prototype.destroy) (function(){
// A destroy extension. Absolutely positively beyond a shadow of a doubt obliterate a CodeMirror instance from memory.
function hasExclusion(stringArr, regexpArr){
return function(exclusion){
var iSA = stringArr.length, cur = null, iEL = 0, iC = 0, iRA = regexpArr.length;
if (isRegExp(exclusion)){
while (iRA--)
if (regexpArr[iRA].source === exclusion.source && regexpArr[iRA].flags === exclusion.flags)
return iRA;
} else {
anonyco / varName.js
Last active Apr 22, 2020
Efficient Javascript Valid Variable Name Helper Functions
View varName.js
// This file aims to provide a quick, fast, small-as-possible-while-avoiding-encoding-errors solution for those who
// are interested in parsing javascirpt files using javascript. What this does do is it determines whether a string
// is a valid javascript variable name according to the variable name's code points. What this script does not do is
// determine whether or not that variable is already a reserved keyword. If you need that check, then look elsewhere.
// NOTE: This is the unminified file-part. To use this file, place this file INSIDE the global IIFE around your code
// before any calls to it. But, don't distribute it just yet. The source code is rather large. Instead, you must
// minify it before you incorperate it into the end product website using the closure compiler. Online access to the
// Closure Compiler can be found at