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
/** Utility for inserting new entries in set X preserving order defined in set M */ | |
- (void)_addEntry:(id)entryToInsert toSet:(NSMutableOrderedSet *)mutatingSet respectingOrderIn:(NSMutableOrderedSet *)masterSet | |
{ | |
NSInteger entryIdxInMaster = [masterSet indexOfObject:entryToInsert]; | |
NSAssert(entryIdxInMaster != NSNotFound, @"The setWithOrder must contain the entryToInsert"); | |
// Loop through the set and find the index of the place to insert the new entry | |
__block NSInteger idxToInsertBefore = NSNotFound; | |
[mutatingSet enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) | |
{ |
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
"yyyy-MM-d H:m:s" // 2015-03-12 16:01:22 | |
"EEE d LLL" // Thu 3 Feb |
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
a: AM/PM | |
A: 0~86399999 (Millisecond of Day) | |
c/cc: 1~7 (Day of Week) | |
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat | |
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday | |
d: 1~31 (0 padded Day of Month) | |
D: 1~366 (0 padded Day of Year) | |
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
NSDateFormatter *dateParser = [[NSDateFormatter alloc] init]; | |
dateParser.dateFormat = @"yyyy-MM-d H:m:s"; | |
return [dateParser dateFromString:self.estimatedArrivalDateStr]; |
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
static const CGFloat _BG_ALPHA = 0.3; | |
static const NSTimeInterval _ANIM_TIME = 0.3; | |
static UIWindow *_mainWindow; | |
static UIWindow *_alertWindow; | |
- (void)showExplainerScreen | |
{ | |
_mainWindow = [[UIApplication sharedApplication] keyWindow]; | |
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
_containerView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:_containerView.bounds cornerRadius:_containerView.layer.cornerRadius].CGPath; |
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
NSHTTPURLResponse *response = ((NSHTTPURLResponse *)[task response]); | |
NSDictionary *headers = [response allHeaderFields]; |
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
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init]; | |
fmt.numberStyle = NSNumberFormatterCurrencyStyle; | |
// fmt.alwaysShowsDecimalSeparator = YES; | |
// fmt.allowsFloats = YES; | |
// fmt.maximumFractionDigits = 2; | |
// fmt.locale = [NSLocale currentLocale]; Fixed for now | |
fmt.locale = [NSLocale localeWithLocaleIdentifier:@"en_GB"]; | |
_priceLbl.text = [fmt stringFromNumber:@(totalPrice)]; |
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
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
dateFormatter.dateFormat = @"EEE d LLL"; // Thu 3 Feb | |
_estimatedArrivalDate.text = [dateFormatter stringFromDate:estimatedDate]; |