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 "tgmath.h" | |
CGRect ADVRectScaleToSize(CGRect sourceRect, CGSize targetSize, UIViewContentMode contentMode) | |
{ | |
CGSize sourceSize = sourceRect.size; | |
CGFloat horizontalRatio = targetSize.width / sourceSize.width; | |
CGFloat verticalRatio = targetSize.height / sourceSize.height; | |
CGFloat ratio; |
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
// Simple implementation (not thread-safe) | |
+ (Singleton *) sharedSingleton | |
{ | |
static Singleton *instance; | |
if (nil == instance) | |
{ | |
instance = [self new]; | |
} | |
return instance; | |
} |
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
#!/bin/bash | |
# +----------------------------------------------------------------------+ | |
# | | | |
# | Mount the root file system / with the option noatime | | |
# | | | |
# | By Philipp Klaus <http://blog.philippklaus.de> | | |
# | Tip found on <http://blogs.nullvision.com/?p=275> | | |
# | | | |
# +----------------------------------------------------------------------+ |
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
// | |
// Copyright © 2012 Yuri Kotov | |
// | |
extern BOOL ADVUserInterfaceIdiomIsPhone; |
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
/* All measurements were done on iPhone 4 */ | |
// MRC: | |
// for loop: 1.891520ms | |
// NSFastEnumeration: 0.393583ms | |
// enumerateObjectsUsingBlock: 0.547250ms | |
// ARC (w/o __unsafe_unretained): | |
// for loop: 6.889979ms | |
// NSFastEnumeration: 0.394479ms |
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
// | |
// Copyright © 2012 Yuri Kotov | |
// | |
#import <UIKit/UIKit.h> | |
@interface ADVTableView : UITableView | |
- (void) registerNib:(UINib *)nib forCellReuseIdentifier:(NSString *)identifier; |
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
// | |
// Copyright © 2012 Yuri Kotov | |
// | |
#import <UIKit/UIKit.h> | |
@interface UILabel (NibFont) | |
@property (nonatomic, copy) NSString *fontName; | |
@property (nonatomic) CGFloat fontSize; |
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
// | |
// Copyright © 2010 Yuri Kotov | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSError (ADVAlertPresentation) | |
- (void) displayInAlert; |
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
// | |
// Copyright © 2011 Yuri Kotov | |
// | |
#import <UIKit/UIKit.h> | |
typedef void(^ADVSheetAction) (); | |
@interface ADVActionSheet : UIActionSheet <UIActionSheetDelegate> |
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
// | |
// Copyright © 2011 Yuri Kotov | |
// | |
#import <Foundation/Foundation.h> | |
@interface ADVNetworkActivityIndicator : NSObject | |
+ (ADVNetworkActivityIndicator *) sharedIndicator; |