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
| public extension NSIndexPath { | |
| // Allows us to split NSIndexPaths | |
| public subscript (subrange: Range<Int>) -> NSIndexPath? { | |
| guard subrange.startIndex >= 0 else { | |
| return nil | |
| } |
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
| if let tabViewController = self.contentViewController?.childViewControllerWithType(NSTabViewController) { | |
| // tabViewController is an NSTabViewController, woop! | |
| } |
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
| a: “We’re in X!” | |
| b: “Where is everyone?” | |
| c: “Hey we’re in Y!” | |
| d: “Hey we’re in Z!! Come join us!” | |
| c: “@a Oh, we tweeted at the same time, want to come to Y or we can head to X?” | |
| a: “@c We’ll head to you guys” | |
| b: “@a A few of us will head to you at X” |
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 HealthKit | |
| public extension HKWorkout { | |
| public func predicateForSamplesDuringActivePeriods() -> NSPredicate { | |
| let subpredicates = activePeriods.map { start, end -> NSPredicate in | |
| HKQuery.predicateForSamplesWithStartDate(start, endDate: end, options: .StrictStartDate | .StrictEndDate) |
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
| cd "$PROJECT_DIR" | |
| infoPlist="${SRCROOT}/${INFOPLIST_FILE}" | |
| infoPath="${infoPlist%.*}" | |
| infoName=$(basename "${infoPath}") | |
| infoHeader="${infoPath}.h" | |
| infoImplementation="${infoPath}.m" | |
| infoHeaderImport=$(basename "${infoHeader}") | |
| rm -f "$infoHeader" |
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 Foundation; | |
| typedef void(^DCTAuthPlatformCompletion)(BOOL success); | |
| typedef void(^DCTAuthPlatformURLOpener)(NSURL *URL, DCTAuthPlatformCompletion completion); | |
| typedef void(^DCTAuthPlatformExpirationHandler)(); | |
| typedef id(^DCTAuthPlatformBeginBackgroundTaskBlock)(DCTAuthPlatformExpirationHandler expirationHandler); | |
| typedef void(^DCTAuthPlatformEndBackgroundTaskBlock)(id identifier); | |
| @interface DCTAuthPlatform : NSObject |
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
| if (error) { | |
| // In your app, handle this error really beautifully. | |
| NSLog(@"An error occured in %@: %@", NSStringFromSelector(_cmd), error); | |
| abort(); | |
| } | |
| // In your app, handle this error in an awe-inspiring way. | |
| // In your app, masterfully handle this error. | |
| // In your app, handle this error like a pro. | |
| // In your app, handle this error gracefully. |
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 UIKit; | |
| @interface ASRKeyboardNotificationValues : NSObject | |
| - (instancetype)initWithNotification:(NSNotification *)notification; | |
| @property (nonatomic, readonly) NSNotification *notification; | |
| @property (nonatomic, readonly) NSTimeInterval animationDuration; | |
| @property (nonatomic, readonly) UIViewAnimationCurve animationCurve; | |
| @property (nonatomic, readonly) UIViewAnimationOptions animationOptions; |
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
| CGRect PSPDFRectSafeInset(CGRect rect, CGFloat dx, CGFloat dy) { | |
| CGRect insetRect = CGRectInset(rect, dx, dy); | |
| if (CGRectIsNull(insetRect)) { | |
| insetRect = CGRectMake(CGRectGetMidX(rect), CGRectGetMidY(rect), 0.f, 0.f); | |
| } | |
| return insetRect; | |
| } |
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 HealthKit | |
| let quantityType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierBodyMass) | |
| let query = HKSampleQuery(sampleType:quantityType, predicate:nil, limit:0, sortDescriptors:nil) { | |
| query, results, error in | |
| // results is [AnyObject] | |
| let samples = results.filter { | |
| ($0 as? HKQuantitySample) != nil |