Skip to content

Instantly share code, notes, and snippets.

Avatar
:electron:
Hm

Mason Phillips MatrixSenpai

:electron:
Hm
View GitHub Profile
View Images.playground
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .white
View Data Structure.md

General Structure

  • Region
    • Team
      • Player (not implemented)
    • League
      • Season
        • Winner
        • Split
          • Winner
          • Tournament
@MatrixSenpai
MatrixSenpai / twitter snowflake.swift
Created Jul 10, 2019
Twitter Snowflake implementation in Swift
View twitter snowflake.swift
import Foundation
public typealias Snowflake = Int64
extension Snowflake {
public static var offset: Date? = nil
private static var increment: Int = 0
public static func generate(offset: Date? = nil, workerID: Int = 0, processID: Int = 0, increment: Int = 0) -> Snowflake {
var timestamp: Double
View BaseReactiveTable.swift
protocol BaseTableType where Self: UITableView {
associatedtype CellType: Configurable
associatedtype ItemType: Decodable
}
class BaseTable<T: Configurable>: UITableView, BaseTableType, UITableViewDelegate {
typealias CellType = T
typealias ItemType = T.ItemType
private let bag = DisposeBag()
View APISample.swift
enum HTTPMethod: String {
case get, put, post, patch, delete
}
public protocol APIRequest {
associatedtype Response: Decodable
var base : String { get }
var endpoint: String { get }
var method : HTTPMethod { get }
}
View keybase.md

Keybase proof

I hereby claim:

  • I am matrixsenpai on github.
  • I am matrixsenpai (https://keybase.io/matrixsenpai) on keybase.
  • I have a public key whose fingerprint is DEA5 CF7A CF55 5B78 517F 6DC9 E2EB 4CE8 8DE3 7287

To claim this, I am signing this object:

@MatrixSenpai
MatrixSenpai / eurekaWorkaround.swift
Created Jan 4, 2017
Eureka Form Add Row Workaround
View eurekaWorkaround.swift
// Your form
Section("My Form") { $0.tag = "AddSection" }
<<< TextRow("rowOne")
<<< TextRow("rowTwo")
<<< ButtonRow("addRow") {
$0.title = "Add Row"
}.onCellSelection { (cell, row) in
self.form.sectionBy(tag: "AddSection")
<<< TextRow("newRowTag")
}