Code snippets
You will find here 289 code snippets I find useful so I don't have to Google ™ or Stackoverflow ™ them when I need. There are also code snippets I always forget! 😁 Sometimes, related links to the code will be available. The main difference with other random snippets you will find on the web is that in most cases (for the Symfony related ones) you will be able to run them directly from this website to check the output so you can verify it works as expected ™.
In the previous snippet, we saw how to do it for a Postgres service; now it's for MySQL. The process is similar, but there is a sl...
Docker
Published on 2020-09-03 • Modified on 2020-09-03
In this snippet, we will see how to wait for the Postgres service to be available before using it. It's to avoid the following kin...
Docker
Published on 2020-08-30 • Modified on 2020-08-30
In this snippet, we will see how to mark with an asterisk all the required fields of a Symfony form. We will do it with CSS. Inspe...
Symfony
Published on 2020-08-25 • Modified on 2020-08-25
In this snippet, we will see how to get the block names of a Twig template. To do so, we must use the Twig\Environment service whi...
Twig
Published on 2020-08-08 • Modified on 2020-08-08
In this snippet, we will see how to get the fields and associations list of a Doctrine entity. First, we get the meta class of the...
Doctrine
Published on 2020-08-01 • Modified on 2020-08-01
In this snippet, we will see how to test raw PHP code with the built-in web server. Sometimes, it's useful to use a clean context ...
PHP
Published on 2020-07-26 • Modified on 2020-07-26
In this snippet, we will see how to get a variable from an include. Here, we affect the return value of an include call to the $de...
PHP
Published on 2020-07-25 • Modified on 2020-07-25
In this snippet, we will see how to extract a result from a JavaScript array using the reduce function and a callback. First, we d...
JavaScript
Published on 2020-07-19 • Modified on 2020-07-19
In this snippet, I will show you the changes I add to make on my configuration when I upgraded Doctrine Migrations from v2.x to v3...
Doctrine
Published on 2020-07-18 • Modified on 2020-07-18
In this snippet, we will see how to detect the status of the Internet connection with JavaScript. A message is displayed just abov...
JavaScript
Published on 2020-07-12 • Modified on 2020-07-12