Skip to content

Instantly share code, notes, and snippets.

View ninjazoete's full-sized avatar
🎯
Focusing

Andrzej Spiess ninjazoete

🎯
Focusing
View GitHub Profile
#!/bin/sh
# [SwiftFormat Pass]
isCleanDiff() {
if git diff-index --quiet HEAD; then
return 0
else
return 1
fi
@ninjazoete
ninjazoete / Chp11.hs
Created October 1, 2017 18:00
(Haskell-Book-Chp-11-Task-1)
-- Exercise given data types
data OperatingSystem = GnuPlusLinux
| OpenBSDPlusNevermindJustBSDStill
| Mac
| Windows
deriving (Eq, Show, Enum)
data ProgrammingLanguage = Haskell
| Agda
@ninjazoete
ninjazoete / PhantomTypedForm.swift
Last active September 3, 2017 19:37
Using phantom types in order to let the type system guard us against unvalidated data
//: Playground - noun: a place where people can play
import Cocoa
// Phantom Types Example
struct Validated {}
struct Unvalidated {}
struct Form<T> {
@ninjazoete
ninjazoete / Chef.swift
Last active April 14, 2017 07:14
Associatedtype as generic constraint
protocol Food {}
protocol BrazilianFood: Food {}
protocol EnglishFood: Food {}
class EnglishPancake: EnglishFood {}
class BrazilianSoup: BrazilianFood {}
protocol Chef {
associatedtype FoodType: Food
@ninjazoete
ninjazoete / GenericProtocolHandle.swift
Created February 2, 2016 08:29
Handle to generic protocol conforming type
protocol PresentationItem { }
protocol AnyPresenter {
func _present(item: Any) -> Void
}
protocol Presenter: AnyPresenter {
typealias PresentationType