Skip to content

Instantly share code, notes, and snippets.

View reboottime's full-sized avatar
🎯
Focusing

Kate, Z reboottime

🎯
Focusing
  • Rochester, NY
View GitHub Profile
// mock GET /organizations, to get the current company metadata
await page.route('**/dashboard/v1/company', (route) => {
apis.getCurrentCompany(route);
});
// mock PUT /organizations, to update the company metadata
await page.route('**/dashboard/v1/company', (route) => {
apis.getCurrentCompany(route);
});
@reboottime
reboottime / test download file
Created June 11, 2024 00:18
playwright test downloading file
test('Downloads report', async ({ page }) => {
const downloadPromise = page.waitForEvent('download');
await page.getByRole('button', { name: 'Download Report' }).click();
const download = await downloadPromise;
const expectedFileName = report.name + '.pdf';
expect(download.suggestedFilename()).toBe(expectedFileName);
test.describe('Upload Organization Logo', () => {
let fileChooserPromise: Promise<FileChooser>;
test.beforeEach(async ({ page }) => {
fileChooserPromise = page.waitForEvent('filechooser');
await page
.getByRole('button', { name: 'Select Company Logo' })
.click();
});
@reboottime
reboottime / tsx
Created August 18, 2023 13:59
StepperForm
import { Button, Group, Paper, Stepper, Title, } from "@mantine/core";
import { useForm } from "@mantine/form";
import { useEffect, useMemo, useState } from "react";
export default function DemoForm() {
// Initialize the root form using the useForm hook
const {
setValues: setFormValues,
setFieldValue,
values: formValues,
import { type NotificationProps } from '@mantine/core';
import { notifications } from '@mantine/notifications';
import { IconCheck, IconInfoCircle, IconX } from '@tabler/icons-react';
const toast = {
error: (message: string, options?: NotificationProps) => {
notifications.show({
...options,
color: 'red',
icon: <IconX size="1.1rem" />,
import HttpClient from 'whyfetch';
const API_KEY = process.env.NEXT_PUBLIC_ASSEMBLY_API_KEY;
const ASSEMBLY_BASE_URL = 'https://api.assemblyai.com/v2';
class Assembly {
private client: HttpClient;
constructor() {
this.client = new HttpClient(ASSEMBLY_BASE_URL, {
import React, { useRef, useEffect, RefObject, forwardRef } from "react";
interface FormProps {
onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
}
const Form = forwardRef<HTMLFormElement, FormProps>((props, ref) => {
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
console.log("Form submitted");
@reboottime
reboottime / eslint-config-for-ts-react-app
Last active April 9, 2023 01:22
my-eslint-configuration
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"react-app",
"react-app/jest",
"standard-with-typescript",
"plugin:react/recommended",