Skip to content

Instantly share code, notes, and snippets.

View NerOcrO's full-sized avatar
🏠
Working from home

Fabien NerOcrO

🏠
Working from home
View GitHub Profile
// ==UserScript==
// @name Vérifier la bonne configuration d'un projet JavaScript
// @namespace http://tampermonkey.net/
// @version 2024-06-09
// @description Vérifier la bonne configuration d'un projet JavaScript
// @match https://github.com/inclusion-numerique/*
// @match https://github.com/anct-cnum/*
// @grant GM_xmlhttpRequest
// @connect raw.githubusercontent.com
// ==/UserScript==
@NerOcrO
NerOcrO / tsconfig.json
Last active October 7, 2023 15:11
typescript tsconfig
// TS v5.2
// Quelques bases https://github.com/tsconfig/bases#centralized-recommendations-for-tsconfig-bases
// tsconfig.json
{
"compilerOptions": {
// Interop Constraints
// ???
"esModuleInterop": true,
// ???

Prérequis d'un langage en production

  • Python est codé en C
  • Node.js est codé en C++
  • Python est mono coeur car créée avant l'apparition des multi coeur
  • Node.js est mono thread

Immutable

Typescript ✅

@NerOcrO
NerOcrO / low-tech.md
Last active June 18, 2022 14:37
low-tech

Wording à utiliser

  • Sobriété numérique
  • Accessibilité
  • Réparabilité

Définition

  • L’empreinte carbone de la fabrication des terminaux est la part la plus importante de l’impact du numérique
  • C’est plus important de ne pas envoyer un e-mail que d’en stocker une grosse quantité
@NerOcrO
NerOcrO / rust.md
Last active February 19, 2024 09:14
rust
@NerOcrO
NerOcrO / prettierrc.json
Last active May 17, 2024 12:11
eslint linter prettier
// Prettier est inutile sur un projet où il y a eslint
{
"printWidth": 120, // max-len
"tabWidth": 2, // indent
"useTabs": false, // no-tabs
"semi": false, // semi
"singleQuote": true, // quotes
"quoteProps": "as-needed", // quote-props
"jsxSingleQuote": false, // jsx-quotes
"trailingComma": "es5", // comma-dangle
@NerOcrO
NerOcrO / nextjs.md
Last active May 23, 2022 21:08
nextjs
  • code splitting par défaut par page
  • s'il y a un Link dans une page, en production uniquement, il prefetche la page du lien en question quand on passe la souris dessus
  • static generation : généré au build time (sauf en dev) et ne change jamais
    • peut être cachée par un CDN car c'est une page HTML (code source en HTML)
  • par défaut, une page est statique
@NerOcrO
NerOcrO / postgresql.md
Last active August 27, 2022 06:59
postgresql sql
  • https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
  • https://pgtune.leopard.in.ua/
  • A priori, on ne peut pas avoir les logs en stdout...
  • SHOW config_file pour voir où est le fichier de config
  • docker exec -it pc-postgres cat /var/lib/postgresql/data/postgresql.conf
  • docker exec -it pc-postgres cat /var/lib/postgresql/data/log/postgresql-2020-03-16_144749.log
  • docker exec -it pc-postgres tail -f /var/lib/postgresql/data/log/postgresql-2020-03-17_103605.log
  • SELECT * FROM pg_matviews WHERE matviewname = 'discovery_view';

Bonnes pratiques

@NerOcrO
NerOcrO / tennisGame1.ts
Created April 8, 2021 07:40
solution kata tennis refacto
import { TennisGame } from './TennisGame';
export class TennisGame1 implements TennisGame {
private scoreForPlayer1: number = 0;
private scoreForPlayer2: number = 0;
private player1Name: string;
private player2Name: string;
private score: string = '';
private normalPoints: string[] = [
@NerOcrO
NerOcrO / clean-architecture.md
Last active October 29, 2023 15:28
pragmatic programmer software craftsman clean code tdd clean architecture legacy