Skip to content

Instantly share code, notes, and snippets.

View m25lazi's full-sized avatar

Mohammed Lazim m25lazi

View GitHub Profile
// Pure function
func sum(_ num1: Int, _ num2: int) -> Int {
return num1 + num2
}
// Impure function
var accumulated = 0
func add(_ num: Int) -> Int {
accumulated = num + accumulated
@m25lazi
m25lazi / VerticalScrollableStackViewController.swift
Created March 21, 2019 05:13
Sample implementation of vertically scrollable stack view
import UIKit
class VerticalScrollableStackViewController: UIViewController {
let scrollView: UIScrollView = UIScrollView(frame: .zero)
let stackView: UIStackView = UIStackView(frame: .zero)
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .gray
@m25lazi
m25lazi / ReadEnvironmentVariable.swift
Created January 7, 2020 15:18
Snippet for reading environment variables.
var shouldLogTextAnalyzer = false
if ProcessInfo.processInfo.environment["text_analyzer_log"] == "verbose" {
shouldLogTextAnalyzer = true
}
if shouldLogTextAnalyzer {
/// Actual logger code
}
@m25lazi
m25lazi / ReadEnvironmentVariable.swift
Created January 7, 2020 15:18
Snippet for reading environment variables.
var shouldLogTextAnalyzer = false
if ProcessInfo.processInfo.environment["text_analyzer_log"] == "verbose" {
shouldLogTextAnalyzer = true
}
if shouldLogTextAnalyzer {
/// Actual logger code
}