Skip to content

Instantly share code, notes, and snippets.

View arnaudrenaud's full-sized avatar

Arnaud Renaud arnaudrenaud

  • Wild Code School
  • Paris, France
View GitHub Profile
@arnaudrenaud
arnaudrenaud / index.js
Last active February 29, 2024 12:16
Measure execution time in Node.js
const { performance } = require("perf_hooks");
const start1 = performance.now();
JSON.stringify({ emailAddress: "arnaud.renaud@gmail.com" });
const end1 = performance.now();
console.log(
`Time taken to execute JSON.stringify function is ${end1 - start1}ms.`
);
const start2 = performance.now();
@arnaudrenaud
arnaudrenaud / index.js
Created January 31, 2024 22:26
Generate subtitles SRT file from raw text file
const { readFileSync, writeFileSync } = require("fs");
function getFormattedTime(timeMilliseconds) {
return new Date(timeMilliseconds).toISOString().substring(11, 23);
}
const REPLACEMENT_PROBABILITY = 0.01;
const REPLACEMENT_CHARACTERS = "✴⦧⦖";
function getRandomlyReplacedText(text) {
if (REPLACEMENT_PROBABILITY === 0) {
@arnaudrenaud
arnaudrenaud / README.md
Last active May 22, 2023 11:57
Checkpoint : base de données

Checkpoint

Base de données

Dans cet exercice il s'agira d'abord de modéliser puis de créer la base de données d'un job board.

Un job board est un site internet qui permet aux entreprises de publier des offres d'emploi.

Voici les contraintes de la base de données du job board :

@arnaudrenaud
arnaudrenaud / apollo-client.ts
Created April 27, 2023 07:19
Next.js & Apollo
import {
ApolloClient,
InMemoryCache,
NormalizedCacheObject,
} from "@apollo/client";
import { useMemo } from "react";
import merge from "deepmerge";
import isEqual from "lodash/isEqual";
const GRAPHQL_PATH = "/graphql";
@arnaudrenaud
arnaudrenaud / convert-jpgs-to-smaller.sh
Last active April 11, 2023 18:47
Batch convert videos to 1280x720 H.265
convert *.jpg -resize 50% -set filename:f '%t' smaller/'%[filename:f].jpg'
@arnaudrenaud
arnaudrenaud / index.ts
Created September 20, 2021 15:27
Cours TypeScript
const box: any[] = [];
box.push(987237);
// [987237]
const itemsToPush = [1234, 7253, 0, 23];
box.push(...itemsToPush);
// [987237, [1234, 7253, 0, 23]]
// ------
@arnaudrenaud
arnaudrenaud / help.md
Created April 12, 2021 13:56
Cannot start Caddy as a service with systemd (Ubuntu 20.04)
@arnaudrenaud
arnaudrenaud / B3.ts
Created February 5, 2021 14:25
Corrections exercices algo
/**
* In this challenge, you must find and attach to each group the group (or groups)
* with which the current group has the most skills in common.
* Attached groups must be sorted by their name (A to Z).
* You must not change the order of the main list of groups.
*
* @param groups List of groups without closestGroups
* @returns The same list but with a new closestGroups prop on each
*/
@arnaudrenaud
arnaudrenaud / README.md
Created December 3, 2020 11:51
desert-film