Skip to content

Instantly share code, notes, and snippets.

View hsoulier's full-sized avatar
🌐
Help to create the future creative search engine @flim-team

hsoulier hsoulier

🌐
Help to create the future creative search engine @flim-team
View GitHub Profile
@hsoulier
hsoulier / index.tsx
Created September 14, 2023 08:02
Cheatsheet React composition TS
import React from "react"
const Modal = ({ children }: { children: React.ReactNode }) => {
return React.Children.map(children, (child) => {
if (!React.isValidElement(child)) {
return null;
}
React.cloneElement(child);
});
};
@hsoulier
hsoulier / index.ts
Last active March 17, 2022 10:44
Cheatsheet Typescript
const isArrayEmpty = (arr: unknown[]): boolean => Array.isArray(arr) && !arr.length;
const capitalize = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1);
const isObjectEmpty = (obj: unknown): boolean => obj && Object.keys(obj).length === 0;
const randomInteger = (min: number, max: number): number => Math.floor(Math.random() * (max - min + 1)) + min;
const clamp = (input: number, min: number, max: number): number => input < min ? min : input > max ? max : input
@hsoulier
hsoulier / README.md
Last active May 15, 2021 15:08
Symfony Cheatsheet

Symfony 5

CLI

symfony new --full my_project # Create empty project symfony (web app)
symfony serve # Start the dev server

Controller