Skip to content

Instantly share code, notes, and snippets.

View tewha's full-sized avatar

Steven Fisher tewha

  • 03:23 (UTC -07:00)
View GitHub Profile
@tewha
tewha / gist:5265978
Last active December 15, 2015 13:18
This is a category on UIImage.
- (UIImage *)rxScalePropertionallyToMaximumSize:(CGSize)maxSize blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha scale:(CGFloat)scale {
if ((maxSize.width < 1.0e-15) || (maxSize.height < 1.0e-15)) return nil;
CGSize imageSize = self.size;
CGSize scaleFactors = {
.width = maxSize.width / imageSize.width,
.height = maxSize.height / imageSize.height,
};
@stevestreza
stevestreza / NSURL+Pieces.h
Created September 26, 2011 19:52
A method for debugging NSURLs to find where the different pieces of your URL are
#import <Foundation/Foundation.h>
@interface NSURL (Pieces)
-(NSDictionary *)piecesDictionary;
@end