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
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); |
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
<?php | |
function curl_download($Url){ | |
// is cURL installed yet? | |
if (!function_exists('curl_init')){ | |
die('Sorry cURL is not installed!'); | |
} | |
// OK cool - then let's create a new cURL resource handle |
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
To get the parent's location from iFrame: parent.location | |
To restrict the pages to be embedded inside iFrame: | |
if(document.location != parent.location){ | |
parent.location = document.location | |
} |
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
self.myView.layer.masksToBounds = NO; | |
self.myView.layer.shadowColor = [UIColor blackColor].CGColor; | |
self.myView.layer.shadowOffset = CGSizeMake(0.0f, 2.0f); | |
self.myView.layer.shadowOpacity = 0.7f; | |
self.myView.layer.shadowRadius = 3.0f; |
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
<!-- Mobile meta & links --> | |
<!-- Reference | |
Custom Icon and Image Creation Guidelines: | |
http://developer.apple.com/library/safari/#documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html | |
Configuring Web Applications: | |
http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/configuringwebapplications/configuringwebapplications.html |
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
// #Lighter r,g,b,a #Darker r,g,b,a | |
#define MAIN_COLOR_COMPONENTS { 0.153, 0.306, 0.553, 1.0, 0.122, 0.247, 0.482, 1.0 } | |
#define LIGHT_COLOR_COMPONENTS { 0.478, 0.573, 0.725, 1.0, 0.216, 0.357, 0.584, 1.0 } | |
@implementation UINavigationBar (UINavigationBarCategory) | |
- (void)drawRect:(CGRect)rect { | |
if (imageReady) { | |
UIImage *img = [UIImage imageNamed: @"navigation_background.png"]; | |
[img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; |
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
@interface UINavigationBar (MyCustomNavBar) | |
@end | |
@implementation UINavigationBar (MyCustomNavBar) | |
- (void) drawRect:(CGRect)rect { | |
//matching the button color with the bar color | |
[self setTintColor:[UIColor colorWithRed:0.85f green: 0 blue:0 alpha:1]]; | |
UIImage *barImage = [UIImage imageNamed:@"image.png"]; | |
[barImage drawInRect:rect]; | |
} | |
@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
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 9999)]; | |
myLabel.lineBreakMode = UILineBreakModeWordWrap; | |
myLabel.numberOfLines = 0; | |
myLabel.text = @"Some \n dynamic \n multiline \n text"; | |
[myLabel sizeToFit]; // This shrinks the 9999 down to the size of the text | |
NSLog(@"Actual height is: %f", myLabel.frame.size.height); // Use this for spacing any further elements | |
[self.view addSubview:title]; // Or add it to a scroll view, or whatever... | |
[myLabel release]; |
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
- (BOOL) isMultitaskingCapable | |
{ | |
UIDevice* device = [UIDevice currentDevice]; | |
BOOL backgroundSupported = NO; | |
if ([device respondsToSelector:@selector(isMultitaskingSupported)]) | |
backgroundSupported = device.multitaskingSupported; | |
return backgroundSupported; | |
} |
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
// Method returns no, when the user doesn't have any photos | |
[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]; | |
// Check for camera | |
- (BOOL) isVideoCameraAvailable | |
{ | |
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType]; | |
[picker release]; | |
OlderNewer