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 <Foundation/Foundation.h> | |
@interface NSObject (Swizzling) | |
- (void)swizzleMethod:(SEL)originalSelector toMethod:(SEL)newSelector; | |
@end |
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
// Declare this property in your header / private header | |
@property (nonatomic, strong) NSMutableArray *updatingConstraints; | |
- (void)updateConstraints { | |
if (self.updatingConstraints) { | |
[self removeConstraints:self.updatingConstraints]; | |
} | |
self.updatingConstraints = [NSMutableArray array]; | |
// Create and add all of your constraints here |
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 <UIKit/UIKit.h> | |
@interface UIStoryboard (LDMain) | |
+ (instancetype)mainStoryboard; | |
@end |
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
Incident Identifier: 522DD016-33ED-4B63-B412-AAA86ADD0C6E | |
CrashReporter Key: 23e49df87511097784dee7a45d876f55f889ff39 | |
Hardware Model: iPad2,3 | |
Process: DocsetViewer [650] | |
Path: /var/mobile/Applications/027B8708-30A6-474D-9239-110622BD5F1E/DocsetViewer.app/DocsetViewer | |
Identifier: com.decafninja.docsetviewer | |
Version: 208 (1.4.1) | |
Code Type: ARM (Native) | |
Parent Process: launchd [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
- (void)drawRect:(CGRect)rect { | |
UIBezierPath *path = [UIBezierPath bezierPath]; | |
[path addArcWithCenter:CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)) radius:CGRectGetHeight(self.bounds) startAngle:0 endAngle:2.0*M_PI clockwise:YES]; | |
[path addArcWithCenter:CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)) radius:100 startAngle:0 endAngle:2.0*M_PI clockwise:NO]; | |
[path addClip]; | |
self.layer.cornerRadius = 10.0; | |
CGFloat colors[12] = { | |
0.1, 0.18, 0.54, 1.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
#define IMAGE_WIDTH 100.0 | |
#define IMAGE_HEIGHT 100.0 | |
@implementation SOMaskScrollView | |
- (id)initWithFrame:(CGRect)frame { | |
self = [super initWithFrame:frame]; | |
if (self) { | |
self.backgroundColor = [UIColor whiteColor]; | |
// Initialization code |
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
Array::select = (requestedElement) -> | |
count = {} | |
array = [] | |
for element in this | |
count[element] = (count[element] || 0) + 1 | |
if count[requestedElement] | |
for i in [1..count[requestedElement]] | |
array.push(requestedElement) | |
return array | |
else |
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
- (IBAction)startGame:(id)sender { | |
LDNViewController *ldnVC = [self.storyboard instantiateViewControllerWithIdentifier:@"gameController"]; | |
if (playerNameField.text != @"" && playerNameField.text != nil) { | |
ldnVC.game = [[LDNGoFishGame alloc] init]; | |
[ldnVC.game setupWithLivePlayer:playerNameField.text]; | |
[self presentModalViewController:ldnVC animated: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
NSMutableArray *cardRanks = [[NSMutableArray alloc] init]; | |
for (LDNPlayingCard *card in self.cards) { | |
[cardRanks addObject:card.rank]; | |
} | |
NSCountedSet *bagOfCardRanks = [[NSCountedSet alloc] initWithArray:cardRanks]; | |
NSString *modeOfRanks = [[NSString alloc] init]; | |
NSUInteger highestElementCount = 0; | |
for (NSString *rank in bagOfCardRanks) { | |
if ([bagOfCardRanks countForObject:rank] > highestElementCount) { | |
highestElementCount = [bagOfCardRanks countForObject:rank]; |