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
@interface HKZDogParkAPIClient : NSObject | |
- (void)fetchProfile:(int)profileId block:(void(^)(NSDictionary *dog, NSError* error))clientBlock; | |
- (void)signup:(void(^)(NSDictionary *dog, NSError* error))clientBlock; | |
@end |
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
@interface HKZDogParkAPIClient : NSObject | |
- (void)fetchProfile:(int)profileId block:(void(^)(NSDictionary *dog, NSError* error))clientBlock; | |
- (void)signup:(void(^)(NSDictionary *dog, NSError* error))clientBlock; | |
@end |
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
// beforeEach/afterEach are Kiwi constructs | |
beforeEach(^{ | |
//register as Protocol delegate, the magic begins | |
[NSURLProtocol registerClass:[ILCannedURLProtocol class]]; | |
// Default HTTP status code | |
[ILCannedURLProtocol setCannedStatusCode:200]; | |
// Configure ILtesting only for certain verbs if you like |
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
#import "HKZFakeWebserver.h" | |
@implementation HKZFakeWebserver | |
// This function returns the correct JSON data, or whatever for the requested URL | |
// via the ILURLProtocol | |
- (NSData *)responseDataForClient:(id<NSURLProtocolClient>)client request:(NSURLRequest*)request { | |
NSData *responseData = nil; | |
// Dog profile information |
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
@protocol ILCannedURLProtocolDelegate <NSObject> | |
- (NSData*)responseDataForClient:(id<NSURLProtocolClient>)client request:(NSURLRequest*)request; | |
@optional | |
- (BOOL)shouldInitWithRequest:(NSURLRequest*)request; | |
- (NSURL *)redirectForClient:(id<NSURLProtocolClient>)client request:(NSURLRequest *)request; | |
- (NSInteger)statusCodeForClient:(id<NSURLProtocolClient>)client request:(NSURLRequest*)request; | |
- (NSDictionary*)headersForClient:(id<NSURLProtocolClient>)client request:(NSURLRequest*)request; | |
@end |
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
// Example for Turquoise | |
// rgb(26, 188, 156) | |
[UIColor colorWithRed:26/255.0f green:188/255.0f blue:156/255.0f alpha:1.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
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
alert = UIAlertView.alloc.initWithTitle("Oh yeah!", message:"OHHAI!", delegate:nil, cancelButtonTitle:"OK", otherButtonTitles:nil) | |
alert.show | |
true | |
end | |
end |
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
// classical merge algo | |
Array.prototype.mergesort = function() { | |
console.log(this) | |
if(this.length == 1) { | |
return this; | |
} | |
var merge = function(left, right){ | |
var sorted = []; | |
var l = r = 0; | |
while(l < left.length && r < right.length){ |
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
// Whenever a button, tap , or something 'happens' within a cell subclass, send a message up thee olde Responder Chain | |
// -- within tablecell_subclass.m | |
- (IBAction)connectButtonClicked:(id)sender { | |
SEL selConnectButton = sel_registerName("connectButtonResponder:"); | |
[[UIApplication sharedApplication] sendAction:selConnectButton to:nil from:self forEvent:nil]; | |
} | |
// within the UITableViewController , responde to the selector "connectButtonResponder" |
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
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { | |
NSString *filteredString = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""]; | |
NSInteger textLength = [textField.text length] - range.length + [filteredString length]; | |
if (textLength > 0) { | |
self.redeemButton.enabled = YES; | |
} | |
else { |