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
- (void) testDaysSinceSignificantDateCrossingDaylightSavingsChange { | |
SignificantEvent *testEvent = nil; | |
NSInteger expectedResult = 2; | |
NSInteger testResult = 0; | |
NSDate *preDaylightSavingsDate = nil; | |
NSDate *postDaylightSavingsDate= nil; | |
NSCalendar *calendar = [self testCalendar]; | |
preDaylightSavingsDate = [calendar dateWithEra:1 year:2015 month:3 day:7 hour:12 minute:0 second:0 nanosecond: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
@interface PreDaylightSavingsEvent : SignificantEvent | |
@property (nonatomic, readwrite, copy) NSDate *currentDate; | |
@end | |
@implementation PreDaylightSavingsEvent | |
@synthesize currentDate = _currentDate; | |
@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
- (NSDate *) currentDate { | |
return [NSDate date]; | |
} | |
- (NSInteger) numberOfDaysInThePast{ | |
NSInteger result = 0; | |
NSDate *now = [self currentDate]; | |
NSTimeInterval diff = 0; | |
diff = [now timeIntervalSinceDate:[self eventDate]]; |
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
- (NSInteger) numberOfDaysInThePast{ | |
NSInteger result = 0; | |
NSDate *now = [NSDate date]; | |
NSTimeInterval diff = 0; | |
diff = [now timeIntervalSinceDate:[self eventDate]]; | |
result = diff / (24 * 60 * 60); | |
return result; | |
} |
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 SignificantEvent : NSObject | |
@property (nonatomic, readonly, copy) NSDate *eventDate; | |
- (instancetype) initWithEventDate:(NSDate *)eventDate; | |
@end | |
@interface SignificantEvent (DaysSince) | |
- (NSInteger) numberOfDaysInThePast; |
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
id retryAfterValue = [[(NSHTTPURLResponse *)response allHeaderFields] valueForKey:@"Retry-After"]; | |
if (retryAfterValue != nil){ | |
NSMutableDictionary *editedHeaders = [NSMutableDictionary dictionaryWithDictionary:[(NSHTTPURLResponse *)response allHeaderFields]]; | |
// Max-age should be calculated based on the retry-after value, which can be an integer or a string date | |
NSString *maxAgeString = [NSString stringWithFormat:@"max-age=%@" , retryAfterValue]; | |
[editedHeaders setValue:maxAgeString forKey:@"Cache-Control"]; | |
// Retry-after header must be removed | |
[editedHeaders setValue:nil forKey:@"Retry-After"]; | |
NSHTTPURLResponse *editedResponse = [[NSHTTPURLResponse alloc] initWithURL:[response URL] statusCode:[(NSHTTPURLResponse *)response statusCode] HTTPVersion:(NSString *)kCFHTTPVersion1_1 headerFields:[editedHeaders copy]]; | |
NSCachedURLResponse *cachedResponse = [[NSCachedURLResponse alloc] initWithResponse |
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
headers: | |
_ASAsyncTransaction.h | |
_ASAsyncTransactionGroup.h | |
_ASDisabledPanUITextView.h | |
_ASDisplayLayer.h | |
_ASDisplayLayerDelegate-Protocol.h | |
_ASDisplayView.h | |
_ASImageNodeDrawParameters.h | |
_ASPendingState.h | |
_ASTextNodeCachedMetrics.h |
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
xcodebuild test -configuration Debug -dry-run -showBuildSettings -sdk iphonesimulator |
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
{ | |
"firstName": "John", | |
"lastName": "Bigboote", | |
"href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAcCAMAAAA3HE0QAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBQTFRFNjEvuYqJbVNMSEQ8tLK1xZeWJxsaYmZrjYqOBgQE29bUGRcXnHl1c11XqHV1SjMrh2pkSklAeHh4XUlDy8fGUT0yQDo4VlhZRiwkr4OCpIF9NSAaXWJmbmlpkXd2lWhnZWpwWEQ3flZUUlBLDgoJUDcsmZih39vYGxAOW19gjXJqPyQdgHx+aW90eHNvwr+9YV5ac3B0gGFclHJu2NPQ0s3MZWNiEhAQcXJvmV1i5ODd+Pn4goKGZ0I/qqWpnpaWwhvcSwAAApVJREFUeNpM0tmWojAQBuBiMYhBAREE4gKyqVHRoKA9gu//VlPp7jNngJML6qsfKgB5RzugZk4gTVO/wDNV1en6+XxeLpf28AZKOwn2tl+EfmGHjBcpmmuWXS8uBBpgneLCfJ+zkDPG/TRkRRq4T/1P2cEBOpMSoPswtJntc87Vo6Mybtt5Tp4tpRkQ0wQgrAh5uFPVnbBiy/EwyzTzIAB2giw3O0p9O+S9Zc1iRYliR2BUZ5okC54DjPdoWcF46ESRokjQHFXCMdl0tbcOOsEIKNi+sCJlNBopSrzZCMKgw+myTwU1AgohIXbzDZBYxykhWgAQtPoD7mDmHdiM2c4viNUitCUINHeuQ3UxKWUFx3dQRkrciJ5gmg+ahvXspsPiQzoCNufM8/yQ8J0qiunUCyXI2vIB9SfA12Gc7fdgE1so25Hai6mvaRgwryu4V+McJ+pfYRpFu91WzEazXoj0Byy+YDJZEDM3d7Ndb8l9GClR1PdTLOP1XFQI7kFHc/6Kts1MzhE1jiqE5rqu5q7rCYKqJpSSXlFwqzEjiizhCV+ToNXvCC |
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 NSURLResponse(QUELL_IANACharacterSetEncoding) | |
- (NSStringEncoding) QUELL_stringEncoding; | |
@end | |
@implementation NSURLResponse(QUELL_IANACharacterSetEncoding) | |
- (NSStringEncoding) QUELL_stringEncoding { | |
NSStringEncoding result = [NSString defaultCStringEncoding]; | |
CFStringEncoding cfEncoding = CFStringGetSystemEncoding(); | |
NSString *ianaCharSetName = [self textEncodingName]; | |