Skip to content

Instantly share code, notes, and snippets.

View xavierchia's full-sized avatar

Xavier Chia xavierchia

View GitHub Profile
# In AppDelegate:
# This is to make sure that it only happens on the first launch
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let defaults = UserDefaults.standard
let isPreloaded = defaults.bool(forKey: "isPreloaded")
if !isPreloaded {
Type this in console after breakpoint
expr variableToChangeOnTheFly = 20
@xavierchia
xavierchia / LightweightDataMigration
Created September 5, 2022 23:15
LightweightDataMigration
Click on a data model
Editor > Add data model
Make changes to the new data model
Inspector > Model version > current > choose latest
@xavierchia
xavierchia / gist:b7b983ca0f8f1270165d9242f21d034b
Last active March 1, 2023 01:53 — forked from kylefox/gist:4512777
If you want to use Xcode's FileMerge as your git mergetool, this is how you set it up.
# Tell system when Xcode utilities live:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# Set "opendiff" as the default mergetool globally:
git config --global merge.tool opendiff
# Then, when git tells you that there is a conflict, you can run `git mergetool` and
# it will open XCode's mergetool (like in the question's screenshot) and you can work through the conflict.
alias dd='rm -rf /Users/xavier/Library/Developer/Xcode/DerivedData/*'
alias ccb='git branch --show-current | pbcopy | echo "current branch copied to $
alias reset='git reset head~1'
alias reuse='git commit --reuse-message=orig_head | echo "commited with last me$
alias nanoz='nano ~/.zshrc'
alias xlog='git log --format="%C(auto) %h %s" -n10'
alias dab='git branch | grep -v "main" | xargs git branch -D'
alias diff='git diff --name-only --diff-filter=U --relative'
export CLICOLOR=1
export LSCOLORS=bxFxCxDxBxegedabagaced