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
const { readFileSync, writeFileSync, readdirSync } = await import('fs'); | |
const componentsToReplace = [ | |
"Snackbar", | |
"FormHelperText", | |
"ListItemSecondaryAction", | |
"ListItemButton", | |
"IconButton", | |
"ToggleButtonGroup", | |
"ToggleButton", |
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 | |
if [ -z "$1" ] | |
then | |
echo "pass background color to replace transparency with!" | |
fi | |
mkdir output | |
# convert .svg's to .pngs and save them in `output` folder | |
for file in *.svg; do |
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 | |
# ask go.dev, what is the last version and grep/regex it out | |
GOLANG_VERSION=$(curl https://go.dev/dl/?mode=json | grep -oP '"version": "\K(go[\d|\.]+)' | head -1) | |
# download it | |
wget https://go.dev/dl/"$GOLANG_VERSION".linux-amd64.tar.gz | |
# nuke existing go installation | |
rm -rf /usr/local/go | |
# unpack new version | |
tar -C /usr/local -xzf "$GOLANG_VERSION".linux-amd64.tar.gz |
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 { useEffect, useState } from "react"; | |
import { useQueryState, type UseQueryStateOptions } from "next-usequerystate"; | |
export const useSsrSafeQueryState = <T,>( | |
key: string, | |
options: UseQueryStateOptions<T> & { defaultValue: T } | |
) => { | |
const [queryState, setQueryState] = useQueryState<T>(key, options); | |
const [isFirstRender, setIsFirstRender] = useState<boolean>(true); |
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 { Snackbar, type SnackbarProps } from "@mui/joy"; | |
import type { FC } from "react"; | |
import { create } from "zustand"; | |
const useSnackbarStore = create<{ | |
props: Omit<SnackbarProps, "open" | "key">; | |
key: number; | |
open: boolean; | |
}>(() => ({ props: {}, key: 0, open: 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
import { type MutableRefObject, type Ref, useCallback } from "react"; | |
export const useCombinedRefs = <T,>(...refs: Ref<T>[]) => | |
useCallback( | |
(element: T) => | |
refs.forEach((ref) => { | |
if (!ref) return; | |
if (typeof ref === "function") { | |
ref(element); |