Skip to content

Instantly share code, notes, and snippets.

View zippi-MD's full-sized avatar
:octocat:

Alejandro Mendoza zippi-MD

:octocat:
View GitHub Profile
@zippi-MD
zippi-MD / gist:2d58477b69bc88db12a1b05fd0447257
Created September 9, 2023 06:28
Generics class exercises
import Foundation
// Stack -
// last in - first out
// push & pop
//struct Stack<Element> {
// var items = [Element]()
//
// mutating func push(_ newItem: Element) {
// items.append(newItem)
import Foundation
// Extensions
extension Double {
var squared: Double { return self * self}
}
let sideLength: Double = 12.5
let area = sideLength.squared
@zippi-MD
zippi-MD / protocolBaseCode.swift
Created September 2, 2023 16:54
Protocol example base code
import Foundation
// Protocolos
protocol TabularDataSource {
var numberOfRows: Int { get }
var numberOfColumns: Int { get }
func label(forColumn column: Int) -> String
func itemFor(row: Int, column: Int) -> String
}

Keybase proof

I hereby claim:

  • I am zippi-md on github.
  • I am zippi_md (https://keybase.io/zippi_md) on keybase.
  • I have a public key ASDwZ6QePrwoziOhFNLKuDok-B4kFgY7hpFciys6axd9IAo

To claim this, I am signing this object: