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
for pre in *.pre.txt | |
diff -urN \ | |
(sed -E "s/ '--(swift|llvm)-cmake-options=[^']+'//g" $pre | psub) | |
(sed -E "s/ '--(swift|llvm)-cmake-options=[^']+'//g" (string replace -r '\.pre\.' '.output.' $pre) | psub) | |
or read | |
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
{ | |
"name": "ReactiveCocoa", | |
"version": "4.2.1", | |
"summary": "A framework for composing and transforming streams of values.", | |
"description": "ReactiveCocoa (RAC) is an Objective-C framework for Functional Reactive Programming.\nIt provides APIs for composing and transforming streams of values.", | |
"homepage": "https://github.com/ReactiveCocoa/ReactiveCocoa", | |
"license": { | |
"type": "MIT", | |
"file": "LICENSE.md" | |
}, |
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; | |
NS_ASSUME_NONNULL_BEGIN | |
@interface NewClass : NSObject | |
- (instancetype)initWithString:(NSString *)string NS_DESIGNATED_INITIALIZER; | |
@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
#include <stdlib.h> | |
int test1(int32_t (*array)[10]) { | |
return 1; | |
} | |
int test2(int32_t (*array)[5]) { | |
return 2; | |
} |
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
protocol TestProtocol { | |
} | |
class TestClass : TestProtocol { | |
} | |
class TestClass2 { | |
} | |
struct Test { |
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 "Kiwi.h" | |
#define KWPasteX(x, y) x ## y | |
#define KWPaste(x, y) KWPasteX(x, y) | |
#define KWMetaMacro(...) \ | |
if (0) \ | |
KWPaste(finished, __LINE__): ; \ | |
else \ | |
for (KWVoidBlock KWPaste(block, __LINE__) = nil;;) \ |
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
// You can have a recursive function | |
func fact(n: Int) -> Int { | |
if n < 2 { return 1 } | |
return n * fact(n - 1) | |
} | |
// But you cannot have a recursive closure | |
// let fact2: Int -> Int = { n in | |
// if n < 2 { return 1 } | |
// return n * fact2(n - 1) // ERROR: Variable used within its own initial value |
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
class MyClass { | |
var enabled: Bool? { | |
didSet { | |
if let v = enabled? { | |
self.enabled = v ? true : nil | |
} | |
} | |
} | |
init(enabled: Bool) { |
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 | |
enum Either<A, B> { | |
case Left(@auto_closure () -> A) | |
case Right(@auto_closure () -> B) | |
func fold<X>(fa: A -> X, fb: B -> X) -> X { | |
switch self { | |
case let .Left(a): return fa(a()) | |
case let .Right(b): return fb(b()) |
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
NSMutableArray *horizontalConstraints = [NSMutableArray array]; | |
// Fixed width, same width for all buttons (33) | |
[horizontalConstraints addObject:[NSLayoutConstraint constraintWithItem:left attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:33.f]]; | |
[horizontalConstraints addObject:[NSLayoutConstraint constraintWithItem:left attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:center1 attribute:NSLayoutAttributeWidth multiplier:1.f constant:0]]; | |
[horizontalConstraints addObject:[NSLayoutConstraint constraintWithItem:left attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:center2 attribute:NSLayoutAttributeWidth multiplier:1.f constant:0]]; | |
[horizontalConstraints addObject:[NSLayoutConstraint constraintWithItem:left attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:right attribute:NSLayoutAttributeWidth multiplier:1.f constant:0]]; | |
// Align baselines | |
[horizonta |
NewerOlder