Skip to content

Instantly share code, notes, and snippets.

View Baldrani's full-sized avatar
💢
C T 😮 (Carlos) G 😮 (hs) N E

Maël Mayon Baldrani

💢
C T 😮 (Carlos) G 😮 (hs) N E
View GitHub Profile
@Baldrani
Baldrani / doc.md
Created February 6, 2026 06:59
Run a Github action without merging to main

Running GitHub Actions Workflow from Terminal

Trigger workflow from a feature branch

gh workflow run "Publish beta package (TEST)" \
  --repo Launchmetrics/GIS-shared \
  --ref m-fix-beta-package-workflow \
  --field pr-number=332 \
  --field targets=GIS-mekong:m-feature-test-new
@Baldrani
Baldrani / .p10k.zsh
Created October 15, 2025 11:36
Optimized ZSH Config
# Generated by Powerlevel10k configuration wizard on 2023-10-03 at 22:03 CEST.
# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 48479.
# Wizard options: compatible, classic, unicode, dark, 24h time, flat heads, flat tails,
# 1 line, compact, fluent, transient_prompt, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
@Baldrani
Baldrani / loop.ts
Created May 6, 2025 12:59
Loop on array without loop
const changeMessage = React.useCallback(() => {
const currentIndex = shuffledMessages.indexOf(message);
const nextIndex = (currentIndex + 1) % shuffledMessages.length;
setMessage(shuffledMessages[nextIndex]);
}, [message, shuffledMessages]);
@Baldrani
Baldrani / snippet.ts
Created September 21, 2023 12:35
[Exemple of script to update database] #script #typescript #ts #launchmetrics
/* istanbul ignore file */
import { PrismaClient } from '@prisma/client';
import fs from 'fs';
import { uniq, uniqBy } from 'lodash';
import { executeESAction } from '@/lib/server/ESManager/ESManager_init';
/**
* Define the chunk method in the prototype of an array
@Baldrani
Baldrani / snippet.md
Created February 17, 2023 07:47
[Kill Docker Container] #docker
alias stopall='docker kill $(docker ps -q)’

alias removeall='docker rm $(docker ps -a -q)source ~/.bash_profile
import React from "react";
import { CSSTransition } from "react-transition-group";
import ModalPortal from "../ModalPortal";
export function useModal() {
const [isModalVisible, setIsModalVisitble] = React.useState(false);
const toggleModal = () => {
setIsModalVisitble((prevState) => !prevState);
};
const closeModal = () => {
@Baldrani
Baldrani / readme.md
Created July 8, 2022 10:36
[Add tailwind to Presta] #presta #tailwind
// tailwind.config.js
module.exports = {
    prefix: "tw-",
    content: ["../templates/**/*.{tpl,js}"],
    theme: {
        extend: {},
    },
    plugins: [],
};
@Baldrani
Baldrani / snippet.md
Created April 27, 2022 16:05
[DPR] #mediaQuerries
  export const DEFAULT_PIXEL_RATIO = 1;
  export function clientPixelRatio(): number {
    if (typeof window !== 'undefined' && window.devicePixelRatio) {
      return Math.round(window.devicePixelRatio);
    }
    return DEFAULT_PIXEL_RATIO;
  }
@Baldrani
Baldrani / snippet.js
Created March 3, 2022 05:37
[debugging tips in javascript] #javascript
document.getElementById('myId')
console.dir(htmlElement) // TO display more than just the element