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 INSTANTIATE(viewController) [[UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:viewController]; |
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 IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO: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
po [[self view] recursiveDescription] |
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 "DDASLLogger.h" | |
#import "DDTTYLogger.h" | |
int ddLogLevel = LOG_LEVEL_VERBOSE; | |
#pragma mark Initialization | |
- (void) initializeLoggers { | |
[DDLog addLogger:[DDASLLogger sharedInstance]]; | |
[DDLog addLogger:[DDTTYLogger sharedInstance]]; | |
[[DDTTYLogger sharedInstance] setColorsEnabled: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
#ifndef Constants_h | |
#define Constants_h | |
#pragma mark some useful macros | |
#define DEFAULTS [NSUserDefaults standardUserDefaults] | |
#define DEFAULTS_SET(key, value) [[NSUserDefaults standardUserDefaults] setObject:value forKey:key]; [[NSUserDefaults standardUserDefaults] synchronize]; | |
#define INSTANTIATE(viewController) [[UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:viewController]; | |
#define INSTANTIATE_VIEW(name) [[[NSBundle mainBundle] loadNibNamed:name owner:self options:nil] objectAtIndex: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
#import <UIKit/UIKit.h> | |
@interface UIColor (Shorthand) | |
+ (UIColor*) colorWithR: (unsigned char) r G: (unsigned char) g B: (unsigned char) b A: (float) a; | |
@end |
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 UIImage (Color) | |
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size; | |
@end |
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
The trick is to read the declaration backwards (right-to-left): | |
const int a = 1; // read as "a is an integer which is constant" | |
int const a = 1; // read as "a is a constant integer" | |
Both are the same thing. Therefore: | |
a = 2; // Can't do because a is constant | |
The reading backwards trick especially comes in handy when you're dealing with more complex declarations such as: | |
const char *s; // read as "s is a pointer to a char that is constant" |
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
[user] | |
name = Kamil Burczyk | |
email = [email protected] | |
[core] | |
excludesfile = /Users/kamil/.gitignore_global | |
[difftool "sourcetree"] | |
cmd = opendiff \"$LOCAL\" \"$REMOTE\" | |
path = | |
[mergetool "sourcetree"] | |
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" |
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
var list = [8,1,55,34,13,8,5,0,1,3,2,21] | |
func quicksort1(list:[Int]) -> [Int] { | |
if list.count == 0 { | |
return [] | |
} | |
let pivotValue = list[0] | |
let smaller = filter(list, { $0 < pivotValue }) | |
smaller |
OlderNewer