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
| - (CGSize)sizeThatFits:(CGSize)size | |
| { | |
| CGSize neededSize = [self intrinsicContentSize]; // creates layout frame if necessary | |
| if (neededSize.width>=0 && neededSize.height>=0) | |
| { | |
| return neededSize; | |
| } | |
| // 1 |
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
| // test if there is a byte trunction happening | |
| for (int i=0; i<32; i++) | |
| { | |
| __unsafe_unretained id pointer = (__bridge id)(void *)(1<<i); | |
| NSUInteger v = (int)pointer; | |
| if (pointer) | |
| { |
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 <Availability.h> | |
| #if __has_feature(objc_arc_weak) | |
| #define DT_WEAK_IVAR_IF_SUPPORTED __weak | |
| #define DT_WEAK_PROPERTY_IF_SUPPORTED weak | |
| #elif __has_feature(objc_arc) | |
| #define DT_WEAK_IVAR_IF_SUPPORTED __unsafe_unretained | |
| #define DT_WEAK_PROPERTY_IF_SUPPORTED assign | |
| #endif |
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
| // get a time stamp from a pebble time struct | |
| long timestampFromTime(PblTm time) | |
| { | |
| return (((time.tm_mday * 24) + time.tm_hour) * 60 + time.tm_min) * 60 + time.tm_sec; | |
| } | |
| long timeintervalBetweenTimes(PblTm time1, PblTm time0) | |
| { | |
| long timestamp1 = timestampFromTime(time1); | |
| long timestamp0 = timestampFromTime(time0); |
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
| // | |
| // DTSQLiteDatabase.h | |
| // DTFoundation | |
| // | |
| // Created by Oliver Drobnik on 5/22/13. | |
| // Copyright (c) 2013 Drobnik.com. All rights reserved. | |
| // | |
| /** | |
| A wrapper for SQLite databases which offers threadsafe concurrency and support for cancelling long-running operations. |
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
| // get source image | |
| NSData *imageData = _picture.imageData; | |
| CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)(imageData), NULL); | |
| CGImageRef sourceImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); | |
| CFRelease(source); | |
| CGRect imageRect = CGRectZero; | |
| imageRect.size.width = CGImageGetWidth(sourceImage); | |
| imageRect.size.height = CGImageGetHeight(sourceImage); | |
| imageRect.origin.x = -imageRect.size.width/2.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
| Hello <FIRST_NAME>, | |
| Thank you for contacting us regarding WWDC 2013. | |
| Enthusiasm for this year's conference has been incredible and tickets sold out in record time. | |
| <PERSON> can still take advantage of all the great WWDC content, as we'll be posting videos of all our sessions during the conference. | |
| If you have any further questions please let us know by sending an email to wwdc@apple.com. |
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)drawInRect:(CGRect)rect context:(CGContextRef)context | |
| { | |
| CGContextDrawImage(context, rect, self.image.CGImage); | |
| } |
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
| Pod::Spec.new do |spec| | |
| spec.name = 'DTLoupe' | |
| spec.version = '1.3.0' | |
| spec.platform = :ios, '4.3' | |
| spec.license = 'COMMERCIAL' | |
| spec.source = { :git => 'git@git.cocoanetics.com:parts/dtloupe.git', :tag => spec.version.to_s } | |
| spec.source_files = 'Core/Source/*.{h,m}' | |
| spec.frameworks = 'QuartzCore' | |
| spec.requires_arc = true | |
| spec.homepage = 'http://www.cocoanetics.com/parts/dtloupeview/' |
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
| - (NSAttributedString *)attributedStringWithString:(NSString *)string highlightedwithOccurencesOfString:(NSString *)stringToHighlight inColor:(DTColor *)color | |
| { | |
| // build an attributed string to start with | |
| // font | |
| DTCoreTextFontDescriptor *fontDesc = [[DTCoreTextFontDescriptor alloc] init]; | |
| fontDesc.fontFamily = @"Helvetica"; | |
| fontDesc.pointSize = 20; | |
| // paragraph style |