Skip to content

Instantly share code, notes, and snippets.

// @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);
});
}
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");
@subtleGradient
subtleGradient / 512-op-whatever.js
Last active November 15, 2022 12:51
All 512 types! OP --
[...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 October 4, 2019 17:12
git bisect script for checking if flow is slow
#!/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}`);
Cypress.Commands.add('waitForAllAPIs', waitForAllAPIs);
let requestCount;
beforeEach(() => {
requestCount = 0;
cy.server({
onRequest() {
requestCount++;
[...$$('img')].map(img => {
const imageFilename = img.getAttribute('src');
const [type, ...name] = img.parentNode.parentNode.parentNode.parentNode.nextSibling.nextSibling.textContent.trim().split('\n').map(string=>string.trim()).reverse();
return `cp '${imageFilename}' '${name.reverse().join(' ')}.${imageFilename.split('.').reverse()[0]}'`;
}).join('\n')
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\EOS Utility]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\DPP]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\ZoomBrowser EX]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\PhotoStitch
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\EOS Capture]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Canon\EOSViewerUtility]
[HKEY_LOCAL_MACHINE\SOFTWARE\Canon\ZoomBrowser EX\Install]
package com.subtlegradient.android.thinpushclient;
import java.io.File;
import java.lang.reflect.Method;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;