Skip to content

Instantly share code, notes, and snippets.

View ralph's full-sized avatar

Ralph von der Heyden ralph

View GitHub Profile
@ralph
ralph / test1-output.txt
Last active August 23, 2024 08:33
I am trying to convince typescript that an item cannot be `null` / `undefined` when using a filter, but typescript does not trust me. Am I missing something? Is typescript stupid, or am I? 🤔 The only way I could get this working is by force-casting a type with `as`. Can you suggest a more elegant way?
src/test.ts:10:39 - error TS18049: 'item' is possibly 'null' or 'undefined'.
10 strings.forEach((item) => console.log(item.id, item.label))
~~~~
src/test.ts:10:48 - error TS18049: 'item' is possibly 'null' or 'undefined'.
10 strings.forEach((item) => console.log(item.id, item.label))
~~~~
@ralph
ralph / vips-processing.zsh
Created January 23, 2025 00:30
Create square or 4x5 images with black or white frame borders using VIPS
# Examples:
# squarify_white 2023-10-11.jpg
# 4x5ify_white *.heic
4x5ify() {
for file in "${@:3}"; do
if [[ "${file}" == *-4x5-* ]]; then
continue
fi
if [[ $(vipsheader -f height ${file}) != 2580 ]]; then
#!/bin/sh
# Build vue devtools for Firefox.
# Check out the repository and run this script, then install the XPI file.
# https://github.com/vuejs/devtools
# You may also have to set `xpinstall.signatures.required` to `false` in `about:config`.
cd packages/firefox-extension
git checkout manifest.json
cat manifest.json | jq --argjson browser_specific_settings '{"gecko": {"id": "[email protected]", "strict_min_version": "58.0"}}' '. + {browser_specific_settings: $browser_specific_settings}' > tmp.json