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
#pragma mark - Embed Video | |
- (UIWebView *)embedVideoYoutubeWithURL:(NSString *)urlString andFrame:(CGRect)frame { | |
NSString *videoID = [self extractYoutubeVideoID:urlString]; | |
NSString *embedHTML = @"\ | |
<html><head>\ | |
<style type=\"text/css\">\ | |
body {\ | |
background-color: transparent;\ |
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
/** | |
@see http://stackoverflow.com/questions/3889687/how-to-compress-an-image-taken-by-the-camera-in-iphone-sdk | |
UIImage *image = [self scaleImage:myImage toSize:CGSizeMake(320.0,480.0)]; | |
*/ | |
-(UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)newSize { | |
UIGraphicsBeginImageContext(newSize); | |
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)]; | |
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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
/** | |
MKCoordinateRegion viewRegion = [self RegionForAnnotations:_arrayPois]; | |
[_mapView setRegion:viewRegion animated:YES]; | |
*/ | |
- (MKCoordinateRegion)RegionForAnnotations:(NSArray *)records { | |
MKCoordinateRegion region; | |
// center the map arround our records | |
// @see https://devforums.apple.com/message/48525#48525 |
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
/** | |
@see http://www.dbsnippets.com/2012/09/11/objective-c-redondear-esquinas-de-un-uiview/ | |
You must import basic Core Animation classes | |
#import <QuartzCore/QuartzCore.h> | |
Example: | |
[self roundView:backgroundColorView onCorner:(UIRectCornerAllCorners) radius:10.0]; | |
[self roundView:imgView onCorner:(UIRectCornerTopLeft|UIRectCornerBottomLeft) radius:5.0]; | |
*/ |
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 bool debuggerRunning(void) { | |
int junk; | |
int mib[4]; | |
struct kinfo_proc info; | |
size_t size; | |
info.kp_proc.p_flag = 0; | |
mib[0] = CTL_KERN; | |
mib[1] = KERN_PROC; |
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
+ (NSString *)MIMETypeForFileAtPath:(NSString *)path defaultMIMEType:(NSString *)defaultType | |
{ | |
NSString *result = defaultType; | |
NSString *extension = [path pathExtension]; | |
CFStringRef uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, | |
(CFStringRef)extension, | |
NULL); | |
if (uti) { | |
CFStringRef cfMIMEType = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType); | |
if (cfMIMEType) { |
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
git stash show -p stash@{0} > Stash0.patch |
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
__weak typeof(self) weakSelf = self; |
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
#pragma mark - Reveal | |
#import <dlfcn.h> | |
- (void)startReveal | |
{ | |
NSString *revealLibName = @"libReveal"; | |
NSString *revealLibExtension = @"dylib"; | |
NSString *dyLibPath = [[NSBundle mainBundle] pathForResource:revealLibName ofType:revealLibExtension]; | |
NSLog(@"Loading dynamic library: %@", dyLibPath); | |
void *revealLib = NULL; |
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
- (void)addGradientAnimation | |
{ | |
UIColor *color1 = [UIColor redColor]; | |
UIColor *color2 = [UIColor yellowColor]; | |
UIColor *color3 = [UIColor grayColor]; | |
CAGradientLayer *gradient = [CAGradientLayer layer]; | |
gradient.frame = self.view.frame; | |
gradient.colors = @[(id)color1.CGColor, (id)color2.CGColor, (id)color2.CGColor]; | |
OlderNewer