Skip to content

Instantly share code, notes, and snippets.

View MarkQSchultz's full-sized avatar

Mark Schultz MarkQSchultz

  • Pluralsight
  • Lehi, UT
View GitHub Profile
We collect no personal data of any kind.
We do not record or store keystrokes or any other usage data.
We collect no data.
Simply enjoy the use of the AlphaBoard Keyboard, knowing that your privacy is secure.
@MarkQSchultz
MarkQSchultz / MaxMinAssignment.swift
Created January 19, 2015 17:56
Assignment operators that max or min a value against a variable
infix operator >>>= {
associativity right
precedence 90
assignment
}
infix operator <<<= {
associativity right
precedence 90
assignment
@MarkQSchultz
MarkQSchultz / OptionalFilter.swift
Last active August 29, 2015 14:13
Optional unwrapping by condition (filter?) in Swift
extension Optional {
// Will return the value of optional if it is not nil and if the function `condition` evaluates to true.
// Otherwise, returns nil
func filter(condition: T -> Bool) -> T? {
if let x = self {
if condition(x) {
return x
}
}