Skip to content

Instantly share code, notes, and snippets.

View enzoclock's full-sized avatar
🦙

Enzo Testa enzoclock

🦙
  • O'clock
  • Paris
View GitHub Profile
@enzoclock
enzoclock / mpd-oquiz.sql
Last active October 8, 2025 12:15
mpd-oquiz.sql
BEGIN; -- Début de transaction
-- =========================================
-- Supprimer les tables existantes
-- =========================================
DROP TABLE IF EXISTS "attempt";
DROP TABLE IF EXISTS "quiz_has_tag";
DROP TABLE IF EXISTS "choice";
DROP TABLE IF EXISTS "question";
DROP TABLE IF EXISTS "quiz";
@enzoclock
enzoclock / body.md
Last active September 3, 2024 07:51
Body format et body parser

Body formats & body parsers

Lorsqu'on développe ou utilise une API, on est souvent amené à écrire des requêtes POST, PATCH ou PUT qui ont une caractéristique commune : elle doivent généralement contenir un corps pour transmettre la donnée : c'est le body !

Côté client

On peut choisir le type de body qu'on envoie. On utilise généralement l'un de ces 3 formats :

application/json
@enzoclock
enzoclock / eslint.md
Last active October 8, 2024 07:14
ESLint

ESLint

ESLint is an open-source tool that helps developers maintain consistent coding style and quality by identifying and fixing issues in JavaScript code.

It performs static code analysis, which means it examines the code without running it to detect common errors, potential bugs, and style violations.

Prerequisites

Make sure to be at your project root folder:

@enzoclock
enzoclock / fetch-api.md
Last active November 8, 2023 16:04
Fetch API & Error handling

Fetch API & Error handling

Case 1 : everything works fine !

try {

  const httpResult = await fetch("http://working-api/todos"); // The API response with proper JSON
  console.log(httpResult.ok); // true
@enzoclock
enzoclock / locals.md
Last active September 3, 2024 07:50

res.locals VS app.locals

Objectif

Ces deux variables servent au même objectif : ajouter une valeurs dans les locals pour être utilisé dans les views EJS.

res.locals.games = ["..."]; // la variable `games` est alors accessible dans les views
@enzoclock
enzoclock / Installer Node 22.md
Last active January 16, 2025 17:48
Installer Node 22

Installer Node 22

Dans les grandes lignes :

  • Installer NVM (Node Version Manager) via sa documentation officielle
  • Installer Node 22 via NVM
  • Choisir et persister le choix de la version de node dans son terminal

En détail

@enzoclock
enzoclock / must-have-mac.md
Last active October 2, 2023 12:41
Mac must-have (for web-dev & beyond)

Must-have Mac (for web-dev & beyond)

(most apps bellow can be installed via Homebrew)

  • Homebrew: package manager
  • iTerm2: terminal
  • Chrome: web browser
  • Firefox: web browser
  • Spectacle: window manager
  • Espanso: snippets & shortcuts manager