1 MyAddress | [email protected] |
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 { useActionData } from "@remix-run/react"; | |
import useFormReset from "~/hooks/useFormReset"; | |
import type { ActionFunction, LoaderArgs } from "@remix-run/server-runtime"; | |
import invariant from "tiny-invariant"; | |
import { prisma } from "~/db.server"; | |
import { requireUserId } from "~/session.server"; | |
import FormHeader from "~/components/UI/Forms/FormHeader"; | |
import { Form } from "@remix-run/react"; | |
import TextInput from "~/components/UI/Forms/Inputs/TextInput"; | |
import { updateItemSchema } from "~/models/item.server"; |
This file has been truncated, but you can view the full file.
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 { LazyResult, _reduceLazy } from "remeda/dist/commonjs/_reduceLazy.js"; | |
/** | |
* Perform left-to-right function composition. | |
* @param value The initial value. | |
* @param operations the list of operations to apply. | |
* @signature R.pipe(data, op1, op2, op3) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
</body> |
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
// let's say I want to find the most occurring year here | |
const years = [1999,1993, 1992, 1991, 1991, 1999, 1993, 1993] | |
// I can use a Record<number, number> to create a map like so | |
// {1999: 2, 1993: 3, 1992: 1, 1991: 2, } | |
const yearMap: Record<number, number> = {} | |
for(let year of years){ | |
if(year in yearMap){ |
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 { sumBy } from "remeda"; | |
import { Matrix, MatrixCell, MatrixPosition } from "./data-structures/matrix"; | |
const exampleText = await Bun.file("example.txt").text(); | |
const buildMatrix = (input: string) => | |
new Matrix(input.split("\n").map((n) => n.split(""))); | |
const tagValues = (input: Matrix<string>) => { | |
let count = 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
class SyncPromise<T> { | |
private value?: T; | |
private error?: any; | |
private isFulfilled: boolean = false; | |
private isRejected: boolean = false; | |
constructor(executor: () => T) { | |
try { | |
this.resolve(executor()); | |
} catch (e) { |
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 result = <T,E extends Error>(cb: () => T): [null, E] | [T, null] => { | |
try { | |
return [cb(), null] | |
} catch(e){ | |
return [null,e as E] | |
} | |
} | |
const failsSometimes = () => { | |
if(Math.random() > .5){ | |
throw new Error("Failed") |
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 Accordion = ( | |
{ | |
children, | |
show | |
} : { | |
children: ReactNode, | |
show: boolean | |
} | |
) => { | |
return show ? |
OlderNewer