Skip to content

Instantly share code, notes, and snippets.

View belgattitude's full-sized avatar

Sébastien Vanvelthem belgattitude

View GitHub Profile
@belgattitude
belgattitude / ci-pnpm-install.md
Last active April 13, 2024 14:14
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 April 9, 2024 09:40
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:
// globby@11.0.4
// chalk@4.1.2
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 April 10, 2024 20:23
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 March 10, 2023 13:17
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 March 13, 2024 19:16 — 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>
@belgattitude
belgattitude / install_phpexcel_php7.sh
Last active February 17, 2019 17:24
Install libxl, php_excel extension on PHP7.1 (ondrej/ppa)
#!/bin/bash
#
# ilia/php_excel extension example install script for PHP7+
#
# usage:
# > sudo ./install_phpexcel_php7.sh
# > (optionally) sudo service php7.1-fpm restart)
#
# requirements:
# - Ubuntu 64bits (trusty/xenial)