Skip to content

Instantly share code, notes, and snippets.

View malerba118's full-sized avatar

Austin Malerba malerba118

View GitHub Profile
import { observable, makeObservable, runInAction, action } from "mobx";
import { HistoryManager } from "./history";
import { v4 as uuid } from "uuid";
type Constructor<T> = {
new (...params: any[]): T;
[x: string | number | symbol]: any;
};
type BaseData = {
export interface Project {
id: string;
video: MediaReference; // hosted video
preview_video: MediaReference; // hosted video
background: MediaReference;
speakers: Speaker[];
source_blueprint: {
id: string;
utterances: SourceUtterance[]
// actions
decomposeVideo({ src: 'video-url'}): SourceBlueprint
dub({ source_transcription, target_transcription, source_audio, voice_id }): MediaReference
recomposeVideo(targetBlueprint: TargetBlueprint): MediaReference
// types
interface SourceBlueprint {
video: MediaReference // hosted video
background_audio: MediaReference
// components/Tabs.tsx
import {
Tabs as ArkTabs,
TabList as ArkTabList,
TabTrigger as ArkTabTrigger,
} from '@ark-ui/react'
const tabs = defineMultipartRecipe({
name: 'tabs',
parts: ['root', 'list', 'trigger'],
// client
signIn().then((user) => {
axios.post('/users', user, { headers: { authorization: user.accessToken } })
})
// server
server.middleware((req, res) => {
if (req.headers.authorization) {
try {
const decoded = await firebase.verifyIdToken(req.headers.authorization)
type Book = {
id: string
image: string
title: string
description: string
duration: number // (milliseconds?)
audio: string
chapters: Chapter[]
}
{
"kind": "books#volumes",
"totalItems": 3633,
"items": [
{
"kind": "books#volume",
"id": "o_dvDwAAQBAJ",
"etag": "b9ADYZl9aVQ",
"selfLink": "https://content-books.googleapis.com/books/v1/volumes/o_dvDwAAQBAJ",
"volumeInfo": {
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 {