Skip to content

Instantly share code, notes, and snippets.

View Lenny4's full-sized avatar
😡
Focusing

Alexandre Beaujour Lenny4

😡
Focusing
View GitHub Profile
docker system prune -a
docker volume prune -a
<?php
/**
* Plugin Name: ExamplePlugin
* Version: 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
add_action(
@Lenny4
Lenny4 / gist:448cc3894b940d3877f02754a9893cdf
Created November 14, 2024 15:29
Change event to document.body for dynamically added elements
<?php
/**
* Plugin Name: ExamplePlugin
* Version: 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
add_action(
@Lenny4
Lenny4 / gist:0bf3370ffba7b833ff76fe4017fa0a48
Created September 26, 2023 17:57
Match all html tag except `<s></s>` and `<strong></strong>`
### Match all html tag except `<s></s>` and `<strong></strong>` :
- `<(?!\/?(s|strong)(?=>|\s.*>|\/>))\/?.*?>`
- source : https://stackoverflow.com/questions/29869/regex-to-match-all-html-tags-except-p-and-p#answer-2928149
- php
```
<?php
function regexHtmlTags($string)
{
$arrayTags = ["s", "strong", "em", "p"];
$pattern = "/<(?!\/?(" . implode($arrayTags, '|') . ")(?=>|\s.*>))\/?.*?>/";
@Lenny4
Lenny4 / Create a symfony Bundle.txt
Last active August 29, 2022 12:45
Create a symfony Bundle
1) start with: https://github.com/spatie/package-skeleton-php
2) Install symfony flex as dev dependency (important): https://symfony.com/doc/current/setup/flex.html
3) https://symfonycasts.com/screencast/symfony-bundle
@Lenny4
Lenny4 / gist:93c436bcafc8c2e9f5139577c5e24632
Created September 30, 2020 12:58
Remove special char php
```php
setlocale(LC_ALL, 'fr_FR.UTF-8');
$result = iconv('UTF-8', 'ASCII//TRANSLIT', $varAEneleverLeschartateresSpeciaux)
```
@Lenny4
Lenny4 / vhost.conf
Last active November 19, 2020 12:15
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@Lenny4
Lenny4 / gist:1ac68f4cf0f1383886db6419db5f9c6a
Created June 12, 2020 14:09
Show total number lines of code per author
git ls-files | while read f; do git blame --line-porcelain $f | grep '^author '; done | sort -f | uniq -ic | sort -n
@Lenny4
Lenny4 / gist:ab356e9eefcf598892a2fbd52d94ffe7
Last active September 15, 2023 12:22
Installer et activer Xdebug PHPStorm