Skip to content

Instantly share code, notes, and snippets.

View mrtj's full-sized avatar

Janos Tolgyesi mrtj

View GitHub Profile
mrtj / TJIntegerArray.h
Last active July 18, 2018 19:47
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 February 12, 2013 09:41
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 December 12, 2015 10:48
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 February 15, 2013 11:56
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 December 14, 2015 04:39
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 March 6, 2013 09:18
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 December 14, 2015 18:59
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 December 15, 2015 05:49
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 December 16, 2015 05:59
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 15:58
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)