| <?php | |
| use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; | |
| use Rector\Config\RectorConfig; | |
| return static function (RectorConfig $rectorConfig): void { | |
| $rectorConfig->rule(CompleteDynamicPropertiesRector::class); | |
| // Define directories to check | |
| $directories = [ |
| <?php | |
| // Run with the URL pointing to a require-config.js as the first argument; | |
| // php identify.php http://magento2demo.firebearstudio.com/pub/static/frontend/Magento/luma/en_US/requirejs-config.js | |
| $content = file_get_contents($argv[1]); | |
| preg_match_all( | |
| '/(?P<quote>\'|")(?P<extension>[[:alnum:]]+_[[:alnum:]]+)\/js\/.+?(?P=quote)/m', | |
| $content, | |
| $matches |
| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
Following example demonstrates how to:
- display a private file download prompt to the user (here for a PDF file)
- serve a private image or PDF which will be displayed on a webpage
See https://symfony.com/doc/4.4/components/http_foundation.html#serving-files
Host these files in a directory outside of /public, so they can be accessed only through the controller and its @Security() authorization. For example you could create a /private-uploads directory at the root of your project.
| <?php | |
| /** | |
| * @author Raj KB <[email protected]> | |
| * @website https://www.magepsycho.com | |
| * | |
| */ | |
| $mageFilename = 'app/Mage.php'; | |
| require_once $mageFilename; | |
| Mage::setIsDeveloperMode(true); | |
| ini_set('display_errors', 1); |
Law of Demeter or principle of least knowledge is a design guideline, that is using to make code more simple and stable.
- Each unit should have only limited knowledge about other units: only units "closely" related to the current unit.
- Each unit should only talk to his friends; don't talk to strangers.
- Only talk to your immediate friends.
| #!/usr/bin/env bash | |
| VERSION="0.0.2" | |
| SCRIPT_URL='https://gist.github.com/cubedtear/54434fc66439fc4e04e28bd658189701/raw' | |
| SCRIPT_DESCRIPTION="" | |
| SCRIPT_LOCATION="${BASH_SOURCE[@]}" | |
| rm -f updater.sh | |
| function update() | |
| { |
Making multiple MySQL versions work with Homebrew was tricky to say the least. Fortunately there are 2 new easy ways that I learned of to achieve this.
As @4unkur and @henrytirla commented below, there is this extremely easy to use app called DBngin, which lets you setup multiple databases (not only MySQL) simultaneously using different ports:
| <?php | |
| namespace App\Controller; | |
| use App\Entity\Demo; | |
| use App\Service\PaginationService; | |
| use Symfony\Component\HttpFoundation\Request; | |
| class DemoController extends AdminController | |
| { |