386 private links
RIIR ou at least in python 3.
Dependency: pygithub3
mkdir -p instead of mkdir
ln -sfn source target instead of ln -s source target
rm -f example.txt instead of rm example.txt
Modifying a file
if ! grep -qF "/mnt/dev" /etc/fstab; then
echo "/dev/sda1 /mnt/dev ext4 defaults 0 0" | sudo tee -a /etc/fstab
fi
Check if variable, file or dir exists
formatting a device
mounting a device
Summary:
Use Boyer-Moore (and unroll its inner loop a few times).
Roll your own unbuffered input using raw system calls. Avoid copying
the input bytes before searching them. (Do, however, use buffered
output. The normal grep scenario is that the amount of output is
small compared to the amount of input, so the overhead of output
buffer copying is small, while savings due to avoiding many small
unbuffered writes can be large.)Don't look for newlines in the input until after you've found a match.
Try to set things up (page-aligned buffers, page-sized read chunks,
optionally use mmap) so the kernel can ALSO avoid copying the bytes.The key to making programs fast is to make them do practically nothing. ;-)
It is possible to activate/deactivate a class with node.classList.toggle('className', true/false)
The example provided about forms is impressive ! HTML and CSS are so much powerful ! I think I will use them more in vue and svelte :)
There is a <template> tag in HTML 5.
The componentization is still to be done though. I always forgot how HTML5 and CSS are powerful nowadays.
TL;DR; using css variables again
aspect-ratio can have two types of values:
3 / 2: a ratio of 3 in width and 2 in height3: a simple number where the width and height are equal
Old tricks to build web pages when CSS wasn't so much developed
Pinia is the nest version of Vuex for Vue 3 and this tool looks promising ! The current documentation is up-to-date.
How to program a dark theme for a website. It is easier than expected with @media (prefers-color-scheme: dark) and css variables !
Un projet dédié à été crée afin de monitorer le CI de plusieurs projets: https://github.com/mvisonneau/gitlab-ci-pipelines-exporter
Le reste de l'article explique comment faire :)
- Using vue props to congru accessibility, such as headline elements
- Use component reusability to make an accessibility feature once: a raw aria-live, vue announcer, and read more on the WAI-ARIA Authoring Practices https://github.com/w3c/aria-practices/issues
-View And Help Vue’s Accessibility Initiatives Grow and references are in the post- Learn From React Accessibility Leads
- Vue’s $refs Are Great For Focus Management
Critiquer Rust sous prétexte que c’est un langage complexe conduit à passer à côté de ce qui fait sa force : il est pensé pour être expressif, ce qui signifie qu’il y a beaucoup de fonctionnalités, et dans la majorité des cas c’est ce que vous attendez d’un langage de programmation.
L'article est bien complet !
Mon avis: utiliser Go pour le code qui doit être déployé demain, Rust pour le code qui devra rester en production tel quel pour les 5 prochaines années
—Grzegorz Nosek
From brute-force to optimized algorithm
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.
Les arguments relevés semblent pertinent:
- les tests passent avant le typage → ok mais pourquoi ne pas avoir les deux et laisser ce choix par projet ?
- la lisibilité des en-têtes de fonction peuvent très bien être améliorée
- les annotations requirent leurs propres imports, ce qui peut conduire à des imports circulaires (cf: https://stackoverflow.com/questions/22187279/python-circular-importing/22187343#22187343)
A way to render conditionally the attributes of a tag.
Creating an object and setting the attributes as prop of the object if they should be rendered. Then use the spread operator on it:
<script>
export let value = "";
export let id = "";
export let placeholder = "";
export let type = "text";
let conditionalAttributes = {};
if (id) conditionalAttributes.id = id;
if (placeholder) conditionalAttributes.placeholder = placeholder;
if (type) conditionalAttributes.type = type;
</script>
<input {...conditionalAttributes} bind:value={value} />Now I understand how it is useful 👍