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/Foundation.h> | |
@interface NSPersonNameComponents(Sort) | |
- (NSComparisonResult)compare:(NSPersonNameComponents *)other; | |
- (NSComparisonResult)compare:(NSPersonNameComponents *)other options:(NSStringCompareOptions)mask; | |
@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
import Cocoa | |
class CSVDoubleSequence: SequenceType { | |
typealias GeneratorType = IndexingGenerator<Array<Double>> | |
let path: String | |
let values: [Double] | |
init(path: String) { | |
self.path = path | |
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
// I borrowed pieces of this from the generics implementations in FaceBook's Bolts Framework and the Parse SDK | |
@import Foundation; | |
@class GRGCollectionItemTypeClass<__covariant CodableCollectionItem:NSObject<NSCopying,NSSecureCoding> *>; | |
@interface GRGCollectionClass<__covariant CodableCollectionItem:NSObject<NSCopying,NSSecureCoding> *> : NSObject<NSFastEnumeration> | |
typedef BOOL(^GRGNextCollectionItemBlock)(GRGCollectionItemTypeClass<CodableCollectionItem> *nextItem); |
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
/** | |
* Taken from @jspahrsummers: | |
* | |
* To avoid preprocessor definition collisions when working with third-party frameworks | |
* try this... | |
*/ | |
#define strongify myPrefix_strongify | |
#define weakify myPrefix_weakify | |
#define onExit myPrefix_onExit |
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
//: angleGradientImage - Ported to Swift from http://stackoverflow.com/a/33991838/136582 | |
import UIKit | |
import CoreImage | |
public func angleGradientImage(size: CGSize, radius: Float?, scale: CGFloat?, colors: (start:UIColor, end:UIColor)?) -> UIImage? { | |
let gradientRadius = (radius != nil) ? radius! : Float(min(size.width,size.height) - 2) | |
let gradientScale = (scale != nil) ? scale! : UIScreen.mainScreen().scale | |
let startColor : CIColor | |
let endColor : CIColor |
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
// | |
// PRHAngleGradientFilter.h | |
// | |
// Created by Peter Hosey on 2013-01-30. | |
// Copyright (c) 2013 Peter Hosey. All rights reserved. | |
// | |
#import <QuartzCore/QuartzCore.h> | |
@interface PRHAngleGradientFilter : CIFilter |
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 | |
// MARK: - Comparable | |
extension NSDecimalNumber: Comparable {} | |
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool { | |
return lhs.compare(rhs) == .OrderedSame | |
} |
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
/* | |
Enhancement Request for Core Data | |
Apple Radar Issue #11130505 | |
http://openradar.appspot.com/radar?id=3173403 | |
I'd like to see an expansion of the Core Data framework that allows us to add a | |
transient property's underlying code via a block assigned on an | |
NSPropertyDescription, in order to provide an easy means to use transient properties | |
without subclassing the managed object. |
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)itShouldLoadFromNetworkUpdatingFromEmptyToFullWithSections { | |
[self bootstrapEmptyStoreAndCache]; | |
[self stubObjectManagerToOnline]; | |
UITableView* tableView = [UITableView new]; | |
RKFetchedResultsTableControllerSpecViewController* viewController = [RKFetchedResultsTableControllerSpecViewController new]; | |
RKFetchedResultsTableController* tableController = | |
[[RKFetchedResultsTableController alloc] initWithTableView:tableView viewController:viewController]; | |
tableController.resourcePath = @"/JSON/humans/all.json"; | |
tableController.sectionNameKeyPath = @"name"; |
NewerOlder