Skip to content

Instantly share code, notes, and snippets.


Janos Tolgyesi mrtj

View GitHub Profile
mrtj / TJIntegerArray.h
Last active Jul 18, 2018
Simple Objective C wrapper around a C integer array. Supports fast enumeration via NSNumber objects. #integer #array #objective-c License: BSD
View TJIntegerArray.h
// Author:
// License: BSD
#import <Foundation/Foundation.h>
@interface TJIntegerArray : NSObject <NSFastEnumeration>
NSInteger* _array;
mrtj / NSString+RandomFileName.h
Created Feb 12, 2013
Utility class extension for creating random / temporary file names in one of the common directories of the current user's domain. #utility #nsstring #filename #random #objective-c
View NSString+RandomFileName.h
#import <Foundation/Foundation.h>
@interface NSString (RandomFileName)
+(NSString*)randomFileNameInDirectory:(NSSearchPathDirectory)directory withExtension:(NSString*)extension;
mrtj / NSString+URLEncoding.h
Last active Dec 12, 2015
URL encoding and decoding utility class extension for NSString #nsstring #utility #url-encoding #url-decoding #objective-c
View NSString+URLEncoding.h
#import <Foundation/Foundation.h>
@interface NSString (URLEncoding)
- (NSString*)URLEncodedString;
- (NSString*)URLDecodedString;
mrtj / UIImage+Retina4.h
Created Feb 15, 2013
Extends [UIImage imageNamed:] method to consider also -568h@2x suffices of images targeted for Retina 4" devices. #iOS #objective-c #retina #ui #utility
View UIImage+Retina4.h
#import <UIKit/UIKit.h>
@interface UIImage (Retina4)
+ (UIImage *)imageNamedRetina4:(NSString *)imageName;
mrtj / TJSettingsManager.h
Last active Dec 14, 2015
A wrapper class around NSUserDefaults that adds compile time type and spell check to keys stored in user defaults. Usage: inherit from this class and define your properties in your header (currently only NSInteger and BOOL types are supported). In the implementation mark all properties as @dynamic much like in managed object derivates. All of yo…
View TJSettingsManager.h
#import <Foundation/Foundation.h>
@interface TJSettingsManager : NSObject
NSUserDefaults* _userDefaults;
mrtj / UIImageView+OfflineCache.h
Created Mar 6, 2013
UIImageView category to download images asynchronously using the cache policy of the HTTP server if it is reachable otherwise look up for the image resource in the local HTTP cache. Depends on AFNetworking UIImageView category and Reachability components. #utils #image #UIImageView #cache #http #download
View UIImageView+OfflineCache.h
#import <UIKit/UIKit.h>
@interface UIImageView (OfflineCache)
placeholderImage:(UIImage *)placeholderImage
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;
mrtj / TJXMLParser.h
Last active Dec 14, 2015
Simple DOM based XML parser #cocoa #xml #parser #utils #dom
View TJXMLParser.h
#import <Foundation/Foundation.h>
@interface TJXMLElement : NSObject
@property (nonatomic, readonly) NSString* name;
@property (nonatomic, readonly) NSDictionary* attributes;
@property (nonatomic, retain) NSMutableArray* children;
@property (nonatomic, retain) NSMutableString* text;
- (id) initWithName:(NSString*)name withAttributes:(NSDictionary*)attributes;
mrtj / RectUtils.h
Last active Dec 15, 2015
Simple CGRect utils #core-graphics #objective-c #utils #cgrect
View RectUtils.h
#include <CoreGraphics/CGGeometry.h>
CG_INLINE CGRect CGRectChangeSize(CGRect rect, CGSize size);
CG_INLINE CGRect CGRectChangeWidth(CGRect rect, CGFloat width);
CG_INLINE CGRect CGRectChangeHeight(CGRect rect, CGFloat height);
CG_INLINE CGRect CGRectChangeOrigin(CGRect rect, CGPoint origin);
mrtj / UIColorFromRGB.h
Last active Dec 16, 2015
UIColor from 0x123456 style unsigned integer
View UIColorFromRGB.h
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
mrtj / NSURL+QueryParser.h
Created May 20, 2013
NSURL category to parser GET parameters from the URL into a NSDictionary #objective-c #utils #url
View NSURL+QueryParser.h
#import <Foundation/Foundation.h>
@interface NSURL (QueryParser)