Skip to content

Instantly share code, notes, and snippets.

View Duraiamuthan's full-sized avatar

Durai Amuthan Duraiamuthan

View GitHub Profile
@Duraiamuthan
Duraiamuthan / gist:d6dc27b954ca348d494f
Created October 28, 2014 17:11
KeychainUtils for storing and getting credentials
//SFHFKeychainUtils.h
#import <UIKit/UIKit.h>
@interface SFHFKeychainUtils : NSObject {
}
+ (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error;
+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error;
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
@Duraiamuthan
Duraiamuthan / AddAnnotation
Last active August 29, 2015 14:00
AddAnnotation in Mapview
-(void)MarkMapwithLat:(NSString*)lat withLong:(NSString*)longi
{
NSLog(@"Latitude:%@ Longitude:%@",lat,longi);
CLLocationCoordinate2D coord=CLLocationCoordinate2DMake(lat.floatValue,longi.floatValue);
MKAnnotation *annotation=[[MKAnnotation alloc]initWithCoordinate:coord title:self.Name andsubTitle:customerSnippet];
MKCoordinateRegion viewRegion=MKCoordinateRegionMakeWithDistance(coord,500,500);
@Duraiamuthan
Duraiamuthan / MapAnnotation
Last active August 29, 2015 14:00
iOS Map Annotation
//header
@interface MKAnnotation : NSObject<MKAnnotation>
@property (strong, nonatomic) NSString *title;
@property (strong, nonatomic) NSString *subtitle;
@property (nonatomic,assign) CLLocationCoordinate2D coordinate;
-(id) initWithCoordinate:(CLLocationCoordinate2D)Coordinate title:(NSString *)Title andsubTitle:(NSString*)Subtitle;
@end
//implementation
@Duraiamuthan
Duraiamuthan / GeoLocation
Last active August 29, 2015 14:00
Objective C GeoLocations finder
//Header
#import <Foundation/Foundation.h>
#import "CoreLocation/CoreLocation.h"
@interface GeoLocation : NSObject<CLLocationManagerDelegate,UIAlertViewDelegate>
{
CLLocationManager *locationManager;
double latitude;
double longitude;
}
@Duraiamuthan
Duraiamuthan / CommonFunctions
Created April 21, 2014 16:14
Objective C CommonFunctions
//Header
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "NSString+UrlEncode.h"
@interface CommonFunctions:NSObject
+(void)MakeIOS6StyleStatusBar:(UIView*)vu;
@Duraiamuthan
Duraiamuthan / NSString+UrlEncode
Created April 21, 2014 16:08
Objective C UrlEncode Category
//header
@interface NSString (UrlEncode)
- (NSString *)urlencode;
@end
//implementation
#import "NSString+UrlEncode.h"
@Duraiamuthan
Duraiamuthan / JSON serialization
Created April 21, 2014 16:03
Objective c object to json string serialization
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:ObjcObject options:NSJSONWritingPrettyPrinted error:&writeError];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
@Duraiamuthan
Duraiamuthan / JSON deserialization
Created April 21, 2014 16:01
NSData(JSON) to Objective C Object
NSData *dataJSON;
dataJSON=service output;
NSArray *arr=[NSJSONSerialization JSONObjectWithData:dataJSON options:kNilOptions error:&jsonParsingError];
@Duraiamuthan
Duraiamuthan / SQLite ObjC DAL
Created April 21, 2014 15:56
SQLite Objective C Data Access Layer
//DAL.h
#import <UIKit/UIKit.h>
#import <sqlite3.h>
@interface DAL : NSObject
{
sqlite3* sqLiteObj;
NSString* dataBasePath;
}
@property(strong,nonatomic)NSString *DbName;
-(NSMutableArray *)RetrieveRecordswithSql:(NSString *)sql withColumnsCount:(NSNumber *)count andColumnsDelimiter:(NSString *)colDelimiter;