Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Yao Cheng alex-cellcity

  • CellCity Ltd.
  • Singapore
View GitHub Profile
@alex-cellcity
alex-cellcity / solve_pbxproj_merge_conflict.sh
Created Apr 3, 2012 — forked from zbyhoo/solve_pbxproj_merge_conflict.sh
Solving pbxproj files git merge conflicts when two users add files at the same time.
View solve_pbxproj_merge_conflict.sh
#!/bin/sh
projectfile=`find -d . -name 'project.pbxproj'`
projectdir=`echo *.xcodeproj`
projectfile="${projectdir}/project.pbxproj"
tempfile="${projectdir}/project.pbxproj.out"
savefile="${projectdir}/project.pbxproj.mergesave"
cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile
cp $projectfile $savefile
@alex-cellcity
alex-cellcity / gist:2290627
Created Apr 3, 2012 — forked from zbyhoo/gist:1450703
print sorted by size list of all files/folders in current directory in human readable form
View gist:2290627
du -s * | sort -nr | cut -f2- | xargs -I {} du -hs {}
View port_pid.sh
#!/bin/sh
# Map LISTENing TCP ports to their PIDs using lsof
LSOF=/usr/sbin/lsof
# e.g. netstat -an
# 127.0.0.1.25 *.* 0 0 49152 0 LISTEN
# *.22 *.* 0 0 49152 0 LISTEN
@alex-cellcity
alex-cellcity / example.m
Created Jul 12, 2011 — forked from henrik/example.m
Locating the keyboard (UIKeyboard) on iOS 4, to e.g. add a custom button.
View example.m
- (void)someSetupMethod {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
}
- (void)someTeardownMethod {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
}
View NSData+AESCrypt.h
//
// NSData+AESCrypt.h
//
// AES Encrypt/Decrypt
// Created by Jim Dovey and 'Jean'
// See http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html
//
// BASE64 Encoding/Decoding
// Copyright (c) 2001 Kyle Hammond. All rights reserved.
// Original development by Dave Winer.
View xcode_downloader.sh
#!/bin/sh
# Change this line to the URI path of the xcode DMG file.
# XCode 3.2.5
#XCODE_PATH="/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg"
# XCode 4
#XCODE_PATH="/Developer_Tools/xcode_4_and_ios_sdk_4.3__final/xcode_4_and_ios_sdk_4.3__final.dmg"