Skip to content

Instantly share code, notes, and snippets.

View EricGustin's full-sized avatar
🌎
I wonder how long my GitHub status can be before it tells me that I can't type a

Eric Gustin EricGustin

🌎
I wonder how long my GitHub status can be before it tells me that I can't type a
View GitHub Profile
class SortingAlgorithms:
def selectionSort(self, lst):
for i in range(0, len(lst)-1):
minIndex = i
for j in range(i+1, len(lst)): # linearly traverse the unsorted portion of the list searching for the smallest number
if lst[j] < lst[minIndex]:
minIndex = j
tmp = lst[i] # swap the smallest number with the first element in the unsorted region after every linear traversal
lst[i] = lst[minIndex]
class SortingAlgorithms:
def bubbleSort(self, lst):
unsortedEnd = len(lst)-1 # variable that represents the end of the unsorted region of the list
while unsortedEnd > 0:
for i in range(0, unsortedEnd): # traverse the list from 0 to the end if the unsorted region of the list
if lst[i] > lst[i+1]: # if the current element is larger than the next element, then swap them
tmp = lst[i+1]
lst[i+1] = lst[i]
# Use a Python dictionary to act as an adjacency list for the directed
# graph. Key:Value pair where Key is a node directed towards Value
directedGraph = {
0 : [1,2],
1 : [3, 4],
2 : [5],
3 : [],
4 : [5],
5 : []
}
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.makeKeyAndVisible()
let vc = ViewController()
window?.rootViewController = vc
}
import UIKit
class ViewController: UIViewController {
private var label: UILabel = {
let label = UILabel(frame: CGRect(x: 0, y: UIScreen.main.bounds.height/2, width: UIScreen.main.bounds.width, height: 50))
label.textAlignment = .center
label.text = "No Storyboard!"
return label
}()
import UIKit
class ViewController: UIViewController {
var scrollView: UIScrollView!
var images = [UIImageView]()
override func viewDidLoad() {
super.viewDidLoad()
import UIKit
class ViewController: UIViewController {
var scrollView: UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
// Set the scrollView's frame to be the size of the screen
import UIKit
class ViewController: UIViewController {
private var mainScrollView: UIScrollView!
private var profilePicturesScrollView: UIScrollView!
private var profilePicturesContainer: UIView!
private var profilePictures = [UIImageView]()
override func viewDidLoad() {
func sceneDidBecomeActive(_ scene: UIScene) {
// Enter your code here to be executed whenever the app comes into the foreground
print("App entered foreground")
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Enter your code here to be executed when the app enters the background
print("App entered background")
}