Skip to content

Instantly share code, notes, and snippets.

@haileyok
haileyok / migrate.js
Last active June 2, 2024 19:59
Migrate PDS script
import AtpAgent from '@atproto/api'
import { Secp256k1Keypair } from '@atproto/crypto'
import * as ui8 from 'uint8arrays'
const OLD_PDS_URL = 'https://bsky.social'
const NEW_PDS_URL = 'https://pds.haileyok.com'
const CURRENT_HANDLE = 'haileyok.com'
const CURRENT_PASSWORD = ''
const NEW_HANDLE = 'newphone.pds.haileyok.com'
const NEW_ACCOUNT_EMAIL = ''
@haileyok
haileyok / ZeegoWrapper.tsx
Last active February 19, 2024 21:34
Zeego Wrapper
import * as DropdownMenu from 'zeego/dropdown-menu';
import Ellipsis from './Ellipsis';
import { Pressable } from 'react-native';
interface IProps {
actions: ContextMenuActionGroup[];
size?: number;
children?: React.ReactElement;
}
@haileyok
haileyok / prefetch.ts
Created December 11, 2023 22:44
bsky feed prefetch
export const usePrefetchFeedImages = (): UsePrefetchFeedImages => {
const feedItems = useRef<any[]>([])
const highestPrefetchedIndex = useRef(0)
const previousLength = useRef(0)
/**
* As we scroll down, we want to prefetch images that are about to appear in the feed.
* 1. As new items come into view, we get the last viewable item's index
* 2. We then prefetch the next 4 items in the data. This includes: