This file contains hidden or 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
#!xcrun swift | |
func withoutFirst<T, G: GeneratorType where G.Element == T>(genGiver: () -> G) -> SequenceOf<T> { | |
return SequenceOf { | |
_ -> G in | |
var g = genGiver() | |
g.next() | |
return g | |
} | |
} |
This file contains hidden or 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 hidden or 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 -framework Foundation -o ObjCSuper ObjCSuper.m SuperTrampoline.s | |
// % ./ObjCSuper | |
// | |
// 2014-02-15 23:03:32.498 ObjCSuper[1296:507] Subclass impl | |
// 2012014-02-15 23:03:32.498 ObjCSuper[1296:507] Subclass impl4-02-15 23:03:32.500 ObjCSuper[1296:507] b respondsToSelector:@selector(retain)? YES | |
// 2014-02-15 23:03:32.500 ObjCSuper[1296:507] b respondsToSelector:@selector(subclassMethod)? YES | |
// 2014-02-15 23:03:32.501 ObjCSuper[1296:507] Superclass impl | |
// 2014-02-15 23:03:32.501 ObjCSuper[1296:507] b_super respondsToSelector:@selector(retain)? YES | |
// 2014-02-15 23:03:32.501 ObjCSuper[1296:507] b_super respondsToSelector:@selector(subclassMethod)? NO |
This file contains hidden or 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 void cleanup_func(int *foo) | |
{ | |
printf("cleanup! %d\n", *foo); | |
} | |
int main(int argc, char **argv) | |
{ | |
return 0; |
This file contains hidden or 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 -framework Foundation -o AutoNotifyTest AutoNotifyTest.m | |
/*** | |
Expected results: | |
willChange:valuesAtIndexes:forKey: | |
removeObjectFromBarAtIndex: | |
removeObjectFromBarAtIndex: | |
removeObjectFromBarAtIndex: | |
removeObjectFromBarAtIndex: |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 ... |
NewerOlder