Skip to content

Instantly share code, notes, and snippets.

View mlaopane's full-sized avatar
🍍
Improving my JS/TS skills

Mickaël mlaopane

🍍
Improving my JS/TS skills
  • France
View GitHub Profile
@mlaopane
mlaopane / CustomModal.tsx
Created November 13, 2025 20:57
Mantine Modal with scrollable body
import { Modal, Box, Flex, Text, Paper, ScrollArea } from "@mantine/core";
import { PropsWithChildren } from "react";
interface Props {
isOpen: boolean;
onClose: () => void;
children: React.ReactNode;
}
export const CustomModal = ({ isOpen, onClose, children }: Props) => {
@mlaopane
mlaopane / Pipeline.ts
Created October 31, 2025 09:40
Pipe functions with type inference on each pipe call
type Transformer<I, O> = (input: I) => O
/**
* @example
* ```ts
* Pipeline.init({id: 1, name: "John"})
* .pipe((user) => `${user.name}-${user.id}`)
* .pipe((slug) => slug.toLocaleLowerCase())
* .value()
* // Result === "john-1"
@mlaopane
mlaopane / HtmlCleaner.php
Last active February 23, 2024 18:49
HTML cleaner to remove specific tags
<?php
/**
* Useful to remove tags (e.g <script>// some javascript code</script>)
*/
class HtmlCleaner
{
/**
* Remove tags from a string
* - opening tags
@mlaopane
mlaopane / Templating.php
Last active July 25, 2019 05:33
A class to render and create html/twig templates
<?php
/**
* This class allows to :
* - render templates from a basePath
* - create/update templates from nothing or using an existing template as a base
*
*/
class Templating
{