This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- URL Absolue --> | |
<!-- Inclus le protocole (HTTP, HTTPS) et le nom de domaine complet. --> | |
<a href="https://www.exemple.com/page.html">Lien</a> | |
<!-- URL Relative --> | |
<!-- Le chemin est relatif au path courant --> | |
<!-- Si on est sur l'url https://www.exemple.com/subPath/index.html --> | |
<!-- On ciblera alors => https://www.exemple.com/subPath/page.html --> | |
<a href="page.html">Lien</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compress images | |
on: | |
pull_request: | |
paths: | |
- "**.jpg" | |
- "**.jpeg" | |
- "**.png" | |
- "**.webp" | |
jobs: | |
image-optimization: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🏴☠️ Fiche Mémo de la Syntaxe Regex 🏴☠️ | |
Flag : Tes Drapeaux de Navigation | |
g : Recherche globale, pour trouver tous les trésors, pas seulement le premier. | |
i : Insensible à la casse, parce que pour un pirate, "RHUM" c'est comme "rhum". | |
m : Multiligne, utile quand tes chansons de marins couvrent plusieurs lignes. | |
Ensembles de Caractères : L'Alphabet d'un Pirate | |
[abc] : N'importe quel caractère entre les crochets (a, b ou c). | |
[^abc] : N'importe quel caractère PAS entre les crochets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Test() --- | |
let treasureMap = 'I found Gold'; | |
let pirateAction = /found$/i; | |
let pirateObjective = /rum$/; | |
// Output: true | |
console.log(pirateAction.test(treasureMap)); | |
// Output: false | |
console.log(pirateObjective.test(treasureMap)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🔍 Fonctions pour le stockage local et sessionStorage en JavaScript | |
// 🔍 Utiliser localStorage.setItem() pour stocker une valeur dans le stockage local | |
const userName = 'John Doe'; | |
localStorage.setItem('user', userName); | |
// 🔍 Utiliser localStorage.getItem() pour récupérer une valeur du stockage local | |
const storedUserName = localStorage.getItem('user'); | |
// 👉 Résultat : 'John Doe' (storedUserName contient la valeur 'John Doe') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const apiUrl = 'https://jsonplaceholder.typicode.com/posts'; | |
// 🔍 Exemple 1 : Requête GET avec .then() et .catch() | |
fetch(apiUrl) | |
.then((response) => { | |
if (!response.ok) { | |
throw new Error('Erreur de réseau : ' + response.status); | |
} | |
return response.json(); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Méthodes de manipulation du DOM</title> | |
</head> | |
<body> | |
<h1 id="title">Titre initial</h1> | |
<ul id="list"> | |
<li>Élément 1</li> | |
<li>Élément 2</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🔍 Fonctions avancées liées aux Promesses en JavaScript/TypeScript | |
// 🔍 Fonction qui renvoie une Promesse résolue après un délai | |
function resolveAfterDelay(delay: number): Promise<string> { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(`Promesse résolue après ${delay} millisecondes`); | |
}, delay); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🔍 Fonctions d'Objets et JSON en JavaScript/TypeScript | |
// 🔍 Object.keys() : Récupérer les clés d'un objet | |
const person: { [key: string]: any } = { name: 'John', age: 30, city: 'New York' }; | |
const keys = Object.keys(person); | |
// 👉 Résultat : ['name', 'age', 'city'] (keys est un tableau) | |
// 🔍 Itération sur chaque clé et affichage de la clé et de la valeur | |
for (const key of keys) { | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🔍 Fonctions de Parsing en TypeScript | |
// 🔍 parseInt() : Convertir une chaîne de caractères en un entier | |
const numString: string = '42'; | |
const parsedInt: number = parseInt(numString); | |
// 👉 Résultat : 42 (typeof parsedInt est number) | |
// 🔍 parseFloat() : Convertir une chaîne de caractères en un nombre à virgule flottante | |
const floatString: string = '3.14'; | |
const parsedFloat: number = parseFloat(floatString); |
NewerOlder