name: "..."
recipe: lamp
config:
php: "8.1"
xdebug: false
services:
appserver:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Remove all watchdog's records from a MySQL table except for the last 500. | |
| DELETE FROM `watchdog` | |
| WHERE wid NOT IN ( | |
| SELECT wid | |
| FROM ( | |
| SELECT wid | |
| FROM `watchdog` | |
| ORDER BY wid DESC | |
| LIMIT 500 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Drupal\Core\Database\Database; | |
| use Drupal\Core\Database\Query\SelectInterface; | |
| /** | |
| * Returns a plain SQL query from a Select query object. | |
| */ | |
| function get_plain_sql_query(SelectInterface $query): string | |
| { |
SetEnv APP_ENV prod SetEnv DATABASE_URL 'mysql://user:[email protected]:3306/dbname'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| /* | |
| A pattern with multiple conditions: | |
| - at least one digit. | |
| - at least one lowercase letter (including special Scandinavian characters). | |
| - at least one uppercase letter (including special Scandinavian characters). | |
| - at least one character that is not a letter or a number (including special Scandinavian characters). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Drupal\your_module\Controller; | |
| use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; | |
| class YourController { | |
| public function yourPage() { | |
| // Some logic here... |
To retrieve a timezone for Ukraine in PHP 8+
php -r "var_export(DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'UA'));"Possible output:
array (
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Unsubscribe successful</title> | |
| </head> | |
| <body> | |
| <h1>Unsubscribe successful</h1> | |
| <p>Your email has been successfully unsubscribed from this list.</p> | |
| </body> | |
| </html> |
Archive a folder without redundant files using the command line on macOS.
cd <folder_path>where <folder_path> — a folder which should be archived.
zip -r .zip . -x "*.git*" -x "*.DS_Store"