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
interface PaletteExampleProps { | |
palette: "light" | "dark"; | |
} | |
const PaletteExample = (props: PaletteExampleProps) => { | |
return ( | |
<div | |
className={`palette-${props.palette} bg-palette-paper text-palette-ink p-10`} | |
> | |
Palette {props.palette} |
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
#!/bin/sh | |
# Script to replace symlinked files with real files | |
# usage: ./replace-symlinks.sh my/folder | |
directory=$1 | |
parent_directory=$(dirname $directory) | |
temp_directory=$parent_directory/__temp |
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 crypto from "crypto"; | |
export const sanitize = (object: Record<string, unknown>, keysToHash: string[]): Record<string, unknown> => { | |
if (!object) { | |
return object; | |
} | |
const result: Record<string, unknown> = {}; | |
Object.entries(object).forEach(([key, value]) => { |
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
#!/bin/bash | |
# get directory of script | |
CONFIGS_DIR="$(git rev-parse --show-toplevel)/configs" | |
# get command to execute and the args to forward args | |
COMMAND="$1" | |
shift |
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
"use client"; | |
import React from "react"; | |
import { CacheProvider } from "@emotion/react"; | |
import createCache from "@emotion/cache"; | |
import { MantineProvider } from "@mantine/core"; | |
import { defaultTheme } from "@opsnoir/mantine-theme"; | |
import { useServerInsertedHTML } from "next/navigation"; | |
import { trpc } from "../utils/trpc"; |
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 React from "react"; | |
export const useOutsideClick = ( | |
refs: React.MutableRefObject<any>[], | |
callback: () => void | |
) => { | |
React.useEffect(() => { | |
const handleClick = (e: MouseEvent) => { | |
if ( | |
refs.every( |
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 "jest"; | |
import React from "react"; | |
let externalSetShouldLoadMore = null; | |
export const usePaginationTrigger = () => { | |
const [shouldLoadMore, setShouldLoadMore] = React.useState(false); | |
externalSetShouldLoadMore = setShouldLoadMore; |
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
#!/bin/sh | |
START=$(date '+%s') | |
TIMEOUT=$(($START + 30)) | |
echo "Waiting for server $1 to start..." | |
until $(curl --output /dev/null --silent --head --insecure $1); do | |
NOW=$(date '+%s') |
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
/* eslint-disable import/no-unresolved */ | |
import axios from 'axios'; | |
import prettyMs from 'pretty-ms'; | |
import report from './report.json'; | |
const assertEnvVar = (name: string) => { | |
if (!process.env[name]) { | |
throw new Error(`Environment variable ${name} is not set`); | |
} |
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 findKeysWithNumericValue = (obj, keyPath = "") => { | |
const keys = Object.keys(obj) | |
const numericKeys = [] | |
const preKey = keyPath.length > 0 ? `${keyPath}.` : "" | |
for (let k of keys) { | |
const value = obj[k] | |
if (typeof value === "number") { | |
numericKeys.push(`${preKey}${k}`) | |
} else if (typeof value === "object") { |
NewerOlder