Skip to content

Instantly share code, notes, and snippets.

View belgattitude's full-sized avatar

Sébastien Vanvelthem belgattitude

View GitHub Profile
@stenuto
stenuto / hls.sh
Created November 7, 2024 16:58
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@belgattitude
belgattitude / ci-pnpm-install.md
Last active November 1, 2024 19:25
Composite github action to improve CI time with pnpm

Why

Although @setup/node as a built-in cache option, it lacks an opportunity regarding cache persistence. Depending on usage, the action below might give you faster installs and potentially reduce carbon emissions (♻️🌳❤️).

Requirements

pnpm v7 or v8 (not using pnpm ? see the corresponding yarn action gist)

Bench

@belgattitude
belgattitude / ci-yarn-install.md
Last active November 5, 2024 08:32
Composite github action to improve CI time with yarn 3+ / node-modules linker.

keyword: material ui, mui, typescript, intellisense, vscode

microsoft/TypeScript#39326

microsoft/TypeScript#34801

When using mui with typescript, there is performance issue with vscode intellisense, because of type checking.

I've read the comments and found a clue that some csstypes given by mui might be source of issue.

@PabloSzx
PabloSzx / test-esm.mjs
Created August 12, 2021 16:45
Quick test Node.js ESM
// Using:
// [email protected]
// [email protected]
import globby from 'globby';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import chalk from 'chalk';
async function main() {
@astoilkov
astoilkov / useDebounceCallback.ts
Last active March 16, 2020 08:22
React hook for debouncing callbacks
import { useCallback, useLayoutEffect, DependencyList } from 'react'
/**
* This version bounces each version of the callback. This ensures that the callback
* will be called with each state of the application. That's why `deps` is a required argument.
*
* Previous version used `useRef` for `timeoutId` and didn't have `deps` argument.
* This resulted in missing calling the callback for the previous state and necessarily
* calling it for the new state.
*
@OliverJAsh
OliverJAsh / foo.md
Last active September 4, 2023 15:31
`Option` vs non-`Option`

Option vs non-Option

Option<T> non-Option (T | undefined)
accessing property userOption.map(user => user.age) userNullish?.age
calling a method userOption.map(user => user.fn()) userNullish?.fn()
providing fallback ageOption.getOrElse(0) ageNullish ?? 0
filter ageOption.filter(checkIsOddNumber) `ageNull
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active November 4, 2024 07:33
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@florentdestremau
florentdestremau / NewPasswordType.php
Last active August 1, 2024 15:14
A simple User authentication setup to copy & paste into your Symfony 3.4 install
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
@derekchiang
derekchiang / app.html
Last active August 13, 2024 08:01 — forked from bellbind/app.html
[electron]Use electron as a Web Server
<!doctype html>
<html><head><script src="app.js"></script></head><body></body></html>