Skip to content

Instantly share code, notes, and snippets.

View malerba118's full-sized avatar

Austin Malerba malerba118

View GitHub Profile
import 'react-app-polyfill/ie11';
import * as ReactDOM from 'react-dom';
import {
theme,
ArrowLeftIcon,
ArrowRightIcon,
ArrowDiagonalIcon,
CollectionsIcon,
Dropdown,
} from '../';
const Item = () => {
const progress = useScrollProgress()
return <motion.div style={{ opacity: progress }} />
}
const App = () => {
return (
<Scroll.Section
start={{ section: 'start', container: 'center' }}
end={{ section: 'end', container: 'center' }}
@malerba118
malerba118 / table.tsx
Created April 6, 2023 15:55
Table Component
import { Box, Center, Flex, Grid, Stack, Text } from "@chakra-ui/react";
import React, { ReactNode } from "react";
export interface TableProps<T extends { id: string }> {
children: ReactNode;
data: T[];
emptyLabel?: string;
}
export interface ColumnDefinition {
import { BinstaClient } from 'binsta';
const FOLDER_ID = 'nw6iuC4rIK';
const binsta = new BinstaClient(process.env.API_TOKEN);
const file = await binsta.files.get('JZ7tbWj45g');
const root = await binsta.folders.get('root');
const untitled = await binsta.folders.create();
const photos = await binsta.folders.create({ name: 'photos' });
import {
Box,
IconButton,
IconButtonProps,
Tooltip,
useClipboard,
} from "@chakra-ui/react";
import React from "react";
import { BiCopy as CopyIcon, BiCheck as CopiedIcon } from "react-icons/bi";
import { Webhooks, Event } from "@resend/next";
// do signing secret check internally to verify entity calling endpoint
const webhooks = new Webhooks(process.env.RESEND_SIGNING_SECRET);
webhooks.on(Event.EmailDelivered, (data) => {
// data object is fully-typed according to event type
});
webhooks.on(Event.EmailOpened, (data) => {
@malerba118
malerba118 / tokenized-twitter-from-search.js
Created November 24, 2022 02:45
tokenized-twitter-from-search
// TLDR: simply copy/paste into dev console and then try some searches
const cmp = new Intl.Collator("en").compare;
const inf = Infinity;
const INTRA_BOUND = "[A-Za-z][0-9]|[0-9][A-Za-z]|[a-z][A-Z]";
const OPTS = {
// term segmentation & punct/whitespace merging
class PartSimulator {
terminals: TerminalSimulator[];
terminalsByGroup: Record<number, TerminalSimulator[]>;
terminalsByName: Record<string, TerminalSimulator>;
constuctor(part: db.types.Part) {
this.terminals = this.constructor.terminals.map((terminalDefinition) => {
return new TerminalSimulator({
...terminalDefinition,
const circuit = {
parts: [
{
id: "1",
type: "breadboard",
parentId: null,
position: {
x: 0,
y: 0,
z: 0,
import { useScroll } from 'framer-motion';
const Navbar = () => {
const scroll = useScroll();
const [timeRemaining, setTimeRemaining] = React.useState(readTime);
React.useEffect(() => {
return scroll.scrollYProgress.onChange((progress) => {
setTimeRemaining(Math.floor(readTime * (1 - progress)));
});