Skip to content

Instantly share code, notes, and snippets.

@ericjkunz
Last active August 3, 2016 14:49
Show Gist options
  • Select an option

  • Save ericjkunz/cd163a47b746fe5a2661f15cff3df291 to your computer and use it in GitHub Desktop.

Select an option

Save ericjkunz/cd163a47b746fe5a2661f15cff3df291 to your computer and use it in GitHub Desktop.
import Foundation
extension UnitDuration {
/// the time a beard takes to grow one inch
static var beardInches: UnitDuration {
return UnitDuration(symbol: "beardInches", converter: UnitConverterLinear(coefficient: 2526336))
}
/// the mathematician John von Neumann used the term microcentury to denote the maximum length of a lecture
static var microCenturies: UnitDuration {
return UnitDuration(symbol: "microCenturies", converter: UnitConverterLinear(coefficient: (52.59483 * 60)))
}
/// It was the 60s, man
static var warhols: UnitDuration {
return UnitDuration(symbol: "warhols", converter: UnitConverterLinear(coefficient: 15 * 60))
}
/// where'd you learn to walk so fast?
static var newYorkSeconds: UnitDuration {
return UnitDuration(symbol: "newYorkSeconds", converter: UnitConverterLinear(coefficient: 0.5))
}
}
extension UnitLength {
/// the length a beard grows in one second
static var beardSeconds: UnitLength {
return UnitLength(symbol: "beardSeconds", converter: UnitConverterLinear(coefficient: pow(10, -8)))
}
}
extension UnitArea {
/// the unit for real estate on a VLSI chip. similar cost to real acres in Silicon Valley
static var nanoAcres: UnitArea {
return UnitArea(symbol: "nanoAcres", converter: UnitConverterLinear(coefficient: pow(4.04685664224, -6)))
}
}
// Inspired by many sources from: https://en.wikipedia.org/wiki/List_of_humorous_units_of_measurement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment