Skip to content

Instantly share code, notes, and snippets.

View paalss's full-sized avatar

Pål Syvertsen Stakvik paalss

View GitHub Profile
@paalss
paalss / rename-react-component.sh
Last active June 9, 2023 10:12
handy bash script for renaming react components
# ask in what path the component resides in
# if no answer is provided, use default value
# -e flag is for giving `cd`-code completion while answering the question
defaultValue=src/stories/default/
read -e -p "Where is component located? (default: $defaultValue): " location
location=${location:-$defaultValue}
read -p "Enter component name you want to rename: " currentName
componentPath=$location/$currentName

Convert React Prop Types to TS type annotations

For filer i mappe hvis navn er "pages":

npx jscodeshift -t https://mskelton.dev/ratchet.ts pages/**/*.{ts,tsx}

https://github.com/mskelton/ratchet

funker ikke på destructured props, da

@paalss
paalss / ohmybash.md
Last active February 3, 2023 13:23
installasjon - theme - theme font setup - notater ang. git bash

Ohmybash

Hvordan starte med ohmybash, velge theme og laste ned nødvendig font icons

Installasjon

bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"

Du får med masse aliases med dette. List alle med alias

Vise kort commit hash

git rev-parse --short HEAD
@paalss
paalss / commit-changes-for-file.md
Last active May 13, 2023 19:58
printe git commit historikk

See commit changes for a particular file

git log -p -- path/to/filename

add --follow to see changes past file renames

git log -p --follow -- path/to/filename