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 "NSString+UUID.h" | |
@implementation NSString (UUID) | |
+ (NSString *)UUIDString | |
{ | |
CFUUIDRef UUID = CFUUIDCreate(NULL); | |
CFStringRef string = CFUUIDCreateString(NULL, UUID); | |
CFRelease(UUID); | |
return (__bridge_transfer NSString *)string; |
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
// Inspired by suggestion to use NSScanner: http://stackoverflow.com/questions/1918972/camelcase-to-underscores-and-back-in-objective-c | |
#import "NSString+Inflections.h" | |
@implementation NSString (Inflections) | |
- (NSString *)underscore | |
{ | |
NSScanner *scanner = [NSScanner scannerWithString:self]; | |
scanner.caseSensitive = YES; |
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
// | |
// UITextView+Dimensions.h | |
// | |
// Created by Justin Driscoll on 1/6/12. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UITextView (Dimensions) |
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
// | |
// NSManagedObject+MAK.h | |
// | |
// Created by Justin Driscoll on 2/21/12. | |
// | |
#import <CoreData/CoreData.h> | |
@interface NSManagedObject (MAK) |
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
@property (nonatomic, assign) BOOL viewHasInitialLayout; | |
- (void)viewDidLayoutSubviews | |
{ | |
[super viewDidLayoutSubviews]; | |
if (!self.viewHasInitialLayout) { | |
// Do stuff | |
self.viewHasInitialLayout = YES; | |
} |
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
- (UIImage *)resize:(CGSize)size quality:(CGInterpolationQuality)interpolationQuality | |
{ | |
UIGraphicsBeginImageContextWithOptions(size, NO, 1.0f); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextSetInterpolationQuality(context, interpolationQuality); | |
[self drawInRect:CGRectMake(0.0, 0.0, size.width, size.height)]; | |
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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
// | |
// JCDActionSheetDelegate.h | |
// Created by Justin Driscoll on 4/3/13. | |
// | |
#import <UIKit/UIKit.h> | |
typedef void (^JCDActionSheetDelegateCallback)(UIActionSheet *actionSheet, NSInteger buttonIndex); | |
@interface JCDActionSheetDelegate : NSObject <UIActionSheetDelegate> |
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
CGImageRef rawImageRef = [image CGImage]; | |
CFDataRef imageDataRef = CGDataProviderCopyData(CGImageGetDataProvider(rawImageRef)); | |
const UInt8 *rawPixelData = CFDataGetBytePtr(imageDataRef); | |
NSUInteger imageHeight = CGImageGetHeight(rawImageRef); | |
NSUInteger imageWidth = CGImageGetWidth(rawImageRef); | |
int brightness = 0; | |
int red = 0; |
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
// | |
// JCDActionSheetDelegate.h | |
// Created by Justin Driscoll on 4/3/13. | |
// | |
#import <UIKit/UIKit.h> | |
typedef void (^JCDActionSheetDelegateCallback)(UIActionSheet *actionSheet, NSInteger buttonIndex); | |
@interface JCDActionSheetDelegate : NSObject <UIActionSheetDelegate> |
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
// | |
// NSManagedObject+JSON.h | |
// Rego | |
// | |
// Created by Justin Driscoll on 7/29/13. | |
// Copyright (c) 2013 Makalu Inc. All rights reserved. | |
// | |
#import <CoreData/CoreData.h> |