Skip to content

Instantly share code, notes, and snippets.

@rabovik
rabovik / UIImage+RSSaveToDesktop.h
Last active December 25, 2015 00:59
Save UIImage to Desktop on iOS Simulator
#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;
@rabovik
rabovik / RSNSIndexSetMake.h
Created June 30, 2013 11:13
Easily creating NSIndexSet & NSMutableIndexSet
#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]]; \
} \
/**
* 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;
}