This file contains hidden or 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 | |
INPUT_DIR="UPLOAD" | |
OUTPUT_DIR="frames" | |
MAX_WIDTH=1920 | |
QUALITY=80 | |
FORMAT="webp" # can be webp, jpg, or png | |
mkdir -p "$OUTPUT_DIR" |
This file contains hidden or 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
for i in *.mp4; do ffmpeg -i "$i" -c:v libvpx-vp9 -b:v 2M -c:a libopus -b:a 128k "${i%.*}.webm"; done |
This file contains hidden or 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 {isEqual, transform, isObject} from 'lodash'; | |
interface Diff { | |
base: any; | |
comparison: any; | |
} | |
/** | |
* Get the differences between two objects. | |
* @param base - The base object. |
This file contains hidden or 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
generateTranslationTypes() { | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: generateTranslationTypes <json-file>" | |
return 1 | |
fi | |
JSON_FILE="$1" | |
if [ ! -f "$JSON_FILE" ]; then |
This file contains hidden or 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
/** | |
* Enforces that an array respects a maximum length. | |
* | |
* @param {T[] | undefined} array - The array to validate. | |
* @param {number} maxLength - The maximum length. | |
* @returns {(T[] & {length: number}) | undefined} - Returns the array if valid, otherwise undefined. | |
*/ | |
export function enforceMaxLength<T, N extends number>( | |
array: T[] | undefined, | |
maxLength: N, |
This file contains hidden or 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
# Enforcing Conventional Commits with a Git Hook | |
# This gist provides instructions on how to set up a `commit-msg` | |
# Git hook to enforce [conventional commits](http://www.conventionalcommits.org) in your project. | |
# The `commit-msg` script checks the commit message against a regex pattern to ensure | |
# it follows the conventional commit format. | |
# The `text-styles.sh` script is used to colorize the output of the `commit-msg` script for better readability. | |
# ----- 1. Copy the hook files to .git/hooks ----- | |
# You need to copy the files from <root>/hooks into <root>/.git/hooks when initializing your project. |
This file contains hidden or 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
@mixin removeDefaultStyles() { | |
background-color: transparent; | |
border: none; | |
margin: 0; | |
padding: 0; | |
text-align: inherit; | |
font-family: inherit; | |
border-radius: 0; | |
appearance: none; | |
} |
This file contains hidden or 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
function useThrottle<T>(value: T, interval = 500): T { | |
const [throttledValue, setThrottledValue] = useState<T>(value); | |
const lastExecuted = useRef<number>(Date.now()); | |
useEffect(() => { | |
if (Date.now() >= lastExecuted.current + interval) { | |
lastExecuted.current = Date.now(); | |
setThrottledValue(value); | |
} else { | |
const timerId = setTimeout(() => { |
This file contains hidden or 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
export interface DataPoint { | |
key: number | string; | |
value: number | null; | |
} | |
export interface DataSeries { | |
data: DataPoint[]; | |
color?: Color; | |
isComparison?: boolean; | |
name: string; |
This file contains hidden or 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
export function useYScale({ | |
drawableHeight, | |
integersOnly, | |
data | |
}) { | |
// ... | |
return { yScale, yTicks } | |
} | |
NewerOlder