Skip to content

Instantly share code, notes, and snippets.

😜
Howdy

Thomas Aylott subtleGradient

😜
Howdy
Block or report user

Report or block subtleGradient

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
View download Jira backlogs as JSON bookmarklet.js
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
View download outerHTML.js
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 Feb 6, 2020
useRootLayerDomNode RootLayer
View useRootLayerDomNode.js
// @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);
View useRootClassList.js
// @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);
View aop-youtube-video-page-to-roam-md.js
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.
View yt-open-transcript.js
javascript: (async () => {
const TOP = window.opener || window.top;
const document = TOP.document;
function nextFrame() {
return new Promise(done => {
requestAnimationFrame(done);
});
}
View youtube video list to roam Bookmarklet.js
javascript: (() => {
async function download(fileName, data) {
const content =
typeof data === "string" || data instanceof Blob
? data
: JSON.stringify(data);
const downloadURL = window.URL.createObjectURL(
new Blob([content], { type: "application/json" })
);
const anchor = document.createElement("a");
View 512-op-whatever.js
[...document.querySelectorAll('td img')]
.map((img) => [img, img.closest('td')])
.map(([img, td]) => [img, td.innerText || td.parentElement.nextElementSibling.cells[td.cellIndex].innerText])
.map(([img, text]) => [img.src, ...text.split(/\s+/).reverse()])
.map(([src, type, ...name]) => [type, name.reverse().join(' '), src])
@subtleGradient
subtleGradient / is-flow-fast.node.mjs
Last active Oct 4, 2019
git bisect script for checking if flow is slow
View is-flow-fast.node.mjs
#!/usr/bin/env node --experimental-modules
/* eslint-disable no-console */
import { execSync } from 'child_process';
process.env.ROOT_VIEW_PATH = `src/common/components/views/RootView.js`;
const exec = script => {
console.log(`$ ${script}`);
View waitForAllAPIs.cypress.js
Cypress.Commands.add('waitForAllAPIs', waitForAllAPIs);
let requestCount;
beforeEach(() => {
requestCount = 0;
cy.server({
onRequest() {
requestCount++;
You can’t perform that action at this time.