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 service = 'firestore.googleapis.com'; | |
// Note: We avoid importing firebase-functions because we don't want to slow down startup times. | |
type Change<T> = any; | |
type DocumentSnapshot = any; | |
type EventContext = any; | |
type CloudFunction<T> = any; | |
/** | |
* Creates an onWrite function for use as a Firestore onWrite callback. Replaces functions.firestore.document().onWrite(). | |
* @param projectId the Firebase project id for the entire project (e.g. "foo-123"). | |
* @param path a Firestore path such as "usernames/{username}" |
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 { | |
Dispatch, | |
SetStateAction, | |
useCallback, | |
useEffect, | |
useState, | |
} from 'react'; | |
const isFunction = (fn: unknown): fn is Function => (typeof fn === 'function'); |
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 {useEffect, useRef} from "react"; | |
/** | |
* Prefer this to react-use. We're deprecating react-use later. | |
* Returns `value` from the previous render. | |
*/ | |
export function usePrevious<T>(value: T, initialValue?: T) { | |
const ref = useRef<T | undefined>(initialValue); | |
useEffect(() => { | |
ref.current = 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
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" | |
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; | |
if( $found ){ | |
$remoteport = $matches[0]; | |
} else{ | |
echo "The Script Exited, the ip address of WSL 2 cannot be found"; | |
exit; | |
} |
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
# These domains were available as of about 2 days ago. Best of luck! | |
https://www.namecheap.com/domains/registration/results/?domain=a7.gg | |
https://www.namecheap.com/domains/registration/results/?domain=a8.gg | |
https://www.namecheap.com/domains/registration/results/?domain=b6.gg | |
https://www.namecheap.com/domains/registration/results/?domain=b7.gg | |
https://www.namecheap.com/domains/registration/results/?domain=c8.gg | |
https://www.namecheap.com/domains/registration/results/?domain=d7.gg | |
https://www.namecheap.com/domains/registration/results/?domain=d8.gg | |
https://www.namecheap.com/domains/registration/results/?domain=e0.gg | |
https://www.namecheap.com/domains/registration/results/?domain=e5.gg |
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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
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
#!/usr/bin/env bash | |
# Credit to keraion for huge readability improvements and parallelization. | |
set -e | |
# Creates webp / avif images for images that don't already exist and places them in the public folder | |
# This script can take a while to run | |
# Install deps | |
# sudo apt-get install -f webp ffmpeg |
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 { | |
createStyles, | |
makeStyles, | |
Tooltip, | |
Typography, | |
TypographyProps, | |
} from '@material-ui/core'; | |
import clsx from 'clsx'; | |
import React, {CSSProperties, useCallback, useState} from 'react'; | |
import useResizeObserver from 'use-resize-observer'; |
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 * as fs from "fs"; | |
function readFile(path: number) { | |
const result = | |
fs.readFileSync(`/home/acorn/projects/js/foony/scripts/src/aoc/${path}.txt`, 'utf-8').split('\r\n'); | |
for (let i = result.length - 1; i >= 0; --i) { | |
if (!result[i].trim()) { | |
--result.length; // Last line is empty, remove it | |
} else { | |
return result; |
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 {SetStateAction, useCallback} from 'react'; | |
import {create} from "zustand"; | |
export type EqualityFn<T> = (left: T | null | undefined, right: T | null | undefined) => boolean; | |
export type StoreType<State> = { | |
use<K extends keyof State>( | |
key: K, | |
defaultValue?: State[K], | |
equalityFn?: EqualityFn<State[K]>, |
OlderNewer