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)sizeOfContentsWithSize:(CGSize)size | |
shouldLayout:(BOOL)shouldLayout { | |
// Calculate frames. | |
if (shouldLayout) { | |
// Update frames. | |
} | |
return // size | |
} |
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
// | |
// BMXRubberBanding.h | |
// Rubber-banding Formula, as described by Grant Paul (chpwn) | |
// https://twitter.com/chpwn/status/285540192096497664 | |
// | |
#ifndef TimerApp_BMXRubberBanding_h | |
#define TimerApp_BMXRubberBanding_h | |
#define BMX_RUBBER_BANDING_CONSTANT 0.55 |
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 BHSCollectionViewFlowLayout | |
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { | |
NSArray *allAttrs = [super layoutAttributesForElementsInRect:rect]; | |
for (UICollectionViewLayoutAttributes *attributes in allAttrs) { | |
attributes.frame = CGRectIntegral(attributes.frame); | |
} | |
return allAttrs; | |
} |
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
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) ) |
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
extern void CGPathPrint(CGPathRef path, FILE* file); | |
CGPathPrint(path.CGPath, NULL); | |
Path 0xb44e380: | |
moveto (-12, 295) | |
lineto (115, 295) | |
lineto (108, -12) | |
lineto (235, -12) |
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)scrollViewDidScroll:(UIScrollView *)scrollView | |
{ | |
const CGFloat threshHold = -60.0f; | |
const float minOpacity = 0.2; | |
CGFloat currentOffset = [scrollView contentOffset].x; | |
if (currentOffset < 0.0) | |
{ | |
CGFloat currentProgress = currentOffset / threshHold; | |
[scrollView setAlpha:MAX(1.0 - (1.0 * currentProgress), minOpacity)]; |
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
// Smart little helper to find main thread hangs. Enable in appDidFinishLaunching. | |
// Only available with source code in DEBUG mode. | |
@interface PSPDFHangDetector : NSObject | |
+ (void)startHangDetector; | |
@end | |
@implementation PSPDFHangDetector | |
+ (void)startHangDetector { | |
#ifdef DEBUG |
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
// | |
// NSString+Cheddar.m | |
// Cheddar | |
// | |
// Created by Sam Soffes on 6/10/12. | |
// Copyright (c) 2012 Nothing Magical. All rights reserved. | |
// | |
#import "NSString+Cheddar.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
- (void)drawTextInRect:(CGRect)rect | |
{ | |
[super drawTextInRect:rect]; | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
NSString *fontName = self.font.fontName; | |
CGFloat fontSize = self.font.pointSize; | |
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)fontName, fontSize, NULL); |
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
NSString *safe = self.keys.url.port.stringValue; | |
NSString *unsafe = @"url.port.stringValue"; | |
assert([safe isEqualToString:unsafe]); |