228 private links
If you have some notes, you can have a melody
La prouesse technique d'avoir du Wifi à bord des TGV, et pourquoi c'est si compliqué !
Good points! I have use cases where a frontend database approach will work perfectly!
Numbers:
const formatter = Intl.NumberFormat(LOCALE, { notation: 'compact' })
Currency:
Intl.NumberFormat(LOCALE, {
notation: 'compact',
style: 'currency',
currency: 'ZWD'
})
- Extraction: make the nested code a function or its own piece of logic.
- Inversion: use guards to remove nested code. These guards will stop the function before the end of the function body. They act as gates.
La vidéo appuyé par Elon Musk n'a donc pas été tournée proche d'un aéroport, comme il le prétend
TL;DR $attrs defines every attribute that is not listed in the props.
Use cases:
- apply $attrs on a specific node
- tell Vue to apply $attrs on a node of a multiple root-node components
- using prop validations (in dev only for example)
Ils sont magnifiques et c'est si beau
Ducks and drum kit
Macron disant que c'est hypocrite de décaler l'âge de la retrait. C'était il y a peu années.
computedEager utility has optimizations over computed in some cases.
when you have a simple operation, with a rarely changing return value – often a boolean.
Stick to computed
when you have a complex calculation going on, which can actually profit from caching and lazy evaluation and should only be (re-)calculated if really necessary.
display: contents
is underrated: it removes the box layout of the element!
grid-row or grid-column only works on explicit layout: workaround at 18:55
TL;DR;
apply every hover effect on devices that can not support the hover effect (smartphones, ...).
Use the @media (hover: hover)
media query to target devices that have the :hover
effect available, or @media (hover: none)
.
CSS variables that provoke invalid CSS declarations (for example --foo: ;
) are set to unset
.
Space toggle for numerical value: calc(1.5 var(--toggle-value, - .4))
with toggle value:
:root {
--ON: initial
--OFF: ;
}
Use variables for pure data, not CSS values as CSS values are often bound with a unit.
Relative values inherit as syntax tokens unless the property is registered. Registering a property as
Optimizes .mp4, .web and .gif
100% client-side
- Think about the
:empty
selector, especially for message errors :) :target
to select the node targeted by an achor.:only-child
and:only-of-type
selectors
Using web browsers might seem inefficient, but they solve so many problems.
FasterThanLime describes how hard it is to build a text-messaging app from scratch if we want to develop it properly.
Creational
Singleton
Type of object that can be instantiated once
In Typescript, just use a global object, so you don't have the boilerplate.
Prototype
Object.getPrototypeOf
Builder
Build object step by step through different methods instead of using many parameters
Factory
Determine which object to instantiate
Structural
Facade
Simplified to hide low-level details of a system
Proxy
Reactivity system of Vue :D
Replace an original object and do some side effects
Advantage: allow user to work with the proxy just like the original object but it can trigger side effects behind the scene.
Proxy are also used when there is a large object that would be expensive to duplicate in memory.
Behavioral
Iterator
Traverse through a collection of objects.
A pull based system.
An object with a next()
method in javascript that returns a { done: boolean; value: T }
.
Observer
Allow many objects to subscribe to events that are broadcast by another object.
A Subject where other objects subscribe to it and triggers their method when the subject notify
Mediator
In case of many to many relationships, one object is a coordinator between them.
Middlewares are an example of mediator.
State
What is the difference between state and strategy pattern?
Le réflexe photo-sternutatoire est partagé par 1/4 à 1/3 de la population mondiale.
Explication: le nerf optique envoie un signal si fort qu'il court-circuite le nerf trijumeau, qui se déclenche aussi.