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() { |
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
string pangram = "The quick brown fox jumps over the lazy dog"; | |
string[] words = pangram.Split(' '); | |
foreach (string word in words) | |
{ | |
char[] chars = word.ToCharArray(); | |
Array.Reverse(chars); | |
string wordReversed = new string(chars); | |
Console.Write($"{wordReversed} "); | |
} |
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 curry = | |
(fn) => | |
// Rest into an array | |
(...args) => | |
// If we have enough arguments, call the function | |
args.length >= fn.length | |
? // Spread array into arguments | |
fn(...args) | |
: curry( | |
/** |
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 results = JSON.parse(data) | |
.map( | |
({ | |
"Transaction date": date, | |
Description: description, | |
Amount: amount, | |
}) => ({ | |
date, | |
description, | |
amount, |
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 buildPipeline = | |
(...fns) => | |
(x) => | |
fns.reduce((accV, fxn) => fxn(accV), x); |