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
import numpy as np | |
import pandas as pd | |
from nltk.corpus import stopwords | |
df = pd.read_csv('city_data.csv') | |
def clear(city): | |
city = city.lower() | |
city = city.split() | |
city_keywords = [word for word in city if word not in stopwords.words('english')] |
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
predicate sorted(a: array?<int>, l: int, u: int) | |
reads a | |
requires a != null | |
{ | |
forall i, j :: 0 <= l <= i <= j <= u < a.Length ==> a[i] <= a[j] | |
} | |
predicate partitioned(a: array?<int>, i: int) | |
reads a | |
requires a != null |
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
import Foundation | |
import UIKit | |
class ActivityIndicator { | |
private init() {} | |
//1 | |
static let shared = ActivityIndicator() | |
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 subscribeToUsers() { | |
//1 | |
let secondVC = tabBarController?.viewControllers?.last as! UserViewController | |
secondVC.userToShowInFirstVcObservable.subscribe(onNext: { [weak self] user in | |
//2 | |
self?.userToDisplay.value = user | |
}).disposed(by: disposeBag) | |
} |
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 numberOfSections(in tableView: UITableView) -> Int { | |
return 1 | |
} | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return userArray.value.count | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell") else { |
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 deployUsers() { | |
userArray.value = [ | |
User(name: "Narcisa", age: 21, city: "Bucharest"), | |
User(name: "Vincent", age: 24, city: "Hamburg"), | |
User(name: "Eray", age: 29, city: "Istanbul") | |
] | |
} |
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 configureLabels() { | |
//1 | |
userToDisplayObservable.subscribe(onNext: { [weak self] user in | |
//2 | |
self?.nameLabel.text = user.name | |
self?.ageLabel.text = String(user.age) | |
self?.cityLabel.text = user.city | |
}).disposed(by: disposeBag)//3 | |
} |
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
class User { | |
let name: String | |
let age: Int | |
let city: String | |
init(name: String, age: Int, city: String) { | |
self.name = name | |
self.age = age | |
self.city = city | |
} |
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
//Implemented in Swift 4 | |
import Foundation | |
class ViewController: UIViewController { | |
var assignmentString = """ | |
215 | |
193 124 | |
117 237 442 |
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
import time | |
from datetime import datetime as dt | |
#Blocks the access to the websites incuded in the website_list, between the given hours. | |
#Blocking hours for this project is set to 8am - 4pm, but can be adjusted easily. | |
#Remember you are gonna have to run this code in sudo, or administrator role in order to access your hosts. | |
hosts_temp = "hosts" | |
hosts_path_for_windows = r"C:\Windows\System32\drivers\etc\hosts" | |
hosts_path ="/private/etc/hosts" | |
redirect = "127.0.0.1" |
NewerOlder