Skip to content

Instantly share code, notes, and snippets.

[
{
"title": "[[Roam]] bug [[calc]] is busted",
"children": [
{
"string": "example",
"children": [
{
"string": "((quHdpjkF3)) is not 0",
"heading": 1,
#!/usr/bin/env bash
cd "$(dirname "$0")"
GIT_HEAD="$(git rev-parse --short HEAD)"
npm --no-git-tag-version version prerelease --preid="$GIT_HEAD"
npm publish --tag $GIT_HEAD
@subtleGradient
subtleGradient / machine.js
Last active April 27, 2020 20:32
Generated by XState Viz: https://xstate.js.org/viz
const cartStates = {
initial: 'loading',
states: {
loading: {
after: { 1000: 'viewing' },
},
viewing: {
on: {
CHECKOUT: 'processing',
},
@subtleGradient
subtleGradient / html table to markdown bookmarklet.js
Last active April 10, 2020 20:16
(basic) html table to markdown bookmarklet
prompt(
"BOOKMARKLET",
`javascript:void(${encodeURIComponent(() => {
MD = [...document.querySelectorAll("tr")]
.map(
(tr, index) =>
`|${[...tr.cells]
.map((td) => td.innerText.replace(/\n/g, "<br/>"))
.join("|")}|${
index === 0
bookmarklet = () =>
(async () => {
/*!
Copyright 2020 Thomas Aylott <oblivious@subtlegradient.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION O
@subtleGradient
subtleGradient / download outerHTML.js
Created February 7, 2020 01:24
download the current HTML
bookmarklet = () =>
(async () => {
/*!
Copyright 2020 Thomas Aylott <oblivious@subtlegradient.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION O
@subtleGradient
subtleGradient / useRootLayerDomNode.js
Last active February 6, 2020 20:31
useRootLayerDomNode RootLayer
// @flow
import { useLayoutEffect } from 'react';
const mountCountMap = new Map<string, number>();
const updateRootClassNameUsageCount = (className, calculateNewCount: (count: number) => number) => {
const oldCount = mountCountMap.get(className) || 0;
const count = calculateNewCount(oldCount);
mountCountMap.set(className, count);
// @flow
import { useLayoutEffect } from 'react';
const mountCountMap = new Map<string, number>();
const updateRootClassNameUsageCount = (className, setter: (count: number) => number) => {
const oldCount = mountCountMap.get(className) || 0;
const count = setter(oldCount);
mountCountMap.set(className, count);
bookmarklet = () =>
(async () => {
// https://gist.github.com/subtleGradient/9b1eb9b6356c861ee3b7395c11bab9d2
/*!
Copyright 2020 Thomas Aylott <oblivious@subtlegradient.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
javascript: (async () => {
const TOP = window.opener || window.top;
const document = TOP.document;
function nextFrame() {
return new Promise(done => {
requestAnimationFrame(done);
});
}