https://www.youtube.com/watch?v=nQo0EdHNjto
- reusable components
- props over state
- prop === state => problem!
- stateless components
- easy to unit test
- props over state
- PropTypes are serious
| const setJackson = R.pipe( | |
| R.prop("users"), | |
| R.map( | |
| (user) => | |
| R.startsWith('J', user.name) | |
| ? {...user, name: R.concat(user.name, ' Jackson')} | |
| : user | |
| ) | |
| ) |
| R.pipe( | |
| R.prop("users"), | |
| R.sortBy(R.prop("age")), | |
| R.take(3), | |
| R.pluck("name") | |
| ) |
| const isOld = R.gt(R.__, 33) | |
| const getOldPeople = R.pipe( | |
| R.prop("users"), | |
| R.filter(R.where({age: isOld})) | |
| ) | |
| const getOldPeople = R.pipe( | |
| R.prop("users"), | |
| R.filter(R.propSatisfies(isOld, 'age')) |
| const myProp = (key, maybeObject) => { | |
| if (maybeObject === undefined) { | |
| return (object) => { | |
| return myProp(key, object) | |
| } | |
| } | |
| return maybeObject[key] | |
| } |
| const increment = (key, obj) => { | |
| return { | |
| ...obj, | |
| [key]: obj[key] + 1 | |
| } | |
| } |
| import Html exposing (text) | |
| partition n = | |
| break (n - 1, 0) | |
| break (n, total) = | |
| case n of | |
| 1 -> total + 1 | |
| n -> 1 + break(n - 1, total + 1) |
https://www.youtube.com/watch?v=nQo0EdHNjto
Blazing fast:
emacs --daemon
emacsclient .inside terminal:
emacsclient -nw .| var schema = joi.object().keys({ | |
| things: joi.array().items( | |
| joi.object().keys({ | |
| id: joi.string(), | |
| name: joi.string(), | |
| version: joi.string() | |
| }) | |
| ) | |
| }); |
| package main | |
| import ( | |
| "bytes" | |
| "flag" | |
| "fmt" | |
| "github.com/elazarl/goproxy" | |
| "github.com/robertkrimen/otto" | |
| "io" | |
| "io/ioutil" |