Skip to content

Instantly share code, notes, and snippets.

View Kalvin126's full-sized avatar

Kalvin Loc Kalvin126

View GitHub Profile
final class Thing {
var some: String
var someInt: Int
init(builder: (Thing) -> Void) {
builder(self)
}
}
protocol Features { }
protocol Account {
var features: Features { get set }
}
class ProFeatures: Features {
}
@Kalvin126
Kalvin126 / Jenkinsfile.groovy
Last active June 8, 2018 18:28
Parallelized Distributed Testing Multiple Destinations
pipeline {
agent none
stages {
stage('Build') {
sh '''
xcodebuild -scheme TestParallel build-for-testing \
-destination 'platform=iOS Simulator,name=iPhone 8,OS=12.0' \
-destination 'platform=iOS Simulator,name=iPhone X,OS=12.0
'''
module Fastlane
module Actions
class WaitForPodInstanceAvailabilityAction < Action
def self.run(params)
wait_for_pod_done!
end
def self.pod_process_exists!
output = Fastlane::Actions::sh('ps -aef | awk \'/[p]od /{print $2}\'', log: false)
import SnapKit
import UIKit
// MARK: - AutoLayout
extension UIView {
@discardableResult func addSubview<View: UIView>(_ subview: View, constraintMaker: (View, ConstraintMaker) -> Void) -> View {
subview.translatesAutoresizingMaskIntoConstraints = false
addSubview(subview)
@Kalvin126
Kalvin126 / Styler.swift
Created March 20, 2017 19:15
Reusable Styler
//: Playground - noun: a place where people can play
import UIKit
class Styler<ViewType: UIView> {
private let styler: (ViewType) -> Void
init(_ styler: @escaping (ViewType) -> Void) {
self.styler = styler
{
"customerAutoComplete": {
"US": {
"value": "on"
},
"ALL": {
"value": "on"
}
},
"invoiceAttachments": {