Skip to content

Instantly share code, notes, and snippets.

interface Foo {
x: number;
}
const Component = () => {
const foo: Foo = useBar();
React.useEffect(() => {
// hook using foo.x
}, [foo]);
const useBar = () => {
// some code to get the value of x
return {
x,
};
};
@hfsaito
hfsaito / streamaudio.sh
Created May 7, 2022 13:51
Workaround to stream audio of an app through discord in ubuntu
#!/bin/bash
# List inputs to get the mic name
# pactl list sources | grep "Source\|State\|Name\|Description"
# List outputs to get hte output name
# pactl list sinks | grep "Sink\|State\|Name\|Description"
# Creates 2 audio nodes
pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description=StreamAudio
@hfsaito
hfsaito / plants_vs_zombies.ahk
Created May 26, 2024 06:00
Shortcuts in AutoHotKey for Plants vs. Zombies
#Requires AutoHotkey v2.0
PVZ_WINDOW_TITLE := "Plants vs. Zombies"
class Base {
static CARD_COORD := [
{x: 0.14583333333333334, y: 0.06666666666666667},
{x: 0.2111111111111111, y: 0.06666666666666667},
{x: 0.26944444444444443, y: 0.06666666666666667},
{x: 0.34375, y: 0.06666666666666667},
{x: 0.3840277777777778, y: 0.06666666666666667},
2204 1826851
2831 8128018
3090 3488176
4074 1808293
4149 40224
4312 11588
5504 1827514
6118 10347
6229 51077
6673 372198
3090 3488176
4074 1808293