I hereby claim:
- I am zoejessica on github.
- I am zoejessica (https://keybase.io/zoejessica) on keybase.
- I have a public key whose fingerprint is FB40 ACD5 4224 8770 4470 6C39 035A F65B 02C1 4E6B
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
extension Array { | |
func chunk<T : Equatable>(by valueToCompare: (Element) -> T) -> [[Element]] { | |
var currentValue = self[0] | |
var startIndex = 0 | |
var splits = [[Element]]() | |
for (index, value) in self.enumerate() { | |
if valueToCompare(value) != valueToCompare(currentValue) { | |
let newSplit = self[startIndex..<index] | |
splits.append(Array(newSplit)) | |
startIndex = index |
#import <UIKit/UIKit.h> | |
IB_DESIGNABLE @interface BadgedPin : UIView | |
@property (nonatomic, assign) IBInspectable CGFloat badgeDiameter; | |
@property (nonatomic, strong) IBInspectable UIColor *badgeColor; | |
@property (nonatomic, assign) IBInspectable CGFloat badgeStrokeWidth; | |
@property (nonatomic, strong) IBInspectable UIColor *fillColor; | |
@property (nonatomic, strong) IBInspectable NSString *imageName; |
// http://stackoverflow.com/a/16881312/2199136 | |
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
NSString *cellIdentifier = [self cellIdentifierForIndexPath:indexPath]; | |
static NSMutableDictionary *heightCache; | |
if (!heightCache) | |
heightCache = [[NSMutableDictionary alloc] init]; | |
NSNumber *cachedHeight = heightCache[cellIdentifier]; | |
if (cachedHeight) | |
return cachedHeight.floatValue; | |
// In a subclass of UITableViewCell: | |
- (void)awakeFromNib { | |
// http://stackoverflow.com/a/14127936/2199136 | |
[super awakeFromNib]; | |
[self layoutIfNeeded]; | |
self.originalSize = self.bounds.size; | |
self.originalimportantUIElementSize = self.originalimportantUIElement.bounds.size; | |
} |
// http://benscheirman.com/2014/03/quick-look-debugging-with-uiview/ | |
#import "UIView+DebugObject.h" | |
@implementation UIView (DebugObject) | |
- (id)debugQuickLookObject { | |
UIGraphicsBeginImageContext(self.frame.size); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
[self.layer renderInContext:context]; |