Option<T> |
non-Option (T | undefined) |
|
|---|---|---|
| accessing property | userOption.map(user => user.age) |
userNullish?.age |
| calling a method | userOption.map(user => user.fn()) |
userNullish?.fn() |
| providing fallback | ageOption.getOrElse(0) |
ageNullish ?? 0 |
| filter | ageOption.filter(checkIsOddNumber) |
`ageNull |
| // | |
| // TextStyle.swift | |
| // | |
| // Created by Rob Napier on 12/20/19. | |
| // Copyright © 2019 Rob Napier. All rights reserved. | |
| // | |
| import SwiftUI | |
| public struct TextStyle { |
There is a function .retry() in Combine that helps to retry a request. Although it is not enough just to call retry() to achieve retring logic. The retry() function does not do another request but it re-subscribes only to a publisher. To make another request the tryCatch() might be used. In the code below if the first call fails there are three attempts to retry (retry(3)):
import UIKit
import Combine
import PlaygroundSupport
enum CustomNetworkingError: Error {
case invalidServerResponse
}| // | |
| // BottomSheetView.swift | |
| // | |
| // Created by Majid Jabrayilov | |
| // Copyright © 2019 Majid Jabrayilov. All rights reserved. | |
| // | |
| import SwiftUI | |
| fileprivate enum Constants { | |
| static let radius: CGFloat = 16 |
5 x 90minut + domácí úkoly, založeno na přehledu výstupních znalostí
- struktura webové stránky (head, body), metainformace
- základní HTML elementy (titulky, odstavec, obrázek, odkaz, oddíl)
- co je CSS, k čemu slouží, jak propojit s HTML
- základní vlastnosti pro formátování textu
I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.
I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.
"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr
| // | |
| // Combine+WithLatestFrom.swift | |
| // | |
| // Created by Shai Mishali on 29/08/2019. | |
| // Copyright © 2019 Shai Mishali. All rights reserved. | |
| // | |
| import Combine | |
| // MARK: - Operator methods |
https://twitter.com/snookca/status/1073299331262889984?s=21
“In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”
Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows.
(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)
So the big deal about css-in-js (cij) is selectors.
2019 update: this essay has been updated on my personal site, together with a followup on how to get started
2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!
If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.
You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos