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
#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
// 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
- (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
#import "AppDelegate.h" | |
#import "ViewController.h" | |
#import "DTHTMLParser.h" | |
@interface AppDelegate () <DTHTMLParserDelegate> | |
@end | |
@implementation AppDelegate |
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
// | |
// BCKEAN13Code.m | |
// BarCodeKit | |
// | |
// Created by Oliver Drobnik on 8/9/13. | |
// Copyright (c) 2013 Oliver Drobnik. All rights reserved. | |
// | |
#import "BCKEAN13Code.h" |
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
(lldb) po [self.view recursiveDescription] | |
<UIScrollView: 0x8b96320; frame = (0 0; 320 568); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x8b990c0>; layer = <CALayer: 0x8b96530>; contentOffset: {0, 0}> | |
| <_UILayoutGuide: 0x8b96720; frame = (0 0; 0 20); hidden = YES; layer = <CALayer: 0x8b96790>> | |
| <_UILayoutGuide: 0x8b96ac0; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x8b96b30>> | |
| <UIImageView: 0x8b98b70; frame = (316.5 561; 3.5 7); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer: 0x8b98c50>> | |
| <UIImageView: 0x8b98330; frame = (313 564.5; 7 3.5); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer: 0x8b986c0>> | |
| <ContentView: 0x8b99eb0; frame = (0 0; 2000 2000); layer = <DTTiledLayerWithoutFade: 0x8b95c80>> | |
(lldb) po self.view.constraints | |
<__NSArrayM 0x8a67630>( | |
<_UILayoutSupportConstraint:0x8b96f10 V:[_UILayoutGuide:0x8b96720(20)]>, |
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)viewDidLayoutSubviews | |
{ | |
[super viewDidLayoutSubviews]; | |
CGFloat topInset = 0; | |
CGFloat bottomInset = 0; | |
if ([self respondsToSelector:NSSelectorFromString(@"topLayoutGuide")]) | |
{ | |
id topLayoutGuide = [self valueForKeyPath:@"topLayoutGuide"]; |
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
@implementation ExpandButton | |
{ | |
NSLayoutConstraint *_widthConstraint; | |
} | |
- (id)initWithFrame:(CGRect)frame | |
{ | |
CGFloat smallerDim = MIN(frame.size.height, frame.size.width); | |
self = [super initWithFrame:frame]; |
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
@implementation DTProgressReportingURLProtocol | |
{ | |
NSURLConnection *_connection; | |
dispatch_semaphore_t _semaphore; | |
} | |
+ (BOOL)canInitWithRequest:(NSURLRequest *)request | |
{ | |
NSLog(@"%@", [self propertyForKey:@"UserAgentSet" inRequest:request]); |