Skip to content

Instantly share code, notes, and snippets.

@nickboucher
nickboucher / shadow.sh
Created March 23, 2023 19:24
MacOS-Screenshot Drop Shadow + Rounded Corners
# Adds a drop shadow and rounded edges to images
# similar to MacOS App screenshots
#
# Requires ImageMagick:
# brew install imagemagick
#
# Add to ~/.zshrc or ~/.bashrc for easy usage
#
# Usage:
# shadow image.png
@LewisJEllis
LewisJEllis / getRelativeTimeString.ts
Last active March 6, 2024 13:31
Simplified getRelativeTimeString
// from https://twitter.com/Steve8708/status/1504131981444980739
// simplified to a function body of 8 tidy lines
// no loop needed, no 2d array of 3-tuples needed
// just 2 arrays, a findIndex call, and some indexing :)
export function getRelativeTimeString(
date: Date | number,
lang = "en"
): string {
const timeMs = typeof date === "number" ? date : date.getTime();