Skip to content

Instantly share code, notes, and snippets.

@guttentag
guttentag / log_config.txt
Last active May 25, 2021 09:31
Set / View log config for apps on Mac
/Library/Preferences/Logging/Subsystems/<com.your.app>.plist
sudo log config --mode "level:debug,persist:debug" --subsystem com.myapp.subsystem
@guttentag
guttentag / tail_simulator_logs.txt
Last active May 25, 2021 09:31
Tail Simulator logs (Console app not showing debug level logs)
xcrun simctl spawn booted log stream --debug --predicate 'subsystem == "com.yourapp.subsystem"'
@guttentag
guttentag / vapor_migration_2_3.txt
Created November 26, 2020 18:09
Migrate postgres from vapor 2 to vapor 3
1. CREATE EXTENSION "uuid-ossp";
2. ALTER TABLE fluent RENAME TO fluent_old;
CREATE TABLE fluent
AS (SELECT uuid_generate_v4() as id, name, batch, created_at as createdAt, updated_at as updatedAt from fluent_old);
3. After you have verified the table was transferred properly, you can drop the old fluent table: 
DROP TABLE fluent_old;
@guttentag
guttentag / app_version_on_launch_screen.txt
Created May 20, 2020 14:28
Inject App version to a label on LaunchScreen.storyboard (2 options)
# Output version numbers into a label on LaunchScreen.storyboard
sed -i "" -e "/userLabel=\"LAUNCH_APP_VERSION\"/s/text=\"[^\"]*\"/text=\"App Version: $MARKETING_VERSION\"/" "$PROJECT_DIR/daytwo/App/View/Base.lproj/LaunchScreen.storyboard"
# Output version & build number to the APP_VERSION label on LaunchScreen.storyboard
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}")
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}")
sed -i "" -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"Version: $versionNumber ($buildNumber)\"/" "$PROJECT_DIR/$PROJECT_NAME/Storyboards/Base.lproj/LaunchScreen.storyboard"
git log -5 --format='%C(yellow)%ad%Creset% Cgreen(%cN)%Creset - %s' --date=human
git log -5 --format='%C(yellow)%ar%Creset% Cgreen(%cN)%Creset - %s'
mdfind "com_apple_xcode_dsym_uuids == <UDID>"
mdfind "com_apple_xcode_dsym_uuids == *"
@guttentag
guttentag / run_all_connected_devices.js
Last active September 4, 2019 11:23
XCODE - Run app on all connected devices
function run(input, parameters) {
var xcode = Application("Xcode");
var ws = xcode.activeWorkspaceDocument();
var genericDest = null;
var devices = [];
ws.runDestinations().forEach(function(runDest)
{
if (runDest.platform() != "iphoneos")
return;
if (runDest.device().generic())
@guttentag
guttentag / xcode_duplicate_line.txt
Last active September 4, 2019 11:21
Xcode - Duplicate Line
sudo chmod 0777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
code /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
<key>User Edit</key>
<dict>
<key>Duplicate Current Lines Down</key>
<string>selectParagraph:, delete:, yank:, moveToBeginningOfParagraph:, yankAndSelect:</string>
</dict>