mkdir ~/Screenshots
defaults write com.apple.screencapture location ~/Screenshots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Adds transparency to a hex color by appending an alpha value. | |
| * | |
| * @param hexColor - A 6-digit hex color string (e.g., '#C1E38C' or 'C1E38C') | |
| * @param alpha - A number between 0 (fully transparent) and 1 (fully opaque) | |
| * @returns An 8-digit hex color string with the alpha value appended | |
| * | |
| * @example | |
| * withAlpha('#C1E38C', 0.4) // Returns '#C1E38C66' | |
| * withAlpha('#FF0000', 0.5) // Returns '#FF000080' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Prevent losing the message in the first place | |
| If you know ahead of time that you want to “undo” a commit without losing either your changes or your commit message, use soft reset: | |
| # Move HEAD one commit back, but keep index & working-tree untouched | |
| git reset --soft HEAD~1 | |
| • What it does | |
| • HEAD moves to the previous commit | |
| • Your index (staging area) still contains exactly what you had in that commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://stackoverflow.com/questions/29914052/how-to-git-rebase-a-branch-with-the-onto-command/29916361#29916361 | |
| git rebase --onto <newparent> <oldparent> | |
| // Most frequent usage, after base branch is squashed and merged into main | |
| git rebase --onto main [SHA before first commit on your branch] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Exclude test files from VSCode searches | |
| **/*.test.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Prints out the iOS version number | |
| printIosVersion() { | |
| sed -n 'N;s/.*CFBundleShortVersionString.*>\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' ios/Compass/Info.plist | |
| } | |
| # Sets the iOS version number | |
| # | |
| # {$1} The new version number to set | |
| ###### Documentation ###### | |
| # sed -i '' ' # -i '' will modify the file and save it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Set the system time for our tests. | |
| * This ensures that our tests can't fail based on the local time of the CI machine. | |
| * This guards against app code where the behavior changes based on the device time. | |
| * For example, a test might fail if we attempt to set the search time "before now". | |
| */ | |
| beforeAll(() => { | |
| // @TODO: 'modern' is default once we upgrade to Jest 27 https://jestjs.io/blog/2020/05/05/jest-26#new-fake-timers | |
| jest.useFakeTimers("modern"); | |
| const JS_DATE_11_AM = new Date(new Date().setHours(11, 0, 0, 0)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git status | egrep -v '.js|.png' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| componentDidUpdate(prevProps) { | |
| console.log("Render update diff:"); | |
| const now = Object.entries(this.props); | |
| const added = now.filter(([key, val]) => { | |
| if (prevProps[key] === undefined && val !== undefined) return true; | |
| if (prevProps[key] !== val) { | |
| console.log(`${key} | |
| + ${JSON.stringify(val)} | |
| - ${JSON.stringify(prevProps[key])}`); |
NewerOlder