Skip to content

Instantly share code, notes, and snippets.

View shrawan2015's full-sized avatar
🎯
Focusing

Shrawan Kr Sharma shrawan2015

🎯
Focusing
View GitHub Profile
if presentationStyle == .compact {
controller = initateCompactVC()
} else {
controller = initateExpandVC()
}
override func willTransition(to presentationStyle: MSMessagesAppPresentationStyle) {}
override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle){}
requestPresentationStyle(.expanded)
requestPresentationStyle(.compact)
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
let queue = DispatchQueue(label: "queue.1")
//To add some context, a queue is a block of code that can be run synchronously or asynchronously in either the main or background thread.
//When we use a queue, we can either use a global one that is provided to us by Apple, or we can create our own custom ones. It should be noted that global queues should be used cautiously as we wouldn’t want to abuse them.
{
"name": "node-js-getting-started",
"version": "0.3.0",
"description": "A sample Node.js app using Express 4",
"engines": {
"node": "8.9.1"
},
"main": "index.js",
"scripts": {
"start": "node index.js",
Install the mongodb server and run in the server
Shrawan-Temp-mac:bin shrawans$ mongod --dbpath ../../../mongoserver_DB/
Reference @marcexmachina
https://gist.github.com/marcexmachina/ab2f613e5208279b20194926a76dd511
protocol APIClient {
var session: URLSession { get }
func fetch<T: Decodable>(with url: URL, completion: @escaping (Result<T>) -> Void)
}
import requests
import json
url = 'https://circleci.com/api/v1.1/project/github/VForgeLabs/CameraEatsFirstIos/tree/qa?circle-token=DFSDFSFDF'
payload = {"build_parameters": { "MANUAL_BUILD": "TRUE"}}
headers = {'content-type': 'application/json'}
r = requests.post(url, data=json.dumps(payload), headers=headers)
print (r.json())
func getFBProfilePicUrl(){
let request = FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name, last_name, email, picture.type(large)"])
let _ = request?.start(completionHandler: { (connection, result, error) in
guard let userInfo = result as? [String: Any] else { return }
if let id = userInfo["id"] as? String {
appScopedUserId = id
}
})
}
let loginManager: FBSDKLoginManager = FBSDKLoginManager()
loginManager.logIn(withReadPermissions: ["user_link"], from: fromViewController) { (result, error) in
if error != nil{
return
}else if (result?.isCancelled)!{
//Handle cancelation
}else{
if (result?.grantedPermissions.contains("user_link"))!{
//success