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.
Les vidéos sont disponibles sur Twitter
Python support also unicode caracters, so you can write a 𝝨(...args) function :D
They absorb the most energy when they have the least in them. And as they get closer and closer to full, they can't absorb quite as efficiently and then there is some excess lost.
and
batteries degrades over time
Causes of degradation:
- Heat ruins the battery (high impact)
- Charging cycles
- Time (slow impact)
How to charge the phone without generating extra heat ?
- Power breaks generating heat are now near the electrical socket
- the battery is divided by two
- adding more cooling hardware
→ heat problem is covered in normal situations
So what counts ?
- around 80% battery health after 800 charges (but we don't have long-term data about these new fast charges)
Announcement for 2022 from a tech company: 80% battery health after 1600 charges.
A stairwell is well suited for amplification :D