Skip to content

Instantly share code, notes, and snippets.

View robertherdzik's full-sized avatar
💭
🚴‍♂️

Robert Herdzik robertherdzik

💭
🚴‍♂️
  • Spain
View GitHub Profile
//------------------------------------------------
// VIEWCONTROLLER
protocol __baseName__ViewProtocol: class {
}
final class __baseName__ViewController: UIViewController {
private var presenter: __baseName__PresenterProtocol
@robertherdzik
robertherdzik / FindBrancketBalancing
Last active November 30, 2018 17:26
Find whether the given expression is balanced
import XCTest
let patterns: [String: String] = [
"{": "}",
"[": "]",
"(": ")"
]
func isValid(with input: String) -> Bool! {
let charArr = input.split(separator: " ")
@robertherdzik
robertherdzik / RHOperation based on Apple example
Last active July 20, 2019 21:47
If you need simple class for you async Operations, you landed in the good place. Simplified version of base Operation class form Apple Earthquake 2015 example.
/*
Copyright (C) 2015 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
This file contains the foundational subclass of NSOperation.
*/
import Foundation
extension Optional where Wrapped == String {
func valueOrEmptyString() -> String {
guard let value = self else { return "" }
return value
}
}
@robertherdzik
robertherdzik / quickGitFlow.sh
Last active August 21, 2018 07:12
Script takes from 'Clipboard' (Ctrl+v) string value and create branch lowercased and under scored name. See example INPUT/OUTPUT in the script comment
#!/bin/bash
######
# Example:
# INPUT: "XXXX-888 [iOS] Fix Floating Button"
# OUTPUT: "feature/xxxx-888_fix_floating_button"
######
remove_spaces ()
{
let animation = CABasicAnimation(keyPath: "opacity")
animation.beginTime = CACurrentMediaTime() + 3
animation.fillMode = kCAFillModeForwards
animation.isRemovedOnCompletion = false
animation.duration = 3
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
animation.fromValue = 1
animation.toValue = 0