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/bash | |
# Simple script to convert p12 -> pem files | |
# Depends on openssl | |
# Params | |
# $1 Certificate File | |
# $2 Key File | |
if [ $# -lt 2 ] | |
then | |
echo "Bad number of arguments" |
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
/* | |
File: GetPathsOperation.m | |
Abstract: NSOperation code for directory and file enumeration. | |
Version: 1.2 | |
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple | |
Inc. ("Apple") in consideration of your agreement to the following | |
terms, and your use, installation, modification or redistribution of | |
this Apple software constitutes acceptance of these terms. If you do |
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
UIColor *gradientPattern; | |
NSString *text; | |
//The text to draw | |
text = @"Ultra cool text, the designer insisted on"; | |
//Load the gradient from disk as a color | |
gradient = [UIColor colorWithPatternImage:[UIImage imageNamed:@"gradient.png"]]; | |
//Draw |
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
-(UIImage*) imageForAsset:(ALAsset*) aAsset{ | |
ALAssetRepresentation *rep; | |
rep = [aAsset defaultRepresentation]; | |
return [UIImage imageWithCGImage:[rep fullResolutionImage]]; | |
} |
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
//Create the layer | |
layer = [CALayer layer]; | |
//Configure the animation | |
animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; | |
[animation setCalculationMode:kCAAnimationDiscrete]; | |
[animation setDuration:2.0f]; | |
[animation setRepeatCount:HUGE_VALF]; |
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
#import <Foundation/Foundation.h> | |
typedef void (^NSManagedObjectContextFetchCompleteBlock)(NSArray* results); | |
typedef void (^NSManagedObjectContextFetchFailBlock)(NSError *error); | |
@interface NSManagedObjectContext (NSManagedObjectContext_blocks) | |
-(void)executeFetchRequestInBackground:(NSFetchRequest*) aRequest | |
onComplete:(NSManagedObjectContextFetchCompleteBlock) completeBlock |
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 managedObjectContext] executeFetchRequestInBackground:request | |
onComplete:^(NSArray *results){ | |
DebugLog(@"Results %@", results); | |
} | |
onError:^(NSError *error){ | |
DebugLog(@"Error %@", error); | |
} | |
]; |
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
# XCode 4 auto-versioning script for Git | |
# Inspired by the work of Axel Andersson, Marcus S. Zarra and Matt Long | |
# http://valthonis.net/u/19 | |
""" | |
NOTE: Due to its use of build environment variables, this | |
script will only work from inside XCode's build process! | |
""" | |
import os |
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
//Create a pill with the given rect | |
- (CGPathRef) newPathForRoundedRect:(CGRect)rect radius:(CGFloat)radius | |
{ | |
CGMutablePathRef retPath = CGPathCreateMutable(); | |
CGRect innerRect = CGRectInset(rect, radius, radius); | |
CGFloat inside_right = innerRect.origin.x + innerRect.size.width; | |
CGFloat outside_right = rect.origin.x + rect.size.width; | |
CGFloat inside_bottom = innerRect.origin.y + innerRect.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
-(UIImage*) imageWithSize:(CGSize) aSize block:(void(^)(CGContextRef ctx)) aBlock{ | |
CGContextRef context; | |
void *bitmapData; | |
CGColorSpaceRef colorSpace; | |
int bitmapByteCount; | |
int bitmapBytesPerRow; | |
CGImageRef image; | |
UIImage *finalImage; | |