Skip to content

Instantly share code, notes, and snippets.

@SevenOutman
Last active March 28, 2023 13:11
Show Gist options
  • Save SevenOutman/1f8bdd48c19fe357f8458ecce6f4dcab to your computer and use it in GitHub Desktop.
Save SevenOutman/1f8bdd48c19fe357f8458ecce6f4dcab to your computer and use it in GitHub Desktop.
My cheatsheet

Extend yup methods in TypeScript

jquense/yup#312 (comment)

Delete merged branches

To delete all local branches that are already merged into the currently checked out branch:

git branch --merged | egrep -v "(^\*|master|main|dev)" | xargs git branch -d

Original answer: https://stackoverflow.com/a/6127884

Check SHA 512 checksum on macOS

shasum -a 512 /path/to/file

Original post: https://osxdaily.com/2022/05/08/how-to-check-sha512-checksum-on-mac/

Prevent flex items from overflowing a container

Add min-width: 0; to the overflowing item.

.overflowing {
  min-width: 0;
}

Original answer: https://stackoverflow.com/a/66689926

Reset author for a series of commits

git config user.email CORRECT_EMAIL
git rebase YOUR_SHA -x "git commit --amend --reset-author"

Original answer: https://stackoverflow.com/a/1320317

Fix semantic-release not detecting existing releases on prerelease channels when adding semantic-release to an existing repo

Follow this guide https://semantic-release.gitbook.io/semantic-release/support/troubleshooting#release-not-found-release-branch-after-git-push-force. Although its title does not resemble this specific problem but the machanism is the same.

Original answer: semantic-release/semantic-release#2238 (comment)

Error: Cannot find module 'ajv/dist/compile/codegen'

webpack-contrib/mini-css-extract-plugin#875 (comment)

(Guess this should not be in the cheatsheet but be in a personal knowledge base thing)

You must provide the URL of lib/mappings.wasm by calling Sourceltapconsumer.initialize...

Upgrade your Jest to v28 and above that does not use the then-boken source-map package.

Original comment: nodejs/node#42638 (comment)

Another workaround is adding NODE_OPTIONS=--no-experimental-fetch environment variable.

(Guess this should not be in the personal knowledge base too)

semantic-release in GitHub Actions throws "Write access to repository not granted"

Enable "Read and write permissions" in repo's Settings -> Actions -> General -> Workflow permissions.

The minimum required permissions of GITHUB_TOKEN by semantic-release:

  • contents: write to be able to publish a GitHub release
  • issues: write to be able to comment on released issues
  • pull-requests: write to be able to comment on released pull requests

Reference:

Build tool versions supporting TypeScript satisfies operator

Tool Version
tsc 4.9.0
esbuild 0.15.13

Link local repo with newly created repo using GitHub CLI

gh repo create --source .

Original answer cli/cli#6981 (comment)

"Xcode must be fully installed before you can continue" in React Native

Run this

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer'

Original answer expo/expo#21727 (comment)

Find and process on port 3000

lsof -i tcp:3000

Original answer: https://stackoverflow.com/a/3855359/6840562

Mirrors for installing packages in China

Sharp

npm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"

Original answer https://stackoverflow.com/a/71794262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment