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> |
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
import { render, screen, within } from "@testing-library/react"; | |
import userEvent from "@testing-library/user-event"; | |
import App from "./App"; | |
import renderer from "react-test-renderer"; | |
const setup = () => { | |
render(<App />); | |
return screen.getByRole("table"); | |
}; |
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 PropTypes from "prop-types"; | |
import React from "react"; | |
export const UserContext = React.createContext(); | |
export default function UserContextProvider({ children }) { | |
const [currentUser, setCurrentUser] = React.useState( | |
JSON.parse(localStorage.getItem("user")) | |
); |
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
static class ConsoleIo | |
{ | |
internal static string PromptRequired(string message) | |
{ | |
var res = PromptUser(message); | |
while (string.IsNullOrEmpty(res)) | |
{ | |
View.DisplayHeader("Input requiredโ"); | |
res = PromptUser(message); | |
} |
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
/* Ultra lightweight Github REST Client */ | |
const token = 'github-token-here' | |
const githubClient = generateAPI('https://api.github.com', { | |
headers: { | |
'User-Agent': 'xyz', | |
'Authorization': `bearer ${token}` | |
} | |
}) | |
async function getRepo() { |