I hereby claim:
- I am lukeredpath on github.
- I am lukeredpath (https://keybase.io/lukeredpath) on keybase.
- I have a public key ASAUz6CDWah_lWnyO27v-PoWTwHcOye7npHtcYVaBjlwrwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Given a range as input, reports fizz, buzz or fizzbuz. | |
# | |
# FizzBuzz logic is separated from presentation logic which is a concern for the reporter. | |
# | |
class FizzBuzz | |
def generate(range, reporter) | |
range.each do |n| | |
if n % 3 == 0 && n % 5 == 0 | |
reporter.report(:fizzbuzz) | |
elsif n % 3 == 0 |
WWDC Keynote 2018 Notes | |
Introduction | |
* App Store 10 years old this year | |
* Big push into the education space | |
* Everyone should learn to code | |
* All about software today (no hardware?) | |
iOS 12 | |
* Lots of stuff about how quickly iOS is adopted |
enum Signal: String { | |
case dot = "." | |
case dash = "-" | |
case unknown = "?" | |
static func parseSignals(from string: String) -> [Signal] { | |
return string.flatMap() { char in | |
return Signal(rawValue: String(char)) | |
} | |
} |
// becomes... | |
NotificationCenter.default.addObserver(forName: .SomethingDidHappen, ...) |
master | |
| | |
|----feature1 | |
| | | |
| |----task1 | |
| | | |
| |----task2 | |
| | |
|----feature2 |
protocol SomeProtocol { | |
typealias SomeType = String | |
} | |
class SomeClass: SomeProtocol { | |
let something: SomeType | |
} | |
// Compiles in Swift 3.1 | |
// Compile error in Swift 3.0.2: "Use of undeclared type SomeType" |
class Array | |
def interpolate(value) | |
map { |el| [el, value] }.flatten | |
end | |
end | |
[1, 3, 5, 6].interpolate(9) #=> [1, 9, 3, 9, 5, 9, 6, 9] |
let collection: Array<Int> = [1, 2, 3] | |
let optionalCollection: Array<Int>? = .None | |
expect(optionalCollection).to(equal(collection)) # fail: expected [1,2,3], got <nil> |
enum Result<T, ErrorType> { | |
case success(T) | |
case error(ErrorType) | |
} | |
enum MyError: ErrorType { | |
case itFuckedUp | |
} | |
// no longer need unused parameters in completion blocks: |