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
[EPPZAlert alertWithTitle:@"Do this?" | |
message:@"Let me know if you want to do this." | |
yes:^() { [self do]; } | |
no:^() { [self dont]; } | |
cancel:nil]; |
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
[EPPZAlert alertWithTitle:@"Download update?" | |
message:@"Downloading can take up to 40 seconds! Still want to proceed?" | |
buttonTitles:@[ @"Upload", @"Later" ] | |
completition:^(NSString *selectedButtonTitle) | |
{ | |
if ([selectedButtonTitle isEqualToString:@"Upload"]) | |
[self upload]; | |
if ([selectedButtonTitle isEqualToString:@"Later"]) | |
[self later]; |
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
SCNetworkReachabilityRef reachabilityRef = SCNetworkReachabilityCreateWithName(NULL, [@"google.com" UTF8String]); | |
SCNetworkReachabilityFlags reachabilityFlags; | |
SCNetworkReachabilityGetFlags(reachabilityRef, &reachabilityFlags); |
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
static void reachabilityCallback(SCNetworkReachabilityRef reachabilityRef, SCNetworkReachabilityFlags flags, void* info) | |
{ | |
RCViewController *viewController = (__bridge RCViewController*)info; //Cast context object. | |
[viewController showReachabilityFlags:flags]; //Show. | |
//Tear down reachability. | |
SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetMain(), kCFRunLoopDefaultMode); | |
CFRelease(reachabilityRef); | |
} |
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
if (asynchronous) //The asynchronous way, NOT WORKS (!!!) with IP addresses as host. | |
{ | |
//Set callback, dispatch callbacks on a background thread. | |
SCNetworkReachabilitySetCallback(reachabilityRef, reachabilityCallback, &context); | |
SCNetworkReachabilitySetDispatchQueue(reachabilityRef, dispatch_queue_create("com.eppz.reachability", nil)); | |
} | |
else //The synchronous way, works well with IP addresses as host. | |
{ | |
//Get flags. | |
SCNetworkReachabilityFlags flags; |
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
if (isAddressReachability) | |
{ | |
dispatch_async(dispatch_queue_create("com.eppz.reachability.workaround", NULL), ^ | |
{ | |
SCNetworkReachabilityFlags flags; | |
if (SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) | |
{ | |
//'Manual' invocation of callback functionality. | |
dispatch_async(dispatch_get_main_queue(), ^ //Dispatch delegate callback on the main thread. | |
{ |
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
#!/bin/sh | |
#Usage: export_snapshots 'eppz!alert/EPPZAlert.m' | |
DESTINATION_PATH='Snapshots' | |
FILE_PATH=$1 | |
FILE_NAME=$(basename $FILE_PATH) | |
echo 'Exporting <'$FILE_NAME'> located in <'$FILE_PATH'> to <'$DESTINATION_PATH'>.' |
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
#!/bin/sh | |
# Usage: | |
# | |
# export_snapshots 'eppz!alert/EPPZAlert.m' | |
# This will export every revision of the given file to 'Snaphots' folder with a filename scheme below. | |
# | |
# Snaphots/0_4a7cb92_BRViewController.m | |
# Snaphots/1_6cb85c7_BRViewController.m | |
# Snaphots/2_5550187_BRViewController.m |
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
//Like documented in http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html | |
@property(nonatomic,readonly) UITableViewStyle style; | |
@property(nonatomic,assign) id <UITableViewDataSource> dataSource; | |
@property(nonatomic,assign) id <UITableViewDelegate> delegate; | |
@property(nonatomic) CGFloat rowHeight; // will return the default value if unset | |
@property(nonatomic) CGFloat sectionHeaderHeight; // will return the default value if unset | |
@property(nonatomic) CGFloat sectionFooterHeight; |
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
-(UIImage*)snapshotUsingPrivateApi | |
{ | |
// Works fine, but private. | |
CGImageRef snapshot = UIGetScreenImage(); | |
UIImage *snapshotImage = [UIImage imageWithCGImage:snapshot]; | |
return snapshotImage; | |
} | |
-(UIImage*)snapshotUsingDrawHierarchy | |
{ |
OlderNewer