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": [ | |
"aaron-bond.better-comments", | |
"dbaeumer.vscode-eslint", | |
"esbenp.prettier-vscode", | |
"mgmcdermott.vscode-language-babel", | |
"streetsidesoftware.code-spell-checker", | |
"usernamehw.errorlens", | |
"vivaxy.vscode-conventional-commits" | |
] |
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 function isNotNullOrUndefinedOrEmpty<T>( | |
value: T | null | undefined, | |
): value is T { | |
switch (true) { | |
case value === null || value === undefined: | |
return false; | |
case typeof value === 'string': | |
return value.trim() !== ''; | |
case Array.isArray(value): | |
return value.length > 0; |
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
// Merges additional properties into an object, ensuring type consistency. | |
export const mergeProperties = <T, U>( | |
originalObject: T, | |
additionalProps: U, | |
): T & U => { | |
return { ...originalObject, ...additionalProps }; | |
}; |
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 ZodError } from 'zod'; | |
export const stringifyZodError = (error: ZodError): string => { | |
return error.issues | |
.map((issue) => { | |
const path = issue.path.join('.'); | |
const message = issue.message; | |
return `Currently facing issue with the field "${path}". ${message}`; | |
}) | |
.join('\n'); |
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 { faker } from "@faker-js/faker"; | |
import { promises as fs } from "fs"; | |
const users = Array.from({ length: 1000 }, (_, i) => ({ | |
name: faker.name.fullName(), | |
tel: faker.phone.number("###-###-####"), | |
img: faker.image.avatar(), | |
})).map((user) => { | |
const { name } = user; | |
const [firstName, lastName] = name.split(" "); |
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
function formatMinutesSeconds(time) { | |
return `${Math.floor(time / 60)}:${(time % 60).toString().padStart(2, "0")}`; | |
} |
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 WINNING_INDICES = [ | |
[0, 1, 2], | |
[0, 3, 6], | |
[0, 4, 8], | |
[1, 4, 7], | |
[2, 5, 8], | |
[2, 4, 6], | |
[3, 4, 5], | |
[6, 7, 8], | |
]; |
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 const getLenOfLongestSubstringWithoutRepeatingChars = ( | |
str: string, | |
): number => { | |
// If the string is empty, return 0 | |
if (str.length === 0) { | |
return 0; | |
} | |
// Start building a substring from the first character until we duplicate a character | |
return str |
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
<main className="flex h-screen items-center justify-center"> | |
<div className="border-gray mr-3 h-48 w-48 animate-spin rounded-full border-4 border-t-4 border-t-blue-300" /> | |
</main> |
NewerOlder