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
// I had to switch to `"types": ["@cloudflare/workers-types/experimental"]` in tsconfig.json to get this to typecheck. | |
let id: string, token: string; | |
export const logAndWebhook = (message: string) => { | |
console.info(message); | |
navigator.sendBeacon( | |
`https://discord.com/api/webhooks/${id}/${token}`, | |
new Blob( |
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
const isObject = (value) => value && typeof value === 'object' && !Array.isArray(value); | |
const deepMerge = (a, b) => { | |
const result = { ...a }; | |
Object.keys(b).forEach((key) => { | |
if (isObject(a[key]) && isObject(b[key])) { | |
result[key] = deepMerge(a[key], b[key]); | |
} else { | |
result[key] = b[key]; | |
} |
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
(async () => { | |
/* globals tumblr */ | |
let allBlogs = []; | |
let resource = '/v2/user/following'; | |
while (resource) { | |
await Promise.all([ | |
tumblr.apiFetch(resource).then(({ response: { blogs, links } }) => { | |
console.log( |
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
\s whitespace regex: [\r\n\t\f\v \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff] | |
\r <Carriage Return> (CR) | |
\n <End of Line> (EOL, LF, NL) | |
\t <Character Tabulation> (HT, TAB) | |
\f <Form Feed> (FF) | |
\v <Line Tabulation> (VT) | |
Space (SP) | |
\u00a0 No-Break Space (NBSP) | |
\u1680 Ogham Space Mark |
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 Tumblr Blog Subs Default | |
// @namespace gist.github.com/marcustyphoon | |
// @version 0.2 | |
// @description Forces the default Tumblr dashboard tab to "Blog Subs" | |
// @author marcustyphoon | |
// @match https://www.tumblr.com/* | |
// @grant none | |
// @noframes | |
// ==/UserScript== |
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
/* | |
The Firefox and Chromium developer consoles have a non-obvious effect when you | |
call console.log on an object that you mutate. Here's some example code to | |
illustrate this: | |
*/ | |
const myAccount = { | |
name: 'marcus', | |
balance: 0 | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
/* setup */ | |
div { | |
border: 2px solid black; | |
margin: 1ch; | |
padding: 1ch; |
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
[...new Set([...document.querySelectorAll((await tumblr.getCssMap()).streamerName.map(className => `.${className}`).join(''))].map(el => el.textContent))].forEach(name => window.open(`/${name}`)) |
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
tumblr.getCssMap().then((s=>{const o=(s,o)=>"📝"+o,t="•",c={};for(const[o,t]of Object.entries(s))for(const s of t)c[s]=o;const n=document.querySelectorAll(`[class]:not(.${t})`);for(const s of n){const n=[];for(const t of s.classList.values()){const s=c[t];s&&n.push(o(t,s))}s.classList.add(t,...n)}})); |
NewerOlder