Skip to content

Instantly share code, notes, and snippets.

View alex-grover's full-sized avatar
Making coffee

Alex Grover alex-grover

Making coffee
View GitHub Profile
@alex-grover
alex-grover / heap.ts
Last active March 25, 2025 21:09
TS heap implementation
/**
TS heap implementation for use during coding interviews.
Sources:
https://stackfull.dev/heaps-in-javascript - bug in heapify function, needs to run in reverse
https://github.com/ignlg/heap-js/blob/c6bce4c1a3b1cc17d9494731dc2a598e86f67a24/src/Heap.ts
https://dandkim.com/js-heap-implementation/
CPython `heapq` stdlib: https://github.com/python/cpython/blob/3.13/Lib/heapq.py
*/
const response = await fetch(
'https://io.dexscreener.com/dex/pair-details/v3/base/0xc4ecaf115cbce3985748c58dccfc4722fef8247c',
{
headers: {
accept: '*/*',
'accept-language': 'en-US,en;q=0.9',
priority: 'u=1, i',
'sec-ch-ua':
'"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"',
'sec-ch-ua-mobile': '?0',
@alex-grover
alex-grover / dc.js
Last active November 30, 2024 21:44
Warpcast Direct Cast Script
// Get a developer API key from https://warpcast.com/~/developers/api-keys
const API_KEY = ''
// Update message
const message = ''
// Update with recipient FIDs
const fids = [10259]
for (const fid of fids) {
@alex-grover
alex-grover / address-validator.ts
Last active January 14, 2025 08:05
Zod + Viem
import { getAddress } from 'viem'
import { z } from 'zod'
export const address = z
.string()
.transform((val, ctx) => {
try {
return getAddress(val.toLowerCase())
} catch {
ctx.addIssue({
@alex-grover
alex-grover / .lintstagedrc.js
Last active March 13, 2024 17:27
Run `next lint` via `lint-staged` in a monorepo
import path from 'path'
import util from 'util'
import child_process from 'child_process'
const exec = util.promisify(child_process.exec)
const projectDirname = 'web' // Update with the path to your Next.js project
const buildEslintCommand = async (filenames) => {
// `next lint` just silently ignores file inputs if the file doesn't exist,