Skip to content

Instantly share code, notes, and snippets.

View gonecoding's full-sized avatar

Michael Thiel gonecoding

View GitHub Profile
gonecoding / Implementation.m
Created November 28, 2011 13:56
Persistent Unique Identifier (GUID, UUID, UDID)
UUIDs (Universally Unique Identifiers), also known as GUIDs (Globally Unique Identifiers)
or IIDs (Interface Identifiers), are 128-bit values guaranteed to be unique. A UUID is
made unique over both space and time by combining a value unique to the computer on which
it was generated—usually the Ethernet hardware address—and a value representing the number
of 100-nanosecond intervals since October 15, 1582 at 00:00:00.
#define AppDelegateDefaultsKeyPersistentUniqueIdentifier @"AppDelegateDefaultsKeyPersistentUniqueIdentifier"
gonecoding / Implementation.m
Created October 13, 2011 16:50
Adding two ore more UIBarButtonItems to one side of an UINavigationItem (pre iOS 5.0)
UIBarButtonItem* firstButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(someSelector:)] autorelease]; = UIBarButtonItemStyleBordered; // must be set manually
UIBarButtonItem* secondButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Title" style:UIBarButtonItemStyleBordered target:self action:@selector(someSelector:)] autorelease];
UIToolbar* toolbar = [[[UIToolbar alloc] initWithFrame:CGRectMake( 0.0, 0.0, 100.0, 44.0 )] autorelease];
toolbar.barStyle = -1; // removes background, undocumented, make break one day
toolbar.tintColor = self.navigationController.navigationBar.tintColor;
gonecoding / Header.h
Created October 11, 2011 15:42
Template for a Shared Instance (Singleton) in Objective-C
+ (NSObject*)sharedInstance;
gonecoding / Header.h
Created August 11, 2011 09:33
Example of an Objective-C method with a variable list of arguments (va_list)
- (void)methodName:(NSObject*)firstObject, ... NS_REQUIRES_NIL_TERMINATION;
gonecoding / Readme.markdown
Created February 22, 2011 12:42
Adding methods to NSData and NSString using categories to provide AES256 encryption on iOS

Important notice

I took down this Gist due to concerns about the security of the encryption/decryption part of this code (see comments below).

Rob Napier (@rnapier) has created a publicly available class that provides similar AES encryption/decryption functionality at