Weekly Shaarli
Week 17 (April 24, 2023)
A tool similar to release-it
Basique mais efficace: le if
qui vérifie que la donnée est correct
Une guard clause est un retour prématuré (ou early return) placé en haut de votre méthode, qui empêche votre code d’être exécuté si ce n'est pas nécessaire, en fonction de conditions que vous spécifiez. La plupart du temps ces conditions servent à vérifier le type de donnée reçu dans la méthode.
Another detailed article about it: https://anthonygharvey.com/guard-clauses-vs-nested-conditionals
const
only ensures that the reference is not modified. The data referenced can be modified though.
Also, primitive data types are immutable. So a const a = 5
can not be updated as 5 as Number can not change.
When we use const, we create an indestructible link between a variable name and a piece of data. We're still allowed to modify the data itself though!
When you use satisfies, the value BEATS the type.
The value of the variables is taken into account instead of the type declared in semicolon.
Also colon annotations and satisfies are equally safe.
Also unlike satisfies and colon annotations, using ‘as’ annotations lets you lie to TypeScript.
To recap, we’ve got FOUR ways of assigning a type to a variable:
- colon annotations
satisfies
as
annotations- not annotating and letting TS infer it
The rule of thumb is that you should only use satisfies in two specific situations:
- You want the EXACT type of the variable, not the WIDER type.
- The type is complex enough that you want to make sure you didn’t mess it up
A minimalist CSS library with special work on sidenotes, figures, and epigraphs.
Convert a Postgres SQL database directly into an HTTP API
The content can be spotted online from time to time
A great tool to generate an ERD. It can be generated from an SQL schema, a DB connection, JSON,
A case study for #Storyblok
La comparaison vaut le détour: quelle est la part de production du travailleur par an dédié au rendement du capital?
La part revenant aux salariés a en effet chuté dans le pays. Elle était de 75% au début des années 80, elle stagne autour de 65% aujourd’hui (source : INSEE).
Dans le même temps, 157 milliard d'euros sont versés sans contrepartie aux grandes entreprises.
Une critique acerbe mais qui semble, du point de vue extérieur, correspondre aux ressenties que j'ai.
Tailor a project to register specific icons for KeepassXC
Detects if a content is written by an AI
A collection of rust libraries:
- Dioxus for react-like interface architecture
- Tauri to build desktop apps
- Xilem is a data-first UI architecture
- Sycamore is a reactive library for creating web apps in Rust and WebAssembly. It uses bind/signal semantics. TThere is also Perseus on top of it that adds State and template concepts.
And so much more!
How to create a web worker?
- Create a script that imports another one with
const worker = new Worker('worker.js'
- Bind events emitted by the worker with
worker.onmessage = function(event) { ... }
- Do the same in the web worker with
self.onmessage = function(event) { ... }
- Exchange messages with
worker.postMessage(payload)
orself.postMessage(payload)
One key difference between Web Workers and the main thread is that Web Workers have no access to the DOM or the UI. This means that they cannot directly manipulate the HTML elements on the page or interact with the user.