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 | |
// | |
/*! | |
@function ADVGetExecutionTime | |
@abstract Measure code execution time | |
@param block | |
code block to execute | |
@result elapsed time (in nanoseconds) |
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/sh | |
percentage=$( ioreg -rS -c BNBMouseDevice -k BatteryPercent -d 1 | grep BatteryPercent | tail -1 | awk '{print $NF}' ) | |
if [ "$percentage" == "" ]; then | |
echo "Disconnected"; | |
else | |
if ((50 <= percentage)); then | |
color=32; #green | |
elif ((20 <= percentage)); then |
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
// enable double clicking from the Macintosh Finder or the Windows Explorer | |
#target photoshop | |
const ScriptResult = | |
{ | |
CANCEL: 'cancel' // quit, returning 'cancel' (dont localize) makes the actions palette not record our script | |
}; | |
function exportGroups(document, folder, retina) | |
{ |
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; |
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 © 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 © 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 © 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
/* 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 | |
// | |
extern BOOL ADVUserInterfaceIdiomIsPhone; |
OlderNewer