Skip to content

Instantly share code, notes, and snippets.

View pravishanth's full-sized avatar

Pravishanth Madepally pravishanth

View GitHub Profile
@pravishanth
pravishanth / persons.js
Created February 13, 2023 06:15
Dummy data for MongoDB
[
{
"index": 0,
"name": "Aurelia Gonzales",
"isActive": false,
"registered": "2015-02-11T04:22:39+0000",
"age": 20,
"gender": "female",
"eyeColor": "green",
"favoriteFruit": "banana",
@pravishanth
pravishanth / code.swift
Created November 9, 2018 14:28
TableViewCell with ImageView
class ProfileImageLabelTVCell: UITableViewCell {
let cellTextLabel : UILabel = {
let label = UILabel()
label.text = "Name"
return label
}()
@pravishanth
pravishanth / awsLogin.swift
Created April 24, 2018 01:10
AWS Cognito user Login
if(userExists){
// SIGNIN THE USER
guard let usernameValue = loginDetails["userName"] as? String else{ return }
let authDetails = AWSCognitoIdentityPasswordAuthenticationDetails(username: usernameValue, password: passwordValue)
self.passwordAuthenticationCompletion?.set(result: authDetails)
self.user = self.pool?.currentUser()
self.pool?.currentUser()?.getSession(usernameValue, password: passwordValue, validationData: nil).continueOnSuccessWith(executor: AWSExecutor.mainThread(), block: { (task) -> Any? in
@pravishanth
pravishanth / awsCognito.swift
Last active March 7, 2018 00:21
Unable to obtain Access Token
//Using iOS SDK AWSCognitoIdentityProvider 2.6.7
let mySession = self.pool.currentUser()?.getSession()
guard let accessToken = mySession?.result?.accessToken?.tokenString as? String else {
print("Unable to obtain access token")
self.handleSignOut() // Signing out the user if there is no access token
return
}