Skip to content

Instantly share code, notes, and snippets.

View benjaminrobinet's full-sized avatar

Benjamin Robinet benjaminrobinet

View GitHub Profile
import ffmpeg from "fluent-ffmpeg";
import { promises as fs } from "fs";
import path from "path";
// Chemin du dossiercd source contenant les fichiers à encoder
const inputFolder = "./sources";
// Chemin du sous-dossier où les fichiers encodés seront placés
const outputFolder = "../public/static";
// Fonction pour vérifier si un dossier existe, sinon le créer
@benjaminrobinet
benjaminrobinet / horizontal-loop.ts
Last active January 18, 2024 10:35
GSAP Horizontal Loop Typescript
import { gsap, Draggable } from 'gsap/all'; // you might need to change the imports depending on your bundler
/*
This helper function makes a group of elements animate along the x-axis in a seamless, responsive loop.
Features:
- Uses xPercent so that even if the widths change (like if the window gets resized), it should still work in most cases.
- When each item animates to the left or right enough, it will loop back to the other side
- Optionally pass in a config object with values like "speed" (default: 1, which travels at roughly 100 pixels per second), paused (boolean), repeat, reversed, and paddingRight.
- The returned timeline will have the following methods added to it:
@benjaminrobinet
benjaminrobinet / CustomPageTransition.vue
Last active April 11, 2023 16:07
Trick to have sequential page transitions using nuxt 3 routeur
<template>
<Transition v-bind="pageTransition">
<div :key="$route.fullPath">
<slot :transition="nuxtPageTransition">
<NuxtPage :transition="nuxtPageTransition" />
</slot>
</div>
</Transition>
</template>
@benjaminrobinet
benjaminrobinet / lethargy.js
Last active September 23, 2022 16:14
Lethargy ES6 (fork / refactor of Lethargy rewritten in ES6)
/**
* @author d4nyll
*
* @see https://github.com/d4nyll/lethargy
*
* @license
* The MIT License (MIT)
*
* Copyright (c) 2015 Daniel Li
*
@benjaminrobinet
benjaminrobinet / example.php
Last active May 7, 2021 19:58
Update programmatically ACF Field of a Gutenberg block WordPress
require_once 'update-block-field.php';
update_block_field($post->ID, 'block_a9be4eda43a', 'title', 'Hello world');