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
| // Clips the bottom left corner to a radius | |
| CGSize cornerSize = CGSizeMake(10,10); | |
| UIBezierPath *roundRectMaskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds | |
| byRoundingCorners:UIRectCornerBottomLeft | |
| cornerRadii:cornerSize]; | |
| CAShapeLayer *roundRectMaskLayer = [CAShapeLayer layer]; | |
| roundRectMaskLayer.frame = self.view.bounds; | |
| roundRectMaskLayer.path = roundRectMaskPath.CGPath; |
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
| Pod::Spec.new do |s| | |
| s.name = 'CSPlaceKitten' | |
| s.version = '0.0.1' | |
| s.summary = 'Automatically place adorable kittens as place holder images on your image views.' | |
| s.description = 'A place kitten category on top of the awesome UIImageView+AFNetworking category that will automatically place adorable kittens as place holder images on your image views.' | |
| s.homepage = 'https://github.com/cnstoll/CSPlaceKitten' | |
| s.license = {:type => 'MIT'} | |
| s.author = {'Conrad Stoll' => 'cnstoll@me.com'} | |
| s.requires_arc = true | |
| s.platform = :ios, '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
| HWWand *wand = [[HWWand alloc] init]; | |
| HWMagic *magic = [HWSpell genericSpell]; | |
| [wand setMagic:(__bridge HWSpell *)magic]; |
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)pauseLayer:(CALayer*)layer | |
| { | |
| CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil]; | |
| layer.speed = 0.0; | |
| layer.timeOffset = pausedTime; | |
| } | |
| -(void)resumeLayer:(CALayer*)layer | |
| { | |
| CFTimeInterval pausedTime = [layer timeOffset]; |
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
| UIGraphicsBeginImageContextWithOptions(size,YES,0.0); | |
| [image drawInRect:CGRectMake(0, 0, size.width, size.height)]; | |
| UIImage *deserializedImage = 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
| NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"pdf_name" ofType:@"pdf"];//this is assuming the pdf is in the main bundle | |
| NSInteger pageNumber = 1;//for a one-page PDF | |
| CGSize containerSize = self.imageView.bounds.size; | |
| UIGraphicsBeginImageContext(containerSize); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| const char *pdfFileName = [pdfPath cStringUsingEncoding:NSASCIIStringEncoding]; | |
| CGDataProviderRef pdfDataProvider = CGDataProviderCreateWithFilename(pdfFileName); | |
| CGPDFDocumentRef myDocument = CGPDFDocumentCreateWithProvider(pdfDataProvider); |
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
| #include "mach/mach_time.h" //NOT #import | |
| mach_timebase_info_data_t mach_info; | |
| mach_timebase_info(&mach_info); | |
| uint64_t start = mach_absolute_time(); | |
| //do stuff to time | |
| uint64_t finish = mach_absolute_time() - start; |
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
| - (id)initWithTitle:(NSString *)title | |
| delegate:(id)delegate | |
| animationImages:(UIImage *)firstImage, ...NS_REQUIRES_NIL_TERMINATION; |
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)viewWillAppear:(BOOL)animated{ | |
| [[LARSAdController sharedManager] addAdContainerToView:[self view] withViewController:self]; | |
| [[LARSAdController sharedManager] setGoogleAdPublisherId:myPublisherId]; //change publisher id unless you want me to have your monies | |
| [[LARSAdController sharedManager] layoutBannerViewsForCurrentOrientation:self.interfaceOrientation]; | |
| } | |
| -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ | |
| [[LARSAdController sharedManager] layoutBannerViewsForCurrentOrientation:toInterfaceOrientation]; | |
| } |
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
| #include <sys/types.h> | |
| #include <sys/sysctl.h> | |
| - (NSString *)hardwareDeviceModelCode{ | |
| size_t size; | |
| sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
| char *machine = malloc(size); | |
| sysctlbyname("hw.machine", machine, &size, NULL, 0); | |
| NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding]; | |
| free(machine); |
NewerOlder