Skip to content

Instantly share code, notes, and snippets.

@yiyuanlu
yiyuanlu / .profile
Created July 4, 2012 07:00 — forked from xhan/.profile
cd to current Xcode's project folder in Terminal
function cdxcode()
{
path="`osascript ~/Codes/scripts/cdxcode.scpt 2>/dev/null`"
if [ -n "$path" ]; then
echo "cd to $path"
cd "$path"
else
echo "no Xcode Project finded"
fi
}
@yiyuanlu
yiyuanlu / RunPlatformUnitTests.sh
Created July 6, 2012 09:43 — forked from markschabacker/RunPlatformUnitTests.sh
Xcode 4.3 and xcodebuild Unit Tests
# /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests
# around line 93
if [ "${TEST_HOST}" != "" ]; then
if [ "${RUN_SIMULATOR_TESTS}" = "YES" ]; then
export OTHER_TEST_FLAGS="-RegisterForSystemEvents"
RunTestsForApplication "${TEST_HOST}" "${TEST_BUNDLE_PATH}"
else
Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)."
@yiyuanlu
yiyuanlu / mountain-lion-brew-setup.markdown
Created July 17, 2012 10:24 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@yiyuanlu
yiyuanlu / appDelegate.m
Created September 11, 2012 08:30
Params
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
NSLog(@"application:openURL: --- %@", url);
if([[url scheme] isEqualToString: [NSString stringWithFormat:@"sz%@", SSZ_APPLICATION_ID]])
{
NSString* entityKey = [[[url queryDictionary] objectForKey:@"url"]stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
if(entityKey)
{
[Socialize entityLoaderBlock](nil, [SZEntity entityWithKey:entityKey]);
@yiyuanlu
yiyuanlu / CPSystemInformation.h
Created September 28, 2012 07:36 — forked from iloveitaly/CPSystemInformation.h
CPSystemInformation compatible with Lion + 64Bit
#import <Cocoa/Cocoa.h>
@interface CPSystemInformation : NSObject {}
//all the info at once!
+ (NSDictionary *)miniSystemProfile;
+ (NSString *)machineType;
+ (NSString *)humanMachineType;
+ (NSString *)humanMachineTypeAlternate;
@yiyuanlu
yiyuanlu / ObjcCodeBeautifier
Created November 9, 2012 04:04 — forked from jianhu/ObjcCodeBeautifier
Applescript to beautify Objc code in Xcode
tell application "Xcode"
if (frontmost of it = false) then
return
end if
set documentList to source document of it
set listLength to count of documentList
if listLength is less than 1 then
return --no opened source file in working space
end if
require 'rubygems'
require 'mechanize'
if (ARGV[0] != '1' && ARGV[0] != '0') || (ARGV[0] == '1' && ARGV.size < 5) || (ARGV[0] == '0' && ARGV.size < 4)
puts %q{Usage: ruby xcode.rb HAS_MULTITEAM USERNAME PASSWORD TEAMID "DOWNLOAD_URL"}
puts %q{Example: ruby xcode.rb 0 myusername@apple.com 123456 "DOWNLOAD_URL" }
puts %q{Example: ruby xcode.rb 1 myusername@apple.com 123456 TEAMID "DOWNLOAD_URL" }
puts %q{DOWNLOAD_URL Example: https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_6.1.1/xcode_6.1.1.dmg" }
exit
end