Skip to content

Instantly share code, notes, and snippets.

@Xbirdfr
Xbirdfr / keybase.md
Created May 14, 2016 18:41
keybase.md

Keybase proof

I hereby claim:

  • I am xbirdfr on github.
  • I am xbird (https://keybase.io/xbird) on keybase.
  • I have a public key whose fingerprint is 1B10 C232 189C C395 FA21 2B99 9464 B960 4AE1 6792

To claim this, I am signing this object:

@Xbirdfr
Xbirdfr / gist:a20e3b985d0c615e73bc2bec47021036
Created December 9, 2021 13:35
Update speedtest on RapsberryPi
sudo apt remove speedtest
sudo rm -f /etc/apt/sources.list.d/speedtest.list
sudo apt update
sudo mkdir /opt/speedtest
sudo chown pi:pi /opt/speedtest
cd /opt/speedtest
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-armhf.tgz
gunzip ookla-speedtest-1.1.1-linux-armhf.tgz
tar xvf ookla-speedtest-1.1.1-linux-armhf.tar
chmod +x speedtest
@Xbirdfr
Xbirdfr / Symfony 5.4 - FormAuthenticator - Remember me Badge.txt
Created January 5, 2022 14:15
Symfony 5.4 - FormAuthenticator - Remember me Badge
// src\Security\FormAuthenticator.php
// auto generated symfony cli
//edit the file and add ' new RememberMeBadge(), ' into the 'new PasswordCredentials' array
public function authenticate(Request $request): PassportInterface
{
$email = $request->request->get('email', '');
$request->getSession()->set(Security::LAST_USERNAME, $email);
@Xbirdfr
Xbirdfr / BootstrapThemeSwitcher.js
Last active January 4, 2023 18:21
Bootstrap v5.3+ javascript theme switcher
//Xbird.me Bootstrap v5.3+ javascript theme switcher
//get current system theme
function themeGetSystem() {
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light";
}
//get default website theme ( data-bs-theme on <body>) or return auto if not defined
function themeGetDefault() {
return document.body.dataset.bsTheme ?? 'auto';
@Xbirdfr
Xbirdfr / gist:d357d4dc7c2630c20e528a2e49517943
Created August 14, 2023 17:30
BASHRC auto choose file extractor
//FROM https://superuser.com/a/44187
x(){
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
@Xbirdfr
Xbirdfr / form_layout.html.twig
Created December 14, 2023 13:22
Symfony Twig Tailwind add red star on label for required fields
{# templates/form_layout.html.twig #}
{%- block form_label -%}
{%- if required and not disabled -%}
{%- set label_attr = label_attr|merge({ class: 'after:content-[\'*\'] after:ml-0.5 after:text-red-600' }) -%}
{%- endif -%}
{{- parent() -}}
{%- endblock form_label -%}
@Xbirdfr
Xbirdfr / README
Last active August 10, 2024 20:15
[Symfony 7] [symfony/ux-icons] : simple alias
With https://github.com/symfony/ux-icons allowing us to have a nice way to handle icons,
I wanted a simple way to update my icons when i want to.
Like if i use a "material-symbols:home" for my home icon, but after I find the "solar:home-bold" more convenient for my app,
I don't want to go back on each file where the home icon is used.
So I write this :
- config\uxIconsAlias.yaml store alias for icons
- and " ux_icon_alias( ) " get the value of the alias, so i just need to do : {{ ux_icon(ux_icon_alias('home')) }}
@Xbirdfr
Xbirdfr / gist:ada786d37bef946b1cdb183eaafc146f
Created December 1, 2024 14:18
Symfony packages after Dunglas Docker
composer require symfonycasts/tailwind-bundle doctrine/doctrine-bundle doctrine/orm symfony/twig-bundle symfony/asset-mapper symfony/asset symfony/twig-pack symfony/ux-turbo
composer require --dev symfony/maker-bundle symfony/profiler-pack