Skip to content

Instantly share code, notes, and snippets.

@shashankpali
shashankpali / remove_xcode_completely.sh
Last active September 24, 2025 15:12
remove Xcode completely from mac
#!/bin/bash
# Complete Xcode Removal Script
# This script will remove ALL traces of Xcode from your macOS system
# WARNING: This action cannot be undone!
set -e # Exit on any error
echo "🚨 WARNING: Complete Xcode Removal Script"
echo "=========================================="
@shashankpali
shashankpali / Beginner Guide: Multiple GitHub SSH Keys (Ed25519, 2025).md
Last active September 11, 2025 08:00
Beginner Guide: Multiple GitHub SSH Keys (Ed25519, 2025)

🔑 Multiple GitHub Accounts with SSH (2025, macOS + Ed25519)

GitHub blocks legacy RSA/SHA-1 signatures. Use Ed25519 keys, one per account (e.g., personal and work), and map them via ~/.ssh/config.

Example values used below:

  • Personal email: alice.personal@example.com
  • Work email: alice.work@example.com
  • Personal GitHub username: alice-personal
  • Work GitHub org: acme-inc
    Replace with your own.
PLIST="${INFOPLIST_FILE}"
PLB=/usr/libexec/PlistBuddy
LAST_NUMBER=$($PLB -c "Print CFBundleVersion" "$PLIST")
NEW_VERSION=$(($LAST_NUMBER + 1))
$PLB -c "Set :CFBundleVersion $NEW_VERSION" "$PLIST"
//
add for extension
$PLB -c "Set :CFBundleVersion $NEW_VERSION" "$SRCROOT/SGSharedExtension/Info.plist"
NSURL *appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://", yourAppScheme]];
NSString *className = @"UIApplication";
if ( NSClassFromString( className ) )
{
id object = [ NSClassFromString( className ) performSelector: @selector( sharedApplication ) ];
[ object performSelector: @selector( openURL: ) withObject:appURL];
}
@shashankpali
shashankpali / Dynamic Predicate
Last active October 13, 2017 12:09
Replace hardcoded value to dynamic value
NSString *contextString = @"userName";
NSString *searchText = @"sh";
NSString *predicateString = [NSString stringWithFormat:@"%@ CONTAINS[c]", contextString];
predicateString = [predicateString stringByAppendingString:@"%@"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateString,searchText];
NSArray *filteredArray = [refArray filteredArrayUsingPredicate:predicate];
OR
Below code crash if searchText = @""
@shashankpali
shashankpali / CocoaPods
Last active August 13, 2016 04:41
Uploading a pod
1. Make sure you have tagged a release version on GitHub.
2. The podspec file must contain the same version as GitHub.
// change git username
3. git config --global user.name MyName --replace-all
// change git email
4. git config --global user.email any@email --replace-all