Skip to content

Instantly share code, notes, and snippets.

Ben Trengrove bentrengrove

Block or report user

Report or block bentrengrove

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bentrengrove / Sample.kt
Last active Oct 24, 2019
Sample code demonstrating using Kotlin for type safe unit conversion
View Sample.kt
val miles =
val kilometers =
val total = 2.kilometers + 1.miles + 10.meters + 1.centimeter + 1.millimeter
Log.d("MainActivity", "Total distance is ${total.meters.amount} meters")
val totalTime = 2.hours + 2.minutes + 2.seconds + 2.milliseconds
Log.d("MainActivity", "Total time is ${totalTime.amount} ${totalTime.unit}")
bentrengrove / enumerateObjectsWithBlock Swift
Last active Aug 29, 2015
How to use the enumerateObjectsWithBlock method on NSArray with Swift
View enumerateObjectsWithBlock Swift
let nArray : NSArray = ["1", "2", "3"]
nArray.enumerateObjectsUsingBlock {(obj, index, stop) in
println("Object \(obj) Index \(index)")
if index == 1 {
stop.withUnsafePointer { $0.memory = true }
You can’t perform that action at this time.