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
{ | |
"version": 8, | |
"name": "Bright", | |
"metadata": { | |
"mapbox:autocomposite": false, | |
"mapbox:groups": { | |
"1444849242106.713": {"collapsed": false, "name": "Places"}, | |
"1444849334699.1902": {"collapsed": true, "name": "Bridges"}, | |
"1444849345966.4436": {"collapsed": false, "name": "Roads"}, | |
"1444849354174.1904": {"collapsed": true, "name": "Tunnels"}, |
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
// Definitions | |
NSDictionary *son = @{ @"firstname" : @"James", @"lastname" : @"Appleseed" }; | |
NSDictionary *daughter = @{ @"firstname" : @"Susan", @"lastname" : @"Appleseed"}; | |
NSArray *children = @[son, daughter]; | |
NSDictionary *father = @{ @"firstname" : @"John", @"lastname" : @"Appleseed" }; | |
NSDictionary *family = @{@"children" : children, @"father" : father}; | |
NSDictionary *pedigree = @{@"family" : family }; | |
// First test | |
id _family = [pedigree objectForKey:@"family"]; |
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
// The issue: the Twitter API returns so called 'tweet entities' for each tweet. These entities contain the ranges | |
// of hashtags, mentions and urls in the tweet. In iOS, emoji's have a length of 2. The Twitter API uses 1 as length | |
// for the emoji's. So when you try to change the foreground color attribute in the range Twitter gives, you change | |
// the foreground color of a part of the emoji. The affected thread will freeze and ultimately crash. | |
// This code fixes the issue with emoji's, but does not yet work with composed character sequences longer than 2. | |
// Feel free to fork/comment. | |
NSRange range; // The old, corrupted range that doesn't take emoji's in account | |
NSString *string; // The string |
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
How to detect whether a tableview is scrolling or not? | |
- KVO on isDragging and isDecelerating? | |
NO. isDragging and isDecelerating are not KVO compliant. | |
- UITableView subclass with custom isScrolling property + UIScrollViewDelegate? | |
NO. UIScrollViewDelegate methods don't work in the UITableView subclass. | |
Ugly solution: implement 7 UIScrollViewDelegate methods in your viewcontroller subclass. Result: messy 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
- (void)start | |
{ | |
NSData *imageData = [self dataFromImage:self.image]; | |
//NSInteger maxBytes = 3145728; | |
NSInteger maxBytes = 30000; | |
NSInteger compressedSize = imageData.length; | |
NSLog(@"Compressed size: %i", compressedSize); | |
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
NSInteger g = 50; //bovengrens voor random getallen | |
NSInteger f = 20; //aantal benodigde random getallen | |
NSInteger i = 0; //loop var | |
NSMutableArray *chosenNumbers = [NSMutableArray array]; //container voor gekozen getallen | |
while (i < f) { | |
NSInteger random = arc4random() % g; | |
NSNumber *randomNumber = [NSNumber numberWithInt:random]; | |
if ([chosenNumbers containsObject:randomNumber]) { | |
f++; | |
} 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
NSArray *names = @[@"Name", @"Name2", @"Name3", @"Name4"]; | |
NSMutableArray *predicateStrings = [NSMutableArray array]; | |
[names enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
[predicateStrings addObject:[NSString stringWithFormat:@"firstName == %@", obj]]; | |
}]; | |
NSString *predicateString = [predicateStrings componentsJoinedByString:@" || "]; | |
NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateString]; |