This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def selection_sorty(input_list): | |
for i in range(len(input_list)): | |
min_index = i | |
for j in range(i+1, len(input_list)): | |
if input_list[min_index] == None: | |
min_index = j | |
input_list[i], input_list[min_index] = input_list[min_index], input_list[i] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution_algo(input_list): | |
# if the list has 0 or 1 element, nothing to do | |
if len(input_list) <= 1: | |
return input_list | |
else: | |
# using a new list to insert elements from input list | |
w = [] | |
# first getting all the not-NULL elements into the list | |
for e in input_list: | |
if e != None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LoYoLocalMainVC.swift | |
// LoYoLo | |
// | |
// Created by iOS on 9/24/18. | |
// Copyright © 2018 Kashfi Fahim. All rights reserved. | |
// | |
import UIKit | |
import Alamofire | |
import SwiftyJSON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Auth.auth().createUser(withEmail: emailTextfield.text!, password: passwordTextfield.text!) { (user, error) in | |
if error != nil { | |
print(error!) | |
} else { | |
print("Registration Successful!") | |
SVProgressHUD.dismiss() | |
self.performSegue(withIdentifier: "goToChat", sender: self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Auth.auth().currentUser != nil { | |
performSegue(withIdentifier: "goToChat", sender: self) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Auth.auth().signIn(withEmail: emailTextfield.text!, password: passwordTextfield.text!) { (user, error) in | |
if error != nil { | |
print(error!) | |
} else { | |
print("Log in successful!") | |
SVProgressHUD.dismiss() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func updateLabels( ) { | |
targetLabel.text = String(targetValue) | |
//here we are updating the text of the label | |
// and because the label holds string type | |
// we are converting the Int to String | |
// then assigning it to the text property of | |
// our targetLabel | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// our method is called startNewRound and it does not take any parameters | |
func startNewRound( ) { | |
targetValue = 1 + Int(arc4random_uniform(100)) | |
// This generates a new random number between 1 and 100 | |
currentValue = 50 | |
slider.value = Float(currentValue) | |
// So when a new round starts, the slider and the currentValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// first let's create a function for the alert | |
// remember to connect this code to a button on the storyboard. | |
@IBAction func showAlert() { | |
// We have to (1) set up the alert | |
// then (2) we have to set up the action to the alert (the button inside the alert) | |
let alert = UIAlertController(title: "Hello, World!", message: "This is my first alert!", prefferredStyle: .alert) | |
let action = UIAlertAction(title: "Awesome", style: .default, handler: nil) | |