Skip to content

Instantly share code, notes, and snippets.

@sdpjswl
sdpjswl / Disable ARC
Created September 28, 2014 07:27
Disable ARC on particular files
Under Build Phases ---> Compile sources,
Double click on a file and add this flag to disable ARC on that particular file:
-fno-objc-arc
@sdpjswl
sdpjswl / Limit Orientation
Last active August 29, 2015 14:06
Limit orientation to one ViewController
// implement the following code in AppDelegate.m
// implement a dummy method "canRotate" in the ViewController that you want to rotate
#pragma mark - Rotation methods
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
// Get topmost/visible view controller
UIViewController *currentViewController = [self topViewController];
@sdpjswl
sdpjswl / Helpful links
Last active August 19, 2016 09:26
Links to helpful stuff
@sdpjswl
sdpjswl / SejoPaddingLabel.h
Created September 28, 2014 07:37
UILabel category to add insets to text
//
// SejoPaddingLabel.h
// GiftyOne
//
// Created by Esense-33 on 18/07/14.
// Copyright (c) 2014 GiftyOne. All rights reserved.
//
#import <UIKit/UIKit.h>
@sdpjswl
sdpjswl / GolopoTextField.h
Created September 28, 2014 07:53
UITextField subclass to add inner shadow, text and placeholder insets
//
// GolopoTextField.h
// Golopo
//
// Created by Esense-15 on 05/09/14.
// Copyright (c) 2014 esense. All rights reserved.
//
#import <UIKit/UIKit.h>
@sdpjswl
sdpjswl / UIApplication+AppDimensions.h
Last active August 29, 2015 14:06
Get screen size depending on device orientation
//
// UIApplication+AppDimensions.m
// GolfByJordan
//
// Created by sudeep on 26/08/14.
// Copyright (c) 2014 Esense. All rights reserved.
//
#import "UIApplication+AppDimensions.h"
@sdpjswl
sdpjswl / UIImage+Mask.h
Created September 28, 2014 08:23
UIImage category to create a masked image
//
// UIImage+Mask.h
// Golopo
//
// Created by Esense-15 on 22/09/14.
// Copyright (c) 2014 esense. All rights reserved.
//
#import <UIKit/UIKit.h>
@sdpjswl
sdpjswl / Application loader stuck
Created September 28, 2014 10:44
Application loader stuck at "Authenticating" step
Stuck at authenticating with iTunes store:
Go to: Applications > Xcode > Contents > Applications > Application Loader > Contents > MacOS > itms > java > lib - Open net.properties with TextEdit and change the line # https.proxyPort=443 to # https.proxyPort=80
Link: http://stackoverflow.com/questions/18971710/application-loader-stuck-at-the-stage-of-authenticating-with-the-itunes-store
@sdpjswl
sdpjswl / Email validation
Last active August 29, 2015 14:06
Email validation regex
+ (BOOL)validateForEmail:(NSString *)email {
NSString *regExPattern = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSRegularExpression *regEx = [[NSRegularExpression alloc] initWithPattern:regExPattern options:NSRegularExpressionCaseInsensitive error:nil];
NSUInteger regExMatches = [regEx numberOfMatchesInString:email options:0 range:NSMakeRange(0, email.length)];
if (regExMatches == 0) {
return NO;
} else {
return YES;
@sdpjswl
sdpjswl / Singleton class
Last active August 29, 2015 14:06
Singleton class
+ (instancetype)sharedManager {
static ClassName *sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedManager = [[self alloc] init];
});
return sharedManager;
}