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
@implementation UIImage (Alpha) | |
- (UIImage *)alphaImage{ | |
CGRect imageRect = CGRectMake(0, 0, self.size.width, self.size.height); | |
CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); // create an RGB Color Space | |
// create the context to do our drawing in | |
CGContextRef context = CGBitmapContextCreate(NULL, imageRect.size.width, imageRect.size.height, 8, imageRect.size.width * 4, rgbColorSpace, kCGImageAlphaPremultipliedLast); | |
// use the images alpha channel as a mask | |
CGContextClipToMask(context, imageRect, self.CGImage); |
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 "NSWindow+Utilities.h" | |
@implementation NSWindow (Utilities) | |
- (void)setTopLeftRelativeToMainScreen:(CGPoint)topLeftPt{ | |
CGRect mainScreenVisibleFrame = NSScreen.mainScreen.visibleFrame; | |
CGPoint pt = CGPointZero; | |
pt.x = topLeftPt.x; | |
pt.y = mainScreenVisibleFrame.origin.y + mainScreenVisibleFrame.size.height - topLeftPt.y; | |
[self setFrameTopLeftPoint:pt]; |
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 "NSUserDefaults+Utilities.h" | |
@implementation NSUserDefaults (Utilities) | |
- (CGPoint)CGPointForKey:(NSString *)key | |
{ | |
CGPoint pt = CGPointZero; | |
NSArray *ptArray = [self objectForKey:key]; | |
if (ptArray != nil) |
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
find . -name ".svn" -exec rm -Rf {} \; |
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
.DS_Store | |
*.swp | |
*~.nib | |
build/ | |
*.pbxuser | |
*.perspective | |
*.perspectivev3 |
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
typedef void (^DrawBlock)(CGContextRef currentContext, CGRect drawRect, UIView *selfView); | |
@interface ZDrawView : UIView | |
@property (nonatomic, copy) DrawBlock drawBlock; | |
- (instancetype)initWithBlock:(DrawBlock)block; | |
+ (instancetype)viewWithBlock:(DrawBlock)block; |
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 OrderedDictionary : NSObject <NSCopying, NSCoding>{ | |
NSMutableDictionary *_dictionary; | |
NSMutableArray *_array; | |
} | |
@property (readonly) NSUInteger count; | |
- (id)init; | |
- (id)initWithCapacity:(NSUInteger)capacity; | |
+ (id)dictionary; |
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> | |
extern NSString *const ZZiptasticCityKey; | |
extern NSString *const ZZiptasticStateKey; | |
extern NSString *const ZZiptasticCountryKey; | |
extern NSString *const ZURLHTTPErrorCode; | |
typedef void (^ZZiptasticBlock)(NSDictionary *location, NSError *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
To encode | |
> base64 -i [source.binary] -o [destination.base64] | |
To decode | |
> base64 -D -i [source.base64] -o [destination.binary] | |
To encode directly into the clipboard | |
> base64 < [source.binary] | pbcopy |
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 "UIImage+UIViewCapture.h" | |
#import <QuartzCore/QuartzCore.h> | |
@implementation UIImage (UIViewCapture) | |
+ (UIImage *)imageWithView:(UIView *)view{ | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0); | |
[view.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); |
OlderNewer