Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicola Ferruzzi nferruzzi

  • Self-Employed
  • Firenze
View GitHub Profile
@nferruzzi
nferruzzi / gist:06abe735c70af9f55e359cae6729bfe3
Last active Dec 30, 2019
How to use MapBox MGLOpenGLStyleLayer to draw a triangle at the required geo coordinates
View gist:06abe735c70af9f55e359cae6729bfe3
import Foundation
import Mapbox
import GLKit
extension Double {
func clamp(min: Double, max: Double) -> Double {
return Double.minimum(Double.maximum(self, min), max)
}
}
@nferruzzi
nferruzzi / ReSwift+select.swift
Last active Feb 28, 2018
My own ReSwift multi observer extension with support for equatable types and optionals of equatable types
View ReSwift+select.swift
// Promise like subscriber, works with Equatable types and Optionals of Equatable types
// ie:
// let observer = document.mainStore
// .select { (state) -> UIState in state.ui }
// .then { _ in called += 1 }
// or
// let observer = document.mainStore
// .select { (state) -> String? in state.ui.selection }
// .then { _ in called += 1 }
//