Skip to content

Instantly share code, notes, and snippets.

@jamztang
jamztang / UIView+JTRemoveAnimated.h
Created October 3, 2011 18:35
Adding fade out effect on -[UIView removeFromSuperview]
//
// UIView+JTRemoveAnimated.h
//
// Created by james on 9/1/11.
// http://ioscodesnippet.tumblr.com/
//
@interface UIView (JTRemoveAnimated)
- (void)removeFromSuperviewAnimated;
@jamztang
jamztang / JTMainQueueProxy.h
Created October 2, 2011 17:37
Using NSProxy to perform operation on main thread easily
//
// JTMainQueueProxy.h
//
// Created by James Tang on 02/10/2011.
//
#import <Foundation/Foundation.h>
@interface JTMainQueueProxy : NSProxy {
id _proxiedTarget;
@jamztang
jamztang / JTInvocationManager.h
Created October 2, 2011 17:37
Easily perform list of operations on specific NSOperationQueue through NSProxy
//
// JTInvocationManager.h
//
// Created by James Tang on 02/10/2011.
//
#import <Foundation/Foundation.h>
@interface JTInvocationManager : NSProxy {
id _proxiedTarget;
@jamztang
jamztang / UIImage+JTImageDecode.h
Created October 2, 2011 05:40
Force UIImage to decompress
//
// UIImage+JTImageDecode.h
//
// Created by james on 9/28/11.
// http://ioscodesnippet.tumblr.com
//
@interface UIImage (JTImageDecode)
+ (UIImage *)decodedImageWithImage:(UIImage *)image;
@end
@jcsrb
jcsrb / gist:1081548
Created July 13, 2011 23:05
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
@andrewgleave
andrewgleave / iOSMapKitFitAnnotations.m
Last active May 17, 2024 02:07
Zooms out a MKMapView to enclose all its annotations (inc. current location)
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
//
// NSObject+PropertyListing.h
// PropertyFun
//
// Created by Andrew Sardone on 8/27/10.
//
#import <Foundation/Foundation.h>