Skip to content

Instantly share code, notes, and snippets.

@implementation AppDelegate
{
UITextView *_textView;
}
@synthesize window = _window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
alias build='xcodebuild -scheme "SUBSTITUTEYOUROWNSCHEME"'
alias buildfiltered='build | grep -w '\''warning\|error\|BUILD FAILED\|BUILD SUCCEEDED'\'' | grep -v '\''\-\-warning'\'''
alias clean='build clean'
Before @autoreleasepool a fairly common pattern in a try catch would be the following
NSAutoreleasePool *aPool = [[NSAutoreleasePool alloc] init];
@try {
}
@catch (NSException *anException) {
}
@finally {
struct block_literal {
void *isa;
int flags;
int reserved;
void (*invoke)(void *);
void *descriptor;
void *byref_obj;
};
void foo(void)
@rustle
rustle / WeakExternCrash.m
Created September 15, 2012 02:04
Weak linking with extern NSString *const issue
#import <Social/Social.h>
/* Compiled with iOS 6 SDK
* Social.framework weak linked (Optional)
* Run on iOS 5.1 (simulator and device)
*/
// http://simx.me/technonova/software_development/checking_for_weak_linked_frameworks.html
//http://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html#//apple_ref/doc/uid/20002378-106633-CJBGFCAC
//
// NSNotificationCenter+RSLAdditions.h
//
// Created by Doug Russell
// Copyright (c) 2012 Doug Russell. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
@rustle
rustle / gist:4115414
Created November 20, 2012 01:45
Source Tree with Kaleidoscope 2 beta

SourceTree does not yet officially support Kaleidoscope 2, so here is how to set it up:

In Preferences, under Diff:

Screen Shot

You can try selecting Kaleidoscope, but we have had reports of mixed results. Some people have rebuilt their launch services database and restarted and been able to use Kaleidoscope this way:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain use

@rustle
rustle / gist:4342284
Created December 20, 2012 01:30
Cornerstone with Kaleidoscope 2 beta

Cornerstone does not yet officially support Kaleidoscope 2, so to work with the latest beta of Kaleidoscope 2 (Build 99 and up) here is how to get set up:

Follow the instructions here Cornerstone External Compare Tools under the heading Custom Compare Scripts

The custom scripts contents should be

#!/usr/bin/env bash

/usr/local/bin/ksdiff --partial-changeset -- "$1" "$2"
@rustle
rustle / gist:4342288
Created December 20, 2012 01:31
Tower with Kaleidoscope 2 beta

Due to a change in Kaleidoscope 2, Tower 1.4.14 does not work with the latest beta of Kaleidoscope 2 (Build 99 and up) out of the box. We are working with the fine folks at Tower to address this issue.

If you are running 1.4.14, download this script and follow the included instructions:

Kaleidoscope Merge Tool

Future versions of Tower should work as expected without the need for these steps.

Builds and runs no problem:

@interface Foo : NSObject
@property (readonly) id foo;
@end

@implementation Foo

- (instancetype)init