Skip to content

Instantly share code, notes, and snippets.

@jclem
jclem / tree.ts
Last active January 1, 2025 23:23
type TreeNode = [value: number, left: TreeNode | null, right: TreeNode | null]
const node: TreeNode =
[1,
[2,
[4, null, null],
null],
[3,
[5, null, null],
[6, null, null]]]
func (c Collection) Validate() error {
v := vld.New()
strlen := vld.StrLen(1, 64)
v.Validate(
[]string{"name"},
strlen(c.Name),
)
v.Validate(
@jclem
jclem / safari-markdown.applescript
Created November 8, 2024 16:24
Copy Safari URL as Markdown
tell application "Safari"
set theName to get name of front document
set theURL to get the URL of front document
set theLink to "[" & theName & "](" & theURL & ")"
end tell
set the clipboard to theLink
@jclem
jclem / reset.fish
Created October 30, 2024 14:38
Reset VSCode settings and extensions
echo '[]' >"$HOME/Library/Application Support/Code/User/keybindings.json"
echo '{}' >"$HOME/Library/Application Support/Code/User/settings.json"
for ext in (code --list-extensions)
code --uninstall-extension $ext --force
end
echo '[]' >"$HOME/Library/Application Support/Code - Insiders/User/keybindings.json"
echo '{}' >"$HOME/Library/Application Support/Code - Insiders/User/settings.json"
for ext in (code-insiders --list-extensions)
code-insiders --uninstall-extension $ext --force