type Payload = { username: string; password: string }
import { useForm, FormProvider } from 'react-hook-form'
function Form() {
const methods = useForm<Payload>({
mode: 'all',
});
This file contains hidden or 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
| local utils = require("gist.core.utils") | |
| local M = {} | |
| -- @param filename string UNSUPPOTED | |
| -- @param content string|nil UNSUPPOTED | |
| -- @param description string UNSUPPOTED | |
| -- @param private boolean UNSUPPOTED | |
| function M.create(_, content, _, _) | |
| local config = require("gist").config.platforms.termbin |
This file contains hidden or 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
| -- Set buffer to be readonly | |
| vim.api.nvim_buf_set_option(buf, "readonly", true) | |
| vim.api.nvim_buf_set_option(buf, "modifiable", false) | |
| vim.api.nvim_buf_set_name( | |
| buf, | |
| string.format("gist://%s/%s", gist.hash, gist.name) | |
| ) | |
| -- Set winbar | |
| local winbar = string.format("%%=GIST `%s` [READ-ONLY]", gist.name) |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| ## Usage | |
| # better_cat <file> | |
| # better_cat package.json -r '[.name, .version] | join("@")' | |
| # better_cat README.md | |
| if [ -z "$1" ]; then | |
| echo "Usage: better_cat <file>" | |
| exit 1 |
This file contains hidden or 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
| WITH | |
| query_embedding AS ( | |
| SELECT ai.openai_embed( | |
| 'text-embedding-3-small', | |
| ${query}, | |
| ${OPENAI_API_KEY} | |
| ) AS embedding | |
| ), | |
| scored AS ( | |
| SELECT |
This file contains hidden or 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 | |
| # List uncommitted changes and | |
| # check if the output is not empty | |
| if [ -n "$(git status --porcelain)" ]; then | |
| # Print error message | |
| printf "\nError: repo has uncommitted changes\n\n" | |
| # Exit with error code | |
| exit 1 | |
| fi |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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; |
NewerOlder