Skip to content

Instantly share code, notes, and snippets.

View grgcombs's full-sized avatar

Greg Combs grgcombs

View GitHub Profile
@grgcombs
grgcombs / GenericsExampleForObjC.h
Last active July 11, 2016 17:13
Obj-C Generics Example
// 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);
@grgcombs
grgcombs / regression.swift
Created July 31, 2016 01:04 — forked from jarsen/regression.swift
Univariate Linear Regression
import Cocoa
class CSVDoubleSequence: SequenceType {
typealias GeneratorType = IndexingGenerator<Array<Double>>
let path: String
let values: [Double]
init(path: String) {
self.path = path
@grgcombs
grgcombs / NSPersonNameComponents+Sort.h
Last active May 18, 2017 17:54
Sorting a collection of people by NSPersonNameComponents
#import <Foundation/Foundation.h>
@interface NSPersonNameComponents(Sort)
- (NSComparisonResult)compare:(NSPersonNameComponents *)other;
- (NSComparisonResult)compare:(NSPersonNameComponents *)other options:(NSStringCompareOptions)mask;
@end