This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Draft<T extends object> { | |
private staged = false; | |
private committed = false; | |
private readonly immutable: Readonly<T>; | |
public readonly mutable: T; | |
private target: unknown; | |
protected pool: Pool; | |
public constructor (immutable: Readonly<T>, mutable: T, target: unknown, pool: Pool) { | |
this.immutable = immutable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type WorkerModule = Record<string, (...args: any) => any>; | |
export type Remote<T extends WorkerModule> = { | |
[K in keyof T]: ( | |
T[K] extends (...args: infer Args) => infer R | |
? (...args: Args) => (R extends Promise<any> ? R : Promise<R>) | |
: never | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Snow | |
// @version 1.0 | |
// @description Make it snow | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Override Trainer Sprite | |
// @match https://play.pokemonshowdown.com/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const style = document.createElement('style'); | |
style.textContent = '.trainer-near .trainersprite { background-image: url(https://i.imgur.com/yTfxwzF.png) !important; background-size: contain; transform: scaleX(1) !important; }'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Enlarge Pokemon Showdown Battle | |
// @match https://play.pokemonshowdown.com/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const style = document.createElement('style'); | |
const scale = 1.5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Revert Stack Exchange font stack | |
// @match https://*/* | |
// ==/UserScript== | |
document.head.appendChild( | |
Object.assign( | |
document.createElement('style'), | |
{ textContent: 'body{--ff-sans:Arial,"Helvetica Neue",Helvetica,sans-serif;--ff-serif:Georgia,Times New Roman,Times,serif;--ff-mono:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif;}' } | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* | |
* const fmt = formatDate('%dd-%MMM-%yy', 'en-US'); | |
* console.log(fmt(new Date())); // 18-Apr-20 | |
*/ | |
function formatDate (fmt, locales, defaultOptions) { | |
function formatPart (option, value, fallbackImpl, options = { [option]: value }) { | |
// lazily initialize format implementation | |
let formatImpl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name YouTube Subscription Sorter | |
// @version 0.3 | |
// @author Patrick Roberts | |
// @match https://www.youtube.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Stack Overflow Theme Toggle | |
// @version 0.1 | |
// @description Shortcut for Dark Mode on Stack Overflow | |
// @author Patrick Roberts | |
// @match https://stackoverflow.com/* | |
// @grant none | |
// ==/UserScript== | |
$(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Auto-MDN | |
// @namespace http://tampermonkey.net/ | |
// @version 3.3 | |
// @description Auto-complete MDN documentation links | |
// @author Patrick Roberts | |
// @match https://stackoverflow.com/* | |
// @grant GM_xmlhttpRequest | |
// @require https://cdn.jsdelivr.net/gh/mitchellmebane/GM_fetch@e9f8aa00af862665625500e2c2459840084226b4/GM_fetch.min.js | |
// @require https://cdn.jsdelivr.net/npm/diffhtml/dist/diffhtml.min.js |
NewerOlder