Skip to content

Instantly share code, notes, and snippets.

View mary-ext's full-sized avatar
💭
dreaming of bunnies

mary mary-ext

💭
dreaming of bunnies
View GitHub Profile
@mary-ext
mary-ext / twitter.txt
Last active December 9, 2024 08:43
make twitter good ublock filter
x.com##.css-175oi2r:has(> .css-175oi2r > [aria-label="Subscribe to Premium"])
x.com##.css-175oi2r:has(> .css-175oi2r > [aria-label="Subscribe to Premium to write your own longer posts"])
x.com##.css-175oi2r.r-1ifxtd0:has(> .css-175oi2r > .css-175oi2r > [aria-label="Timeline: Trending now"])
x.com##.r-1wvb978:style(font-feature-settings: initial !important)
x.com##[data-testid="AppTabBar_Home_Link"] ~ :is(a[href="/i/grok"], a[href="/i/premium_sign_up"], a[href="/i/verified-orgs-signup"])
x.com##div[role=dialog] > .css-175oi2r .css-175oi2r:has(> :is(a[href="/i/premium_sign_up"], a[href="/i/verified-orgs-signup"], a[href="/settings/monetization"], a[href^="https://ads.x.com/"], a[href="/jobs"]))
x.com##[data-testid="tweet"] .css-175oi2r:has(> a.css-175oi2r[href$="/analytics"])
x.com##[data-testid="UserName"] > div:has(a[href="/i/premium_sign_up"])
@mary-ext
mary-ext / youtube-music.txt
Last active August 8, 2024 11:37
make youtube music good ublock filter
! 72px = height of now playing bar
! 24px = spacing between now playing bar and mini player
! 226px = height of mini player
music.youtube.com##ytmusic-app-layout > #content, ytmusic-two-column-browse-results-renderer[is-bauhaus-web-album-detail-page-redesign-enabled], ytmusic-two-column-browse-results-renderer[is-bauhaus-web-playlist-detail-page-redesign-enabled]:style(padding-bottom: calc(72px + 24px * 2 + 226px) !important)
! the "default" page styling adds in a margin instead of padding
music.youtube.com##ytmusic-app-layout > #content:style(margin-bottom: 0px !important)
@mary-ext
mary-ext / web-console-formatter.ts
Last active August 15, 2024 14:50
JS console text formatter for web and Deno
export type FormatAttributes = {
'color'?: string;
'font-style'?: string;
'font-weight'?: string;
'text-decoration'?: string;
};
export interface FormattedContent {
children: string | (string | FormattedContent)[];
attrs: FormatAttributes;
@mary-ext
mary-ext / dids.csv
Created September 16, 2024 13:34
First 200k registered users on Bluesky
We can't make this file beautiful and searchable because it's too large.
did:plc:ragtjsm2j2vknwkz3zp4oxrd,2022-11-17T00:35:16.391Z
did:plc:l3rouwludahu3ui3bt66mfvj,2022-11-17T00:39:19.084Z
did:plc:vpkhqolt662uhesyj6nxm7ys,2022-11-17T01:04:43.624Z
did:plc:yk4dd2qkboz2yv6tpubpc6co,2022-11-17T01:07:13.996Z
did:plc:6uow4ajxchftgyvvppnqa6uj,2022-11-17T03:30:47.787Z
did:plc:oky5czdrnfjpqslsw2a5iclo,2022-11-17T06:31:40.296Z
did:plc:7axcqwj4roha6mqpdhpdwczx,2022-11-18T01:31:55.110Z
did:plc:6fktaamhhxdqb2ypum33kbkj,2022-11-18T03:23:32.417Z
did:plc:vzmlifz3ghar4cu2hj3srga2,2022-11-18T10:22:57.934Z
did:plc:jo6qdnxnyqdio6cq36xgc6tx,2022-11-18T11:41:49.052Z
@mary-ext
mary-ext / disposable-lock.ts
Last active September 22, 2024 09:04
Promise mutex/lock implemented with the Explicit Resource Management proposal
export const createLock = () => {
let promise = Promise.resolve();
return {
async acquire(): Promise<Disposable> {
const { promise: next, resolve } = Promise.withResolvers<void>();
const prev = promise;
promise = next;
await prev;
@mary-ext
mary-ext / utf8_to_utf16_map.ts
Last active October 16, 2024 00:38
utf8 to utf16 index map
// ty @retr0id
const getUtf8Size = (str: string, index: number): number => {
const code = str.codePointAt(index)!;
if (code <= 0x7f) {
return 1;
} else if (code <= 0x7ff) {
return 2;
} else if (code <= 0xffff) {
@mary-ext
mary-ext / App.vue
Created October 21, 2024 12:31
vue modal router thing
<script setup lang="ts">
import { computed } from 'vue';
import { type RouteLocationNormalizedLoaded as LoadedRouteLocation, RouterView, useRoute } from 'vue-router';
import { assert } from '~/utils/misc.ts';
const route = useRoute();
const handleModalRoute = (route: LoadedRouteLocation): LoadedRouteLocation => {
// on modal routes, we only want the actual modal itself to be rendered
@mary-ext
mary-ext / schema.json
Last active March 31, 2025 02:12
JSON schema for AT Protocol lexicon documents
{
"type": "object",
"properties": {
"lexicon": { "type": "number", "const": 1 },
"id": {
"type": "string",
"pattern": "^[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(\\.[a-zA-Z]([a-zA-Z]{0,61}[a-zA-Z])?)$"
},
"revision": { "type": "integer", "minimum": 0 },
"description": { "type": "string" },
import { type JSONContent } from '@tiptap/core';
import { graphemeLen } from '~/api/richtext/intl.ts';
import { type Facet, type FacetLink } from '~/api/richtext/types.ts';
const encoder = new TextEncoder();
type SerializedMarks = NonNullable<JSONContent['marks']>;
const findFeature = (marks?: SerializedMarks): FacetLink | undefined => {
@mary-ext
mary-ext / pinia-broadcasts.ts
Last active December 12, 2024 04:46
Broadcast and share Pinia states to other tabs
import isEqual from "fast-deep-equal";
import { PiniaPlugin, StateTree } from "pinia";
import { onScopeDispose } from "vue";
// Web Locks API have very good support at this point, but it's disabled by
// Safari when lockdown mode is disabled. Let's gracefully handle this by not
// doing any of that initialization broadcast when it's not present.
const locks = navigator.locks as LockManager | undefined;
const PREFIX = "pinia-broadcast:";