Skip to content

Instantly share code, notes, and snippets.

View SMR's full-sized avatar

Samarjeet Dubey SMR

  • iSparshIT
  • Mumbai
  • 01:20 (UTC -12:00)
View GitHub Profile
@SMR
SMR / README.md
Created October 18, 2019 11:38 — forked from acrookston/README.md
Xcode pre-action to build custom Info.plist

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of preaction.sh into the pre-action script box.

@SMR
SMR / basic-auth.swift
Created July 29, 2017 17:08 — forked from armstrongnate/basic-auth.swift
HTTP Basic Authentication using NSURLSession in swift
import Foundation
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
let userPasswordString = "username@gmail.com:password"
let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding)
let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil)
let authString = "Basic \(base64EncodedCredential)"
config.HTTPAdditionalHeaders = ["Authorization" : authString]
let session = NSURLSession(configuration: config)
@SMR
SMR / BackgroundFetch.swift
Created April 20, 2017 05:31 — forked from RameshRM/BackgroundFetch.swift
Swift Background Fetch
Step 1: Enable capabilities "background fetch"
Step2 : Setup AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Alert, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
return true;
@SMR
SMR / api.swift
Created February 27, 2017 05:24 — forked from izotx/api.swift
Example of using NSURLSession
/// Used to interact with the 2k games server API, and upload images to the server
class APIOperations: NSObject, NSURLSessionDelegate {
/** This method is using just a genereic URLSession to upload image to a server
- Parameters:
- Image: image to upload
- imageType: kind of image (2k type) don't confuse it with png/jpg
- callback: callback that contains information about successful or failed operation
@SMR
SMR / 0-startup-overview.md
Created January 9, 2017 05:27 — forked from dideler/0-startup-overview.md
Startup Engineering notes