test thing
- here
- there
test thing
https://github.com/github/noodle-docs/issues/13
let thing: ?string = ... // `thing` is a nullable string | |
if (thing) { | |
// Within this `if`, `thing` is of type `string`. No longer nullable. | |
} | |
// Outside the `if`, `thing` is still a nullable string. | |
if (!thing) return | |
// Since we returned if `thing` is null, `thing` is now of type `string`. |
class Class1 { | |
prop: number | |
} | |
class Class2 { | |
prop: number | |
} | |
let a: Class1 = new Class1() | |
a = new Class2() |
import Cocoa | |
class GeneralThing<S> { | |
var stuff: S? | |
func doIt() { | |
if let s = stuff { | |
doWithStuff(s) | |
} | |
} |
#!/bin/bash | |
echo "*** Removing saved user…" | |
rm -rf "${HOME}/Library/Application Support/GitHub for Mac/usersByServer.plist" | |
echo "*** Removing keychain items…" | |
security -q delete-internet-password -s github.com/mac | |
security -q delete-generic-password -l 'GitHub for Mac — github.com' |
func renderForm(state: State) -> Element<State> { | |
let incButton = Button(title: "Increment", fn: { mapCount($0, inc) }) | |
|> sizeToFit | |
|> offset(0, 40) | |
let decButton = Button(title: "Decrement", fn: { mapCount($0, dec) }) | |
|> sizeToFit | |
let count = Label<State>(text: "\(state.count)") | |
|> sizeToFit |
Swift: Wanted: Generalized chaining | |
Summary: | |
Swift's Optional chaining is super cool. | |
It'd be really really cool if we could generalize that (monads!) to Haskell-like do-syntax. | |
Steps to Reproduce: | |
class F<A> { | |
} | |
protocol Functor { | |
typealias A | |
typealias B | |
typealias FA = F<A> | |
typealias FB = F<B> | |
func fmap(a: FA, fn: (A -> B)) -> FB | |
} |
RACSignal *a = [b flattenMap:(id x) { | |
return [RACSignal error:[NSError error...]]; | |
}]; |