export SLACK_DEVELOPER_MENU=true && open /Applications/Slack.app/localStorage.setItem("localConfig_v2", localStorage.getItem("localConfig_v2").replace(/\"is_unified_user_client_enabled\":true/g, '\"is_unified_user_client_enabled\":false'))| import { RefObject, useEffect, useRef } from 'react'; | |
| function getScrollParent(node: HTMLElement | null): HTMLElement | null { | |
| const isElement = node instanceof HTMLElement; | |
| const overflowY = isElement && window.getComputedStyle(node).overflowY; | |
| const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden'; | |
| if (!node) { | |
| return null; | |
| } else if (isScrollable && node.scrollHeight >= node.clientHeight) { |
| // paste this in your console | |
| document.querySelectorAll('.vjs-tech').forEach(element => element.playbackRate = 15) |
| import { DependencyList, EffectCallback, useEffect, useRef } from 'react'; | |
| export const useEffectWhen = (callback: EffectCallback, whatDeps: DependencyList, whenDeps: DependencyList) => { | |
| const prevWhenValuesRef = useRef<DependencyList>([]); | |
| useEffect(() => { | |
| const prevWhenDeps = prevWhenValuesRef.current; | |
| prevWhenValuesRef.current = whenDeps; | |
| for (let i = 0; i < whenDeps.length; i++) { |
export SLACK_DEVELOPER_MENU=true && open /Applications/Slack.app/localStorage.setItem("localConfig_v2", localStorage.getItem("localConfig_v2").replace(/\"is_unified_user_client_enabled\":true/g, '\"is_unified_user_client_enabled\":false'))| import { useEffect, useState } from 'react'; | |
| type Callback = (data?: any) => void; | |
| class EventBus<E extends string = string> { | |
| events: Partial<Record<E, Callback[]>>; | |
| constructor() { | |
| this.events = {}; | |
| } |
| // extracted from https://github.com/damiangreen/use-trace-update | |
| import { useEffect, useRef } from 'react'; | |
| export default function useTraceUpdate(props) { | |
| const prev = useRef(props); | |
| useEffect(() => { | |
| const changedProps = Object.entries(props).reduce((ps, [k, v]) => { | |
| if (prev.current[k] !== v) { | |
| ps[k] = [prev.current[k], v]; |
| // in tailwind.config.ts | |
| // import flexPlugin from 'path/to/plugin.ts' | |
| // export default { | |
| // plugins: [flexPlugin] | |
| // } | |
| // usage: flex-<justify> or flex-<justify>-<align> | |
| // ex: flex-between or flex-around-stretch | |
| import plugin from 'tailwindcss/plugin'; |
| #!/bin/bash | |
| # this script recursively exports all files in a directory | |
| # the output will be copied your clipboard using a format | |
| # that's easy to be interpreted by LLMs like chatgpt | |
| function print_files { | |
| for entry in "$1"/* | |
| do | |
| if [ -d "$entry" ]; then |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width" /> | |
| <title>Redirecting...</title> | |
| </head> | |
| <body> | |
| <form | |
| method="post" |
| #!/usr/bin/env bash | |
| last_commit=$(git log --format="%h %s" -n 1) | |
| echo "this will deploy your last local commit" | |
| echo $last_commit | |
| while true; do | |
| read -p "Do you want to continue? (y/n) " yn | |
| case $yn in |