View cn.ts
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 { twMerge, type ClassNameValue } from "tailwind-merge"; | |
export function cn(...inputs: ClassNameValue[]) { | |
return twMerge(inputs); | |
} |
View downloadAllImages.js
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
// https://www.smashingmagazine.com/2023/06/popular-devtools-tips/#5-download-all-images-on-the-page | |
$$("img").forEach(async (img) => { | |
try { | |
const src = img.src; | |
// Fetch the image as a blob. | |
const fetchResponse = await fetch(src); | |
const blob = await fetchResponse.blob(); | |
const mimeType = blob.type; | |
// Figure out a name for it from the src and the mime-type. |
View KeysOfValue.ts
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
export type KeysOfValue<T, TCondition = string> = { | |
[K in keyof T]: T[K] extends TCondition ? K : never; | |
}[keyof T]; |
View addAdditionalErrorMessage.ts
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 { getErrorMessage } from "./getErrorMessage.js"; | |
/** | |
* Adds additional error message to the existing error message. | |
* @param {unknown} error - The error object. | |
* @param {string} errorMessage - The additional error message to be added. | |
* @returns {string} - The updated error message. | |
*/ | |
export function addAdditionalErrorMessage( | |
error: unknown, |
View getAspectRatioLogoSize.ts
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 { isNonNullable } from "isNonNullable"; | |
export type GetFinalLogoSizeProps = { width: number; height: number; maxHeight: number; maxWidth: number }; | |
export const getFinalLogoSize = ({ width, height, maxHeight, maxWidth }: GetFinalLogoSizeProps) => { | |
if (isNonNullable(maxHeight) && !isNonNullable(maxWidth)) { | |
return { | |
width: Math.floor(width * (maxHeight / height)), | |
height: maxHeight, | |
}; |
View generateFontSubset.sh
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
# https://markoskon.com/creating-font-subsets/#minimal-english-subset | |
pyftsubset\ | |
Inter.var.woff2 \ | |
--output-file="Inter.var-english.woff2" \ | |
--flavor=woff2 \ | |
--layout-features="kern,liga,clig,calt,ccmp,locl,mark,mkmk,\ | |
onum,pnum,smcp,c2sc,frac,lnum,tnum,subs,sups,\ | |
cswh,dlig,ss01,ss03,zero"\ | |
--unicodes="U+0000-00A0,U+00A2-00A9,U+00AC-00AE,U+00B0-00B7,\ | |
U+00B9-00BA,U+00BC-00BE,U+00D7,U+00F7,U+2000-206F,U+2074,U+20AC,\ |
View asyncWrapper.ts
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 NextFunction, type Request, type Response } from "express"; | |
export type AsyncHandler = ( | |
request: Request, | |
response: Response, | |
next: NextFunction, | |
) => Promise<void>; | |
/** | |
* Wraps an asynchronous route handler function with error handling middleware. |
View delete lines before a particular word in a lint.sh
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
echo "words" | sed '/^words/,$!d' | |
sed '/^words/,$!d' input.txt > output.txt |
View extensions.json
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
{ | |
"recommendations": [ | |
"dbaeumer.vscode-eslint", | |
"esbenp.prettier-vscode", | |
"orta.vscode-jest", | |
"tlent.jest-snapshot-language-support", | |
"vespa-dev-works.jestrunit", | |
"vivaxy.vscode-conventional-commits", | |
"bradlc.vscode-tailwindcss", | |
"aaron-bond.better-comments", |
View settings.json
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
{ | |
// Add the below code to vscode user settings.json | |
"tailwindCSS.experimental.classRegex": [ | |
["tailwind.style\\(([^)]*)\\)", "\"([^\"]*)\""], | |
["tailwind.getColor\\(([^)]*)\\)", "\"([^\"]*)\""], | |
], | |
"tailwindCSS.experimental.configFile": "your/path/to/tailwind.config.js", | |
} |
NewerOlder