Instantly share code, notes, and snippets.

View UIImage+RSSaveToDesktop.h
#if TARGET_IPHONE_SIMULATOR
@interface UIImage (RSSaveToDesktop)
/// Creates a RSUIImage directory on desktop and saves image to it.
-(void)rs_saveToDesktop;
/// Creates a RSUIImage directory on desktop and saves image to it with specified name.
-(void)rs_saveToDesktopWithName:(NSString *)customName;
View RSNSIndexSetMake.h
#ifndef RSNSMutableIndexSetMake
#ifndef RSNSIndexSetMake
#define RSNSMutableIndexSetMake(INDEXES...) \
({ \
NSUInteger indexes[] = {INDEXES}; \
NSUInteger count = sizeof(indexes)/sizeof(NSUInteger); \
NSMutableIndexSet *mutableIndexSet = [NSMutableIndexSet indexSet]; \
for (int i = 0; i < count; ++i){ \
[mutableIndexSet addIndex:indexes[i]]; \
} \
View RSWeakifySelf.h
/**
* Several macros simplifying use of weak references to self inside blocks
* which goal is to reduce risk of retain cycles.
*
* Example:
* @code
@interface Example : NSObject{
int _i;
}