Skip to content

Instantly share code, notes, and snippets.

View mathieueveillard's full-sized avatar

Mathieu Eveillard mathieueveillard

View GitHub Profile

Arrêtez de coder, apprenez à développer.

"Coder". "Développer". Avez-vous remarqué que l'on emploie indifféremment un mot et l'autre ? Sont-ils strictement équivalents ?

"Développer", on voit bien : on développe des sites Web, des applications mobiles, des jeux, de l'informatique embarquée… on facilite des métiers existants en les dématérialisant, on crée de nouveaux usages, on ouvre de nouveaux horizons.

Fort bien.

Mais pourquoi "coder" ? Le mot évoque la cryptographie, champ de savoir dans lequel un message n'est plus directement intelligible par les humains. C'est logique, puisque que le code est destiné aux machines. Cela remonte aux cartes perforées des orgues de Barbarie (on encode une musique) et des métiers à tisser (on encode un motif), ancêtres de l'ordinateur.

/*
* This code snippet is an extract of a private codebase. Though it relies on many dependencies to
* the rest of the codebase, I believe that the code carries enough intension so that one can get
* the overall idea (see: https://blog.mathieueveillard.com/monkey-testing-et-property-based-testing-une-exploration)
*/
import fc from "fast-check";
const ALL_REDUCERS: HasName<Reducer<ApplicationState>>[] = [
withName("selectPhotograph")(pickRandomIndex(getNumberOfPhotographs)(selectionReducers.selectPhotograph)),
export const createMock = <T>(values: T[] = []) => {
function* generator(): Generator<T, T | undefined, T> {
for (let i = 0; i < values.length; i++) {
yield values[i];
}
return undefined;
}
const generatorInstance = generator();
const IdentityFunctor = <S>(value: S) => {
return {
map: <U>(fn: (s: S) => U) => IdentityFunctor(fn(value)),
valueOf: () => value,
};
};
const appendIfMultipleOf = (stringToAppend: string) => (m: number) => (n: number) => (s: string): string => {
if (n % m === 0) {
return (s += stringToAppend);
const isMultipleOf = (m: number) => (n: number): boolean => n % m === 0;
export function internal(n: number): string {
let result = "";
if (isMultipleOf(3)(n)) {
result += "Fizz";
}
if (isMultipleOf(5)(n)) {

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.