This file contains hidden or 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
import { PiniaPlugin, StateTree } from "pinia"; | |
const PREFIX = "pinia:"; | |
export interface PersistenceOptions<S extends StateTree> { | |
validate?: (state: StateTree) => state is S; | |
} | |
declare module "pinia" { | |
// eslint-disable-next-line no-undef, @typescript-eslint/no-unused-vars |
This file contains hidden or 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
! remove `session_id` tracking parameter from videos | |
! | |
! ideally this would've been a redirect from `video.bsky.app/watch/<did>/<cid>/playlist.m3u8` | |
! to `video.cdn.bsky.app/hls/<did>/<cid>/playlist.m3u8`, as the latter is the actual CDN while | |
! the former is the middleware, however: | |
! | |
! - the raw playlist will not contain webvtt, that's added in by the middleware | |
! - ublock doesn't have a rule that allows redirecting to non-local neutered resource | |
! | |
||video.bsky.app$removeparam=session_id |
This file contains hidden or 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
! disable rails turbolinks/hotwire turbo | |
! page load via turbo is considerably slower than html streaming | |
! this won't affect the file explorer as the nav is handled in react (which is fine) | |
github.com##+js(set-attr, body, data-turbo, false) | |
! font adjustments | |
github.com##body:style(--fontStack-system: sans-serif; --fontStack-sansSerif: sans-serif; --fontStack-monospace: monospace) | |
github.com##:is(body, .markdown-body, .PageHeader .PageHeader-titleWrap.PageHeader-titleWrap--medium):style(font-family: var(--fontStack-sansSerif) !important) | |
github.com##:is(tt, pre, code, samp, .text-mono, .react-code-text, .react-blob-print-hide, .blob-code-inner, .blob-num, .input-monospace, .file-info, .commit .sha-block, .commit .sha):style(font-family: var(--fontStack-monospace) !important) | |
github.com##:is(.markdown-body .highlight pre, .markdown-body pre):style(font-size: 12px !important) |
This file contains hidden or 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 split = (str: string, delimiter: string, limit: number): string[] => { | |
const result: string[] = []; | |
let last = 0; | |
while (--limit > 0) { | |
const index = str.indexOf(delimiter, last); | |
if (index === -1) { | |
break; | |
} |
This file contains hidden or 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
type Middleware<TParams extends any[], TReturn> = ( | |
...params: [...TParams, next: (...params: TParams) => TReturn] | |
) => TReturn; | |
const exhausted = () => { | |
throw new Error('middleware chain exhausted'); | |
}; | |
export const createMiddlewareRunner = <TParams extends any[], TReturn>( | |
middlewares: [...Middleware<TParams, TReturn>[], Middleware<TParams, TReturn>], |
This file contains hidden or 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
// #region Utility types | |
type RequiredKeysOf<TType extends object> = TType extends any | |
? Exclude< | |
{ [Key in keyof TType]: TType extends Record<Key, TType[Key]> ? Key : never }[keyof TType], | |
undefined | |
> | |
: never; | |
type HasRequiredKeys<TType extends object> = RequiredKeysOf<TType> extends never ? false : true; |
This file contains hidden or 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
type Procedure = (...args: any[]) => any; | |
type Methods<T> = keyof { | |
[K in keyof T as T[K] extends Procedure ? K : never]: T[K]; | |
}; | |
type Properties<T> = { | |
[K in keyof T]: T[K] extends Procedure ? never : K; | |
}[keyof T] & | |
(string | symbol); | |
type Classes<T> = { |
This file contains hidden or 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
import { batch, onCleanup } from 'solid-js'; | |
export type ResizeCallback = (entry: ResizeObserverEntry) => void; | |
interface ObserverStorage { | |
l: ResizeObserverEntry | undefined; | |
c: ResizeCallback | ResizeCallback[]; | |
} | |
const sym = Symbol('resize-observers'); |
This file contains hidden or 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 const followAbortSignal = (signals: (AbortSignal | undefined)[]) => { | |
const controller = new AbortController(); | |
const own = controller.signal; | |
for (let idx = 0, len = signals.length; idx < len; idx++) { | |
const signal = signals[idx]; | |
if (!signal) { | |
continue; | |
} |
This file contains hidden or 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
bsky.app##+js(user-bsky-suggestions-block.js) | |
main.bsky.dev##+js(user-bsky-suggestions-block.js) |