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
import Foundation | |
// ISO Formatting | |
extension NSDate { | |
static func ISOStringFromDate(date: NSDate) -> String { | |
let dateFormatter = NSDateFormatter() | |
dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") | |
dateFormatter.timeZone = NSTimeZone(abbreviation: "GMT") | |
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS" | |
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
// DefaultRefreshController.m | |
// | |
// Copyright (c) 2012 Instructure, Inc. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
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
//Some scattered methods for setting up iCloud storage of a SQLite Core Data managed database. | |
//define your ubiquity container id | |
-(NSString*)ubiquityContainerIdentifier { | |
//should match what is in your app's entitlement file | |
return [NSString stringWithFormat:@"%@.%@", @"<YOUR TEAM IDENTIFIER>", [[NSBundle mainBundle] bundleIdentifier]]; | |
} | |
//where you're going to store your database |
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
@interface NSColor(Additions) | |
- (CGColorRef)toCGColor; | |
@end | |
@implementation NSColor(Additions) | |
- (CGColorRef)toCGColor { | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
NSColor* selfCopy = [self colorUsingColorSpaceName:NSDeviceRGBColorSpace]; |
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
@interface NSString(ColorAdditions) | |
-(NSColor*)hexStringToNSColor; | |
@end | |
@implementation NSString(ColorAdditions) | |
-(NSColor *) hexStringToNSColor { | |
unsigned int c; | |
if ([self characterAtIndex:0] == '#') { |