Skip to content

Instantly share code, notes, and snippets.

View inturbidus's full-sized avatar

Matt Hudson inturbidus

View GitHub Profile
@inturbidus
inturbidus / gist:4527097
Created January 14, 2013 01:09
SortUsingComparator
[unsortedArray sortUsingComparator:^ NSComparisonResult(SearchResultItem *d1, SearchResultItem *d2) {
NSInteger doorID1 = d1.doorID;
NSInteger doorID2 = d2.doorID;
if (doorID1 > doorID2)
return NSOrderedAscending;
if (doorID1 < doorID2)
return NSOrderedDescending;
return [d1.handel localizedCompare: d2.handel];
};
}
@inturbidus
inturbidus / gist:4526874
Created January 13, 2013 23:45
Clip of time of NSDate
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[calendar setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
NSDateComponents *dateComponents = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:self];
NSDate *midnightUTC = [calendar dateFromComponents:dateComponents];