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 { useCallback, useRef } from "react" | |
| /** | |
| * Stable callback identity with always-fresh implementation. | |
| * @see https://github.com/facebook/react/issues/14099 | |
| */ | |
| export function useEventCallback<F extends (...args: never[]) => unknown>(fn: F): F { | |
| const ref = useRef(fn) | |
| ref.current = fn |
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 { createContext, useContext } from "react" | |
| import { RootLayoutData } from "src/data/types" | |
| export const pagePropsContext = createContext({}) | |
| export const PagePropsProvider = pagePropsContext.Provider | |
| export function usePageProps<T>() { | |
| return useContext<T & RootLayoutData>(pagePropsContext as any) | |
| } |
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
| :root { | |
| --ifm-color-scheme: light; | |
| /* Colors. */ | |
| --ifm-dark-value: 10%; | |
| --ifm-darker-value: 15%; | |
| --ifm-darkest-value: 30%; | |
| --ifm-light-value: 15%; | |
| --ifm-lighter-value: 30%; | |
| --ifm-lightest-value: 50%; |
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 { ReactElement } from "react"; | |
| export type RenderResult<P> = ReactElement<P, any> | null; | |
| export function serverComponent<P = {}>(fn: (props: P) => RenderResult<P> | Promise<RenderResult<P>>) { | |
| return fn as unknown as (props: P) => RenderResult<P>; | |
| } | |
| // or |
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
| export function download({ | |
| filename, | |
| content, | |
| contentType, | |
| }: { | |
| content: string | |
| contentType: string | |
| filename: string | |
| }) { | |
| const a = document.createElement("a") |
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
| # kind | |
| - Install go — https://go.dev/doc/install | |
| - Install kubectl — https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/ | |
| - Install kind — https://kind.sigs.k8s.io/docs/user/quick-start/#installing-from-release-binaries | |
| ``` | |
| kind create cluster --name playground | |
| kind get clusters | |
| kubectl cluster-info --context kind-playground |
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
| slugify () { | |
| echo "$@" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z | |
| } |
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
| # yarn | |
| # https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored | |
| .yarn/* | |
| !.yarn/patches | |
| !.yarn/plugins | |
| !.yarn/releases | |
| !.yarn/sdks | |
| !.yarn/versions |
NewerOlder