Skip to content

Instantly share code, notes, and snippets.

@Naedri
Naedri / reduce.js
Created August 6, 2022 07:28
Simple example of reduce function.
const totalAdresse = docs.reduce((prevValue, contrat) => {
console.log(prevValue, contrat);
if (prevValue.includes(contrat.adresse)) {
return prevValue;
} else {
return [...prevValue, contrat.adresse];
}
}, []);
const totalAchatAndVente = docs.reduce(
@Naedri
Naedri / useEffect-comparison.tsx
Last active July 28, 2022 13:24
Comparing `useEffect` runs (React and Ionic flavors).
import { useIonViewWillEnter, IonText } from '@ionic/react';
import { FC, useRef, useEffect } from 'react';
export interface ComponentProps {
data: any;
}
const Component: FC<ComponentProps> = ({ data }: ComponentProps) => {
const compoRef = useRef<HTMLDivElement>(null);
const isFirstRender = useRef(true);
@Naedri
Naedri / A100-Coding-Rules.md
Last active December 5, 2023 06:17
Coding rules such as : linting, formatting, versionning and code development.

Coding rules

Coding rules such as : linting, formatting, versionning and code development.

@Naedri
Naedri / Install-Config.md
Last active July 2, 2024 21:12
Just to save configuration of a functional environment to develop web applications.

Install-Config

Windows

For windows, you can use the following bash script with PowerShell.exe to quickly install the above softwares with chocolatey (a software management for windows). You can look for other softwares at this page.

@Naedri
Naedri / Awesome-IT-BookMarks.md
Last active September 5, 2024 11:01
To bookmark online knowledge resources and trendy new technologies in the field of computer science.
@Naedri
Naedri / DesignPattern-Modularity-Typing.md
Last active September 12, 2023 12:02
Patrons de conception par modularité et typage.
@Naedri
Naedri / Python-vs-Bash.md
Last active July 25, 2022 12:13
To find and replace string in a text.

String operations comparison in Python and Bash

@Naedri
Naedri / A100_Describe_Error.md
Last active July 25, 2022 11:58
To describe error from Client and Server with internationalization support

Error description in TS

const Logger = {
info: (className: string, message: string, functionName?: string): void => {
console.log(
`${FgWhite}${getDate()} ${FgGreen}LOG ${FgYellow}[${className}]${
functionName ? `(${functionName})` : ''
} ${FgGreen}${message}${Reset}`
);
},
warn: (className: string, message: string, functionName?: string): void => {
console.warn(
@Naedri
Naedri / A100_Internationalization.md
Last active July 25, 2022 12:35
Internationalization with react-i18next

Internationalization

This app aims to support internationalization, thanks to i18next. A crash course is available on YouTube.