type Payload = { username: string; password: string }
import { useForm, FormProvider } from 'react-hook-form'
function Form() {
const methods = useForm<Payload>({
mode: 'all',
});
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# date (YYYY-MM-DD HH:MM:SS),percentage | |
datetime="$(date +%Y-%m-%d\ %H:%M:%S)" | |
memory_usage="$(ps -A -o %mem | awk '{ mem += $1 } END { print mem }')" | |
uptime="$(uptime | awk '{ print $3 }' | cut -d, -f1)" | |
# number only | |
battery_percentage="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given this type | |
type ResultSuccess<T> = { | |
data: T | |
success: true | |
} | |
type ResultFailure<E> = { | |
error: E | |
success: false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use client" | |
import { useMemo, useState } from "react" | |
import clsx from "clsx" | |
import { motion } from "framer-motion" | |
const OFFSET = 10 | |
function SingleMagicNumber({ | |
value, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ArrowNarrowDownIcon, ArrowNarrowUpIcon } from '@smartfish/icons'; | |
import { Column, flexRender, type Row, type Table } from '@tanstack/react-table'; | |
import clsx from 'clsx'; | |
import { useMemo } from 'react'; | |
import { forwardRef } from 'react'; | |
interface ICondensedTableProps<T> { | |
table: Table<T>; | |
onRowClick?: (row: Row<T>) => void; | |
stickyHeader?: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- data: VecDeque<T> | |
+ data: Mutex<VecDeque<T>> | |
+ cv: CondVar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
form.tsf:first-of-type { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
width: 100%; | |
} | |
#center_col { | |
max-width: 1240px; | |
width: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCalendar } from '@h6s/calendar'; | |
import { useMachine } from '@xstate/react'; | |
import { Button as AriaButton } from 'ariakit/button'; | |
import clsx from 'clsx'; | |
import { isSunday, isSameDay, addMonths, isFuture, isPast, setDate } from 'date-fns'; | |
import format from 'date-fns/format'; | |
import isWithinInterval from 'date-fns/isWithinInterval'; | |
import { FC, useCallback, useMemo } from 'react'; | |
import Select from '@components/forms/components/Select'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type IO<T, Input = never> = Input extends never ? () => T : (input: Input) => T; | |
export type InputType = 'text' | 'number' | 'password' | 'email' | 'date' | 'time' | 'datetime-local' | 'month' | 'week' | 'url' | 'search' | 'tel' | 'color'; | |
export type BaseInput<Shape extends object, Metadata = Record<string, any>> = { | |
placeholder?: string; | |
required?: string | boolean; | |
disabled?: string | boolean; | |
readonly?: string | boolean; | |
autofocus?: string | boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"PolymorphicFunctionComponent": { | |
"prefix": "fncpp", | |
"description": "React Function Component (Polymorphic)", | |
"body": [ | |
"import React from \"react\";", | |
"", | |
"interface PolymorphicProps<C extends React.ElementType> {", | |
"\tas?: C", | |
"}", |
NewerOlder