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
let yetAnotherPoint = (1, -1) | |
switch yetAnotherPoint { | |
case let (x, y) where x == y: | |
println("(\(x), \(y)) is on the line x == y") | |
case let (x, y) where x == -y: | |
println("(\(x), \(y)) is on the line x == -y") | |
case let (x, y): | |
println("(\(x), \(y)) is just some arbitrary point") | |
} | |
// prints "(1, -1) is on the line x == -y" |
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
id mockFileManager = mock([NSFileManager class]); | |
[given([mockFileManager removeItemAtURL:notNilValue() error:notNilValue()]) willReturnBool:YES]; | |
MKTArgumentCaptor* argument = [MKTArgumentCaptor new]; | |
[verify(mockFileManager) removeItemAtURL:notNilValue() error:[argument capture]]; |
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/Foundation.h> | |
#import "ATPInfo.h" | |
@interface ATPDecorator : NSObject <ATPInfo> | |
@property (nonatomic, strong, readonly) NSString* fullName; | |
- (id)initWithInfo:(NSObject<ATPInfo>*)info; |
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
NSFileManager* fileManager = [NSFileManager new]; | |
NSURL* directoryURL = [NSURL fileURLWithPath:@"~/photos"]; | |
NSArray* contents = [fileManager contentsOfDirectoryAtURL:directoryURL includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles error:NULL]; | |
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"pathExtension == 'jpg' OR pathExtension == 'jpeg'"]; | |
for (NSURL* fileURL in [contents filteredArrayUsingPredicate:predicate]) { | |
NSURL* rawFileURL = [[fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"raw"]; | |
if (![fileManager fileExistsAtPath:[rawFileURL path]]) { | |
[fileManager removeItemAtURL:fileURL error:NULL]; | |
} |
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
@interface AWRParallaxAnimationController : ECSlidingAnimationController <ECSlidingViewControllerLayout> | |
@property (nonatomic) CGFloat parallaxFactor; | |
@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
fatal: Not a git repository: /path/to/repo/.git/modules/Libraries/a-submodule | |
fatal: 'git status --porcelain' failed in submodule Libraries/another-submodule |
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
E restkit.network:RKObjectRequestOperation.m:213 GET 'http://REDACTED/apps/CJJeUXEVQ25KNdu5/radios' (200 OK / 0 objects) [request=0.1465s mapping=0.0000s total=0.2118s]: Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No response descriptors match the response loaded." UserInfo=0xa4dcb20 {NSErrorFailingURLStringKey=http://REDACTED/apps/CJJeUXEVQ25KNdu5/radios, NSLocalizedFailureReason=A 200 response was loaded from the URL 'http://REDACTED/apps/CJJeUXEVQ25KNdu5/radios', which failed to match all (1) response descriptors: | |
<RKResponseDescriptor: 0xa4bc030 baseURL=http://REDACTED/apps/CJJeUXEVQ25KNdu5/ pathPattern=radios statusCodes=200-299> failed to match: response path 'radios' did not match the path pattern 'radios'., NSLocalizedDescription=No response descriptors match the response loaded., keyPath=null, NSErrorFailingURLKey=http://REDACTED/apps/CJJeUXEVQ25KNdu5/radios, NSUnderlyingError=0xa4dcb80 "No mappable object representations were found at the key paths searched."} |
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
[Test] | |
public void SimpleTest() | |
{ | |
var calculator = Substitute.For<ICalculator>(); | |
int z; | |
calculator.Add(1, 2, out z).Returns(x => { x[2] = 2; return 3; }); | |
calculator.Add(4, 5, out z).Returns(x => { x[2] = 20; return 9; }); | |
Expect(calculator.Add(1, 2, out z), Is.EqualTo(3)); |
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
// SetCallback calls an instance of the class' SetCallback method | |
class ASE_PluginBase | |
{ | |
public: | |
ASE_PluginBase(); | |
~ASE_PluginBase(); | |
void SetGameObjectName( const char * sName ); | |
void SetMethodName( const char * sName ); |
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
// From library | |
typedef void (*Callback) ( int nEvent, const char* sMessage ); | |
void SetCallback( Callback * cbk ); | |
// My code | |
void MyCallback(int nEvent, const char* sMessage) { | |
// .... | |
} |