Skip to content

Instantly share code, notes, and snippets.

View marcustyphoon's full-sized avatar

marcustyphoon

  • 05:21 (UTC -07:00)
View GitHub Profile
/* ==UserStyle==
@name sidebar blogs
@namespace gist.github.com/marcustyphoon
@version 1.0.0
@description adds blog icon shortcuts to the sidebar
@author marcustyphoon
==/UserStyle== */
@-moz-document domain("tumblr.com") {
@media (min-width: 1162px) {
@marcustyphoon
marcustyphoon / cloudflare discord webhook.ts
Last active December 30, 2023 05:21
Tip: Cloudflare Workers don't save logs, so you can only access them in real time... unless you make a Discord webhook out of a muted channel in your personal server and send them over there!
// 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(
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];
}
(async () => {
/* globals tumblr */
let allBlogs = [];
let resource = '/v2/user/following';
while (resource) {
await Promise.all([
tumblr.apiFetch(resource).then(({ response: { blogs, links } }) => {
console.log(
\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
// ==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==
/*
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
}
<!DOCTYPE html>
<html>
<head>
<style>
/* setup */
div {
border: 2px solid black;
margin: 1ch;
padding: 1ch;
[...new Set([...document.querySelectorAll((await tumblr.getCssMap()).streamerName.map(className => `.${className}`).join(''))].map(el => el.textContent))].forEach(name => window.open(`/${name}`))
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)}}));