319 private links
A library that seems good to parse CSV
13[isOdd]
returns true. Funny.
How to do it ?
- Use Symbols to create unique keys
Object.defineProperty()
with the symbol- Passing parameters with a function :)
Metho simplifies this process with a simple method.
Metho project: https://github.com/jonrandy/metho
I find Vite to be a good compromise between having the benefits of TS and the slow build step. Use es-build to transpile and does not do type checking since it passes that responsibility onto the IDE.
Totally agree with this comment !
It is still possible to run the type checker all in once if needed.
Only supported by chrome for now
- A Save-Data header is sent on each HTTP request. This allows dynamic backends to change the HTML returned.
- The NetworkInformation.saveData JavaScript API. This allows client-side JavaScript to check this and act accordingly.
- The upcoming prefers-reduced-data media query, which allows CSS to set different options depending on this setting. This is available behind a flag in Chrome, but not yet on by default while it finishes standardization.
Display an item on scroll.
From brute-force to optimized algorithm
I bookmark this post especially for this code snippet:
body {
margin: 0 auto;
max-width: 40rem; // can be bigger but not too much ! (<= 80 I think)
font-size: 1.2rem;
}
It makes a HTML website directly readable :)
Problems with deepcloning with JSON.stringify() / JSON.parse()
:
- Recursive data structures: JSON.stringify() will throw when you give it a recursive data structure. This can happen quite easily when working with linked lists or trees.
- Built-in types: JSON.stringify() will throw if the value contains other JS built-ins like Map, Set, Date, RegExp or ArrayBuffer.
- Functions: JSON.stringify() will quietly discard functions.
The solution: the function structuredClone
.
Comment créer un simple Web Component ?
Exact:
Quand on utilise les attributs « data-* », JS le récupère toujours sous la forme d’une chaîne de caractères, même si ça contient un nombre.
De ArthurHoaro:
Non. Ça c’est le genre de tricks qui marchent, mais qui rendent le code illisible. Il suffit d'utiliser parseInt(div.dataset.nb) puisque oui, dans le DOM, tout est chaînes de caractères.
Looks promising to avoid javascript on the frontend.
Pratical to write a CV with a web framework and then renders it as a static website !
Or for every website that does only have few JS code.
(for websites)
PHP ~ 80 %, followed by ASP.NET, Ruby and Java.
Javascript is represents only 1.5% of the backends for websites.
Le jeu est disponible à cette adresse: https://across-multiverse.com/
timefind lets you find the exact moment that something was added to a website.
It quickly flips through Web Archive snapshots using binary search, pinpointing the date of the modification.
JavaScript contient une solution d’internationalisation assez puissant, qui permet de détecter la langue d’un texte ou de formater une date, un nombre…
Ici, j’utilise tout juste 10 lignes de JS pour capter une date entrée par l’utilisateur et la traduire dans la langue qu’il souhaite.
J’ai mis une liste immense de codes de langues, mais beaucoup ne sont pas supportées. Je vais peut-être faire un filtre pour les virer dynamiquement.
En attendant, vous pouvez essayer des langues un peu communes : anglais, allemand, danois… Même le perse, l’arabe ou le japonais sont supportés !
Et ça formate la langue correctement, avec les majuscules, les vigules et l’ordre tout comme il faut. Actuellement il n’y a pas les variantes (pour l’anglais, par exemple j’ai juste « anglais », sans distinguer anglais UK et anglais US).
J’étofferais ça probablement un jour, peut-être avec les émoji de drapeaux, etc. pour faire joli.
Je n'y a avais pas pensé, mais c'est tellement simple et pratique ! Mhmhmhmh il y aurais moyen d'améliorer cela !
#project #idea
CSS only alternative to Javascript !!! These patterns are .
One point is that some examples are using a tons of CSS (i.e. Todo List).
Quite are impressive such as the Twitter like animation.
And other are basic and simple such as the ripple effect: https://github.com/mladenplavsic/css-ripple-effect/blob/master/src/ripple.less
EDIT: this ripple effect is independant of the mouse position on click