This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A much better version of C#-style Async/Await. It can return values! | |
import Cocoa | |
struct Await<T> { | |
// private | |
let group: dispatch_group_t | |
let getResult: () -> T | |
// public | |
func await() -> T { return getResult() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Analysis of sampling com.apple.security.pboxd (pid 20558) every 1 millisecond | |
Process: com.apple.security.pboxd [20558] | |
Path: /System/Library/PrivateFrameworks/RemoteViewServices.framework/XPCServices/com.apple.security.pboxd.xpc/Contents/MacOS/com.apple.security.pboxd | |
Load Address: 0x10c951000 | |
Identifier: com.apple.security.pboxd | |
Version: 2.0 (80.7) | |
Code Type: X86-64 (Native) | |
Parent Process: ??? [1] | |
Date/Time: 2013-09-26 16:43:26.188 -0700 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RUN: %clang -fsyntax-only %s 2>&1 | FileCheck %s | |
#import <Foundation/NSObject.h> | |
@protocol FooDelegate; | |
@interface Foo : NSObject | |
@property (weak) id<FooDelegate> delegate; | |
@end | |
@protocol FooDelegate <NSObject> | |
- (void)doSomething; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diffcount () { | |
awk ' | |
BEGIN { minuscount=0; pluscount=0; } | |
/^-/ { minuscount = minuscount + 1; } | |
/^\+/ { pluscount = pluscount + 1; } | |
END { print "-" minuscount, "+" pluscount; } | |
' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> -[<NSSplitView: 0x105e20130> resizeWithOldSuperviewSize:] superview from {543, 453} to {543, 493} | |
>>> -[<NSSplitView: 0x105e20130> setFrame:] from {{0, 0}, {543, 453}} to {{0, 0}, {0, 0}} | |
(gdb) po [self constraintsAffectingLayoutForOrientation:1] | |
<__NSArrayI 0x105bbfa00>( | |
<NSLayoutConstraint:0x105e19350 NSSplitView:0x105e20130.bottom == NSView:0x105e142a0.bottom>, | |
<NSLayoutConstraint:0x105e1c9a0 V:|-(0)-[NSSplitView:0x105e20130] (Names: '|':NSView:0x105e142a0 )>, | |
<NSLayoutConstraint:0x105e19350 NSSplitView:0x105e20130.bottom == NSView:0x105e142a0.bottom> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On 10.7.5: | |
>>> -[<NSView: 0x108064e50> resizeWithOldSuperviewSize:] superview from {543, 475} to {543, 515} | |
>>> -[<NSView: 0x108064e50> setFrame:] from {{0, 0}, {543, 453}} to {{0, 0}, {543, 493}} | |
>>> -[<NSView: 0x108064e50> setFrameSize:] from {543, 453} to {543, 493} | |
>>> -[<NSView: 0x108064e50> resizeSubviewsWithOldSize:] from {543, 453} to {543, 493} | |
>>> -[<NSSplitView: 0x10806cb10> resizeWithOldSuperviewSize:] superview from {543, 453} to {543, 493} | |
>>> -[<NSSplitView: 0x10806cb10> setFrame:] from {{0, 0}, {543, 453}} to {{0, 0}, {0, 0}} /*** WTF??? ***/ | |
>>> -[<NSSplitView: 0x10806cb10> setFrameSize:] from {543, 453} to {0, 0} | |
>>> ... and so on, causing an eventual constraint violation ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
static inline void _AssertionFailed(char *expr, char *reason) | |
{ | |
if (!reason || *reason == '\0') | |
printf("Assertion failed: %s\n", expr); | |
else | |
printf("Assertion failed: %s (Reason: %s)\n", expr, reason); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation AppDelegate | |
@synthesize window = _window; | |
@synthesize box = _box; | |
@synthesize addButton = _addButton; | |
@synthesize useDummyAnimationGroup = _useDummyAnimationGroup; | |
- (void)_prepareForFadeIn; | |
{ | |
[_box setAlphaValue:0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang -c -o /dev/null prop.m | |
#import <Foundation/NSObject.h> | |
@interface Obj : NSObject /*Public*/ | |
@end | |
@interface Obj ( /*Internal*/ ) | |
@property (readonly, retain, nonatomic) NSObject *prop; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/NSObject.h> | |
@interface Foo : NSObject | |
@property (readonly, assign) id bar; | |
@end | |
@interface Foo (Internal) |
NewerOlder