function useTimeout(ms = 0) {
const [ready, setReady] = React.useState(false);
React.useEffect(function () {
const int = setTimeout(() => setReady(true), ms);
return () => clearTimeout(int);- Open a terminal and
pastethe following command ☝️😲WITHOUT EXECUTING IT:
pbpaste | npx https://gist.github.com/abernier/00ac26ff978aebdfa6f3f65019fe2bf0 10 | pbcopy
NB:10being the number of combinations wanted - In a spreadsheet,
copyrows of names: - In the previous terminal, press now
ENTERto execute the pasted command at step0.:
Pastethe result into spreadsheet
This file contains hidden or 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 express = require('express') | |
| const app = express() | |
| const port = 3000 | |
| app.get('/', (req, res) => res.send('Hello World!')) | |
| app.get('/login', (req, res) => res.send('Merci de te logguer')) | |
| app.get('/signup', (req, res) => res.send('Merci de créer ton compte')) | |
| app.listen(port, () => console.log(`Example app listening on port ${port}!`)) |
Une API se dira "RESTful" quand elle va respecter certaines conventions.
C'est presque comme un label de qualité, que les développeurs vont aimer. Par ex, dans une API permettant de laisser des commentaires, pour CREER un nouveau commentaire, une API RESTful utilisera le verbe POST ainsi qu'un nom de route au pluriel, soit : POST /comments.
Bien sûr, elle aurait pu choisir autre chose, comme une route au singulier, mais par convention elle tâchera de respecter le pluriel. Comme ça, elle fera plaisir aux développeurs utilisant son API, qui s'y retrouveront plus facilement par habitude de toujours retrouver cette convention entre les différentes APIs qu'ils utiliseront.
La liste complète des conventions RESTful sont :
This file contains hidden or 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 lang="fr"> | |
| <head> | |
| <meta charset="utf-8"/> | |
| <meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1,initial-scale=1"> | |
| <title></title> | |
| <link rel="stylesheet" href="styles.css"> | |
| </head> | |
| <body id="accueil"> |
| First Header | Second Header |
|---|---|
| Content from cell 1 | Content from cell 2 |
| Content in the first column | Content in the second column |
This file contains hidden or 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 lang="fr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title></title> | |
| <link rel="stylesheet" href="styles.css"> | |
| </head> | |
| <body> | |
| <script src="https://code.jquery.com/jquery-3.3.1.js"></script> |
This file contains hidden or 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> | |
| <meta charset="utf-8"> | |
| <title></title> | |
| <!--<link rel="stylesheet" href="">--> | |
| </head> | |
| <body> | |
This file contains hidden or 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
| // Default export | |
| export default () => { | |
| let greetings = `Hi from the default export!` | |
| console.log(greetings); | |
| return greetings; | |
| }; | |
| // Named export `doStuff` | |
| export const doStuff = () => { |
This file contains hidden or 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
| function rateLimit(limitCount, limitInterval, fn) { | |
| var fifo = []; | |
| // count starts at limit | |
| // each call of `fn` decrements the count | |
| // it is incremented after limitInterval | |
| var count = limitCount; | |
| function call_next(args) { | |
| setTimeout(function() { |



