Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
subtleGradient / ignoreEscapeKey.js
Last active November 18, 2020 17:48
Ignore ESC macOS
// ==UserScript==
// @name Keep Full Screen
// @namespace http://superuser.com/q/315949
// @description Prevents Escape key from leaving full screen.
// @include http://*
// @include https://*
// ==/UserScript==
document.documentElement.onkeydown = (event) => {
if (event.keyCode == 27) event.preventDefault();
console.log("Keep Full Screen");
@subtleGradient
subtleGradient / importUMD.js
Last active May 6, 2024 10:41
import(UMD)
export default async (url, module = {exports:{}}) =>
(Function('module', 'exports', await (await fetch(url)).text()).call(module, module, module.exports), module).exports
// ==UserScript==
// @name JW Image focus
// @namespace https://gist.github.com/subtleGradient/663a61bf1e9f04b00dd7943950128dcb
// @version 1.0.1
// @description Block 3rd party related images when doing Google image searches using site:jw.org
// @author Thomas Aylott
// @match https://www.google.com/search?*
// @grant none
// ==/UserScript==
@subtleGradient
subtleGradient / setWindow.cypress.js
Last active September 29, 2023 20:23
Test multiple popup windows and iframes with Cypress, including window.open
/*
The MIT License
Copyright 2020 Thomas Aylott <[email protected]>
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 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
[
{
"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 <[email protected]>
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 <[email protected]>
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