Skip to content

Instantly share code, notes, and snippets.

Avatar

Albert Arvidsson scmx

View GitHub Profile
@scmx
scmx / locales-find-ruby-on-rails-script.md
Created March 15, 2023 13:44
Ruby on Rails locales-find script for fuzzy searching through locales yaml files using full dot notation part #rails #locales #fzf #fuzzy #compare
View locales-find-ruby-on-rails-script.md

Ruby on Rails locales-find script for fuzzy searching through locales yaml files using full dot notation part

Hacked together a quick ruby script for fuzzy searching for locale keys with their full dot notation part. It loads all yaml files in config/locales, flattenes all the key paths like sv.foo.bar.baz and prints the value and filename after. The result is passed through fzf for fuzzy filtering.

bin/locales-find | fzf --ansi -e

or maybe: docker-compose run --rm web bin/locales-find 2>/dev/null | fzf --ansi -e

@scmx
scmx / locales-compare-ruby-on-rails.md
Created March 15, 2023 13:29
Ruby on Rails compare yaml locales by key for each language #rails #locales #yml #compare #ruby #script
View locales-compare-ruby-on-rails.md
@scmx
scmx / git-allcommits.md
Last active February 23, 2023 20:58
git-allcommits List all commits made by you in all repositories in the last month #git #commits #multirepo
View git-allcommits.md
@scmx
scmx / vscode-settings-typescript-tsdk-double-backslash-windows-workaround-nextjs.md
Last active February 22, 2023 16:08
VSCode settings.json typescript.tsdk double backslash windows workaround Next.js
View vscode-settings-typescript-tsdk-double-backslash-windows-workaround-nextjs.md
@scmx
scmx / equential-paste-recording.md
Created January 23, 2023 10:48
macOS Sequential Copy Paste pbcopy pbpaste shell script. Start it and copy some things. Press Ctrl+c and you get the list all things you copied. #macos #clipboard #sequential #paste #pbpaste #pbcopy #bash #shell
View equential-paste-recording.md
@scmx
scmx / nodejs-detect-inconsistent-filepaths-in-smallburg-character-asset-pack.md
Last active October 4, 2022 12:20
Node.js script for detecting inconsistent character images in small-burg-towns-pack Smallburg base pack
View nodejs-detect-inconsistent-filepaths-in-smallburg-character-asset-pack.md

Node.js script for detecting inconsistent character images in small-burg-towns-pack Smallburg base pack

Smallburg Base Pack (Smallburg Village Pack)

is a really cool pixel art pack by almostApixel that you can find on itch.io.

I was playing around with the folder of images and started building a little demo that generates a random character in a random state, with random skin, random hair etc.

But then I noticed that some images didn't load. The file paths I were relying on weren't consistent. If I for example randomized an adult character with a dark brown ponytail, then the image wouldn't work

@scmx
scmx / jxa-ts-applescript-typescript.md
Last active June 2, 2022 09:53
How to write AppleScript JXA JavaScript in Vim or VS Code with TypeScript types #applescript #jxa #javascript #typescript #types #vim #coc
View jxa-ts-applescript-typescript.md

How to write AppleScript JXA JavaScript in Vim or VS Code with TypeScript types

jxa-ts-applescript-typescript

If you have written an AppleScript before, you might have felt the same way as I did, that it was a poor experience to use the Script Editor app, it's barely better than writing the script in any text editor or in a heredoc to run using osascript.

Luckily you could try the JXA variant instead, AppleScript using Javascript. But writing such a file in the Script Editor app is not a better experience sadly.

@scmx
scmx / iterm-dynamic-profile-dark-mode.md
Created April 9, 2021 18:44
How to switch between dark mode and light mode in iTerm using dynamic profiles #iterm #dark-mode #light-mode #node
View iterm-dynamic-profile-dark-mode.md
@scmx
scmx / git-commit-title-first-word.md
Last active September 14, 2023 03:52
Example list of verbs / first word to use in git commit title #git #commit #title
View git-commit-title-first-word.md
@scmx
scmx / extract-objects-from-rails-models-and-controllers.md
Last active February 17, 2023 11:28
7 Patterns to Refactor Rails Models 7 years later #rails #model #refactor #valueobject #serviceobject #formobject #queryobject #viewobject #policyobject #decorator
View extract-objects-from-rails-models-and-controllers.md