Skip to content

Instantly share code, notes, and snippets.

View puvanarajan's full-sized avatar

Puvanarajan Mohanram puvanarajan

View GitHub Profile
@puvanarajan
puvanarajan / BinarySearch.ts
Last active December 6, 2018 05:11
BinarySearch for TS
class BinarySearch {
constructor(
private key: string,
private listArray: string[]
) {
}
public search(): number {
var min: number = 0;
- (NSDictionary *)dictionaryRemovingNSNullValues {
return [self removeNull];
}
#pragma mark - Replace null values to empty string
- (NSDictionary*)removeNull {
NSMutableDictionary *replaced = [NSMutableDictionary dictionaryWithDictionary: self];
const id nul = [NSNull null];
@puvanarajan
puvanarajan / Install Composer to use MAMP's PHP.md
Created March 24, 2016 16:03 — forked from kkirsche/Install Composer to use MAMP's PHP.md
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@puvanarajan
puvanarajan / gist:c08ccd25df8e6e855dfe
Created October 6, 2015 17:53 — forked from gushiguera/gist:ff4ac59627360916c653
AFNetworking based HTTP request singleton class with Swift
import UIKit
let apiURL:NSString = "http://my.api.com"
class NetworkManager: AFHTTPRequestOperationManager {
struct Singleton {
static let sharedInstance = NetworkManager(url: NSURL(string: apiURL))
}
@puvanarajan
puvanarajan / APIClient.swift
Created October 6, 2015 17:53 — forked from akisute/APIClient.swift
Example of APIClient and TestCase in Swift, using AFNetworking/Bolts
import UIKit
// How to make singleton classes in Swift: http://stackoverflow.com/questions/24024549/dispatch-once-singleton-model-in-swift
// Basically using global constants is the most easy and safe way to go
class APIClient: NSObject {
let functionSessionManager:AFHTTPSessionManager
class var sharedInstance:APIClient {