Skip to content

Instantly share code, notes, and snippets.

View buildtheui's full-sized avatar

Fabián Monsalve buildtheui

View GitHub Profile
@buildtheui
buildtheui / gist:72e43eb73c5885ab5e78ef2daaac4bc1
Created November 22, 2023 22:23
Shell function that Prepends doppler command to yarn when any yarn command is executed
# override yarn command to always use doppler before executing
yarn() {
if command -v doppler &> /dev/null
then
{
printf "using yarn with doppler \n"
command doppler run --preserve-env -- yarn "$@"
} || {
local blue=$(tput setaf 4)
local normal=$(tput sgr0)
@buildtheui
buildtheui / useEffectAfterMount.ts
Created June 17, 2022 17:01
useEffectAfterMount hook
import { useEffect, useRef } from "react";
type OnMountCB = () => void;
type OnMountDeps = unknown[];
export const useEffectAfterMount = (cb: OnMountCB, deps?: OnMountDeps) => {
const componentJustMounted = useRef(true);
useEffect(() => {
if (!componentJustMounted.current) {
return cb();