Skip to content

Instantly share code, notes, and snippets.

View Duraiamuthan's full-sized avatar

Durai Amuthan Duraiamuthan

View GitHub Profile
@Duraiamuthan
Duraiamuthan / iOS 7 toolbar to iOS 6 toolbar converter
Created April 10, 2014 09:27
Convert iOS 7 toolbar's style to iOS 6
use the below code snippet inside the
application:didFinishLaunchingWithOptions:
[[UIToolbar appearance]setBackgroundImage:[UIImage imageNamed:@"toolBarImage.png"] forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
Download the toolBarImage from http://bit.ly/1lMdc5R
@Duraiamuthan
Duraiamuthan / UDID Alternative
Last active August 29, 2015 13:58
UDID alternative in iOS 6+
Is UDID deprecated?
Yes. UDID is deprecated in iOS 5.
What are the alternatives?
identifierForVendor and advertisingIdentifier.
What is identifierForVendor?
@Duraiamuthan
Duraiamuthan / Unique identifiers
Created April 5, 2014 09:31
UDID vs UUID vs GUID
UUID:
It is the acronym of Universally Unique Identifier.
A sequence of 128 bits that can guarantee uniqueness across space and time, defined by RFC 4122.
GUID:
It is the acronym of Globally Unique Identifier
It is Microsoft's implementation of the UUID specification; often used interchangeably with UUID.
In dot net framework its called as Plain GUID and in sql server its called as newid
UDID:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Disables home</string>
<key>PayloadDisplayName</key>
@Duraiamuthan
Duraiamuthan / 0_reuse_code.js
Created October 10, 2013 10:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Duraiamuthan
Duraiamuthan / gist:6729138
Created September 27, 2013 14:08
to mark a method as unavailable
#import <Foundation/Foundation.h>
@interface SampleClass : NSObject
- (id)init __attribute__((unavailable("init is unavailable")));
@end
@Duraiamuthan
Duraiamuthan / gist:6657383
Created September 22, 2013 06:50
objective c format number as comma added currency
NSNumberFormatter *currencyFormatter = [[[NSNumberFormatter alloc] init] autorelease];
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
double d2 = 3432.89;
NSString *strCurrency = [currencyFormatter stringFromNumber:[NSNumber numberWithDouble:d2]];
NSLog(@"%@", strCurrency);
@Duraiamuthan
Duraiamuthan / Objetive c number formatter
Created September 22, 2013 06:49
Objetctive c format the numbers with commas
NSNumberFormatter *formatter = [[[NSNumberFormatter alloc] init] autorelease];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
double d =324233.89;
int i = 324324324;
NSString *strFloat = [formatter stringFromNumber:[NSNumber numberWithDouble:d]];
NSString *strInt = [formatter stringFromNumber:[NSNumber numberWithInt:i]];
NSLog(@"Float: %@", strFloat);
@Duraiamuthan
Duraiamuthan / gist:6657126
Created September 22, 2013 06:03
Objective C find if a text exists in string
-(BOOL)Contains:(NSString *)StrSearchTerm on:(NSString *)StrText
{
return [StrText rangeOfString:StrSearchTerm options:NSCaseInsensitiveSearch].location==NSNotFound?FALSE:TRUE;
}