This file contains 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
def assert_equal(a, b) | |
puts "#{a}.should == #{b}" | |
end | |
def assert_not_nil(a) | |
puts "#{a}.should_not == nil" | |
end | |
def assert_raise(*all_args) | |
puts "Cannot convert assert_raise" |
This file contains 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)drawFromPosition:(CGPoint)location view:(UIView *)view size:(CGFloat)size { | |
UIImage *cardImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@.png", [[self.suit substringToIndex:1] lowercaseString], [[self.rank substringToIndex:1] lowercaseString]]]; | |
UIImageView *cardImageView = [[UIImageView alloc] initWithFrame:CGRectMake(location.x, location.y, cardImage.size.width*size, cardImage.size.height*size)]; | |
[cardImageView setImage:cardImage]; | |
[view addSubview:cardImageView]; | |
} |
This file contains 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]; |
This file contains 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 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 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 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 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 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 |
OlderNewer