| Command | Description |
|---|---|
git blame -L 28,43 path/to/file |
Shows who modified each line in a specific range of a file. |
git blame -L :'class LocalFile' filepath |
Blames a block of code in a file matching a specific pattern. |
git log -L28,43:filepath |
Lists commits that last touched a specified region of a file. |
git blame -w |
Ignores whitespace changes in git blame. |
git blame -C |
Follows code movement across files in git blame. Can be used up to three ti |
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 { zodResolver } from "@hookform/resolvers/zod"; | |
| import { type UseFormProps, useForm } from "react-hook-form"; | |
| import { type z } from "zod"; | |
| /** | |
| * A wrapper around `useForm` that uses `zodResolver` as the resolver. | |
| * | |
| * @example | |
| * | |
| * const schema = z.object({ |
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
| enum ResultKind { | |
| OK = "Ok", | |
| ERR = "Err", | |
| } | |
| export type Result<T, E> = Ok<T> | Err<E>; | |
| interface ResultBase<A, E> { | |
| kind: ResultKind; | |
| map<B>(fn: (_: A) => B): Result<B, E>; |
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
| /** | |
| * A strategy for fetching data from the server. | |
| * | |
| * @callback FetchStrategy | |
| * @param {string} url - The URL to fetch data from. | |
| * @param {RequestInit} [options] - Additional options for the fetch request. | |
| * @returns {Promise<Response>} A promise that resolves to the fetch response. | |
| */ | |
| export type FetchStrategy = ( | |
| url: string, |
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
| /* The scrollbar-gutter CSS property allows authors to reserve space for the scrollbar, preventing unwanted layout changes as the content grows while also avoiding unnecessary visuals when scrolling isn't needed. */ | |
| /* https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-gutter */ | |
| .scrollbar { | |
| scrollbar-gutter: stable; | |
| } |
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
| // Credits to Matt Pocock | |
| type CreateAPIMethod = < | |
| TInput extends Record<string, string>, // The input | |
| TOutput // The output | |
| >(opts: { | |
| url: string; | |
| method: "GET" | "POST" | |
| }) = (input: TInput) = Promise<TOutput>; | |
| declare const createAPIMethod: CreateAPIMethod; |
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
| # Delete node_modules using fd (github.com/sharkdp/fd) | |
| fd -HI node_modules -X rm -rf |
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
| type Primitive = null | undefined | string | number | boolean | symbol | bigint; | |
| function isObject(item: unknown): item is Record<string, unknown> { | |
| return typeof item === 'object' && item !== null && !Array.isArray(item); | |
| } | |
| /** | |
| * Merge objects, second objects overwrites the keys of the first objects | |
| */ | |
| function deepMerge<T extends Record<string, unknown>, U extends Record<string, unknown>>(target: T, source: U): T & U { |
See how a minor change to your commit message style can make a difference.
Tip
Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs
OlderNewer