Skip to content

Instantly share code, notes, and snippets.

View barryvdh's full-sized avatar

Barry vd. Heuvel barryvdh

View GitHub Profile
diff --git a/vendor/magento/module-email/Model/Template/Filter.php b/vendor/magento/module-email/Model/Template/Filter.php
index 1a7c3683820a..586cb485ee1f 100644
--- a/vendor/magento/module-email/Model/Template/Filter.php
+++ b/vendor/magento/module-email/Model/Template/Filter.php
@@ -618,6 +618,12 @@ public function transDirective($construction)
}
$text = __($text, $params)->render();
+
+ $pattern = '/{{.*?}}/';
@barryvdh
barryvdh / gist:86181d2975f72bd1f1c861757d42071e
Created November 28, 2021 17:48
ElasticSearch7 on Forge Recipe
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html
echo ">> Import the Elasticsearch PGP Key"
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo ">> Installing from the APT Repository"
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
apt-get update && apt-get -y install elasticsearch
echo ">> Configure Elasticsearch to startup"
@barryvdh
barryvdh / HttpClientEventsMiddleware.php
Created September 7, 2021 12:52
Middleware to log Guzzle requests with Telescope
<?php
namespace App\Http\Client;
use GuzzleHttp\Promise;
use Illuminate\Http\Client\Events\ConnectionFailed;
use Illuminate\Http\Client\Events\RequestSending;
use Illuminate\Http\Client\Events\ResponseReceived;
use Illuminate\Http\Client\Request;
use Illuminate\Http\Client\Response;
<?php
namespace App\Services;
use Carbon\Carbon;
use Closure;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Promise;
use Illuminate\Http\Client\Events\ConnectionFailed;
@barryvdh
barryvdh / install_docker
Created May 18, 2021 14:06
Install Docker on Laravel Force Recipe
echo ">> Follow install based on https://docs.docker.com/engine/install/ubuntu/"
echo ">> Update the apt package index and install packages to allow apt to use a repository over HTTPS:"
apt-get update
apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
@barryvdh
barryvdh / bitbucket-pipelines.yml
Last active December 4, 2023 22:42
Bitbucket Pipeline config for Laravel Vapor, make sure to `composer require laravel/vapor-cli` and set the VAPOR_API_TOKEN environment var.
image: smartapps/bitbucket-pipelines-debian-10
pipelines:
branches:
master:
- step:
name: Deploy Test
deployment: test
script:
- composer install --no-interaction --no-progress --prefer-dist
@barryvdh
barryvdh / PRODSECBUG-2198-2.2-CE-2019-03-25-08-43-16-framework.patch
Last active April 1, 2019 08:17 — forked from peterjaap/PRODSECBUG-2198-2.2-CE-2019-03-25-08-43-16-framework.patch
Magento 2.2 patch for PRODSECBUG-2198 in composer.patches.json format for magento/framework, using `cweagans/composer-patches`
diff --git a/DB/Adapter/Pdo/Mysql.php b/DB/Adapter/Pdo/Mysql.php
index 1449d6d..38085a3 100644
--- a/DB/Adapter/Pdo/Mysql.php
+++ b/DB/Adapter/Pdo/Mysql.php
@@ -2904,7 +2904,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
if (isset($condition['to'])) {
$query .= empty($query) ? '' : ' AND ';
$to = $this->_prepareSqlDateCondition($condition, 'to');
- $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
+ $query = $query . $this->_prepareQuotedSqlCondition($conditionKeyMap['to'], $to, $fieldName);
@barryvdh
barryvdh / composer.json
Created January 31, 2019 16:08
Code Style
"require-dev": {
"barryvdh/laravel-debugbar": "^3",
"barryvdh/laravel-ide-helper": "^2.4",
"filp/whoops": "~2.0",
"mockery/mockery": "^1.0",
"nikic/php-parser": "^4.0",
"nunomaduro/collision": "^1.0",
"phpro/grumphp": "^0.14.2",
"phpunit/phpunit": "~7.0",
"sensiolabs/security-checker": "^5.0",
@barryvdh
barryvdh / Httpd.conf
Created November 26, 2018 13:45
Httpd.conf Customization for Apache (DirectAdmin Custom HTTPD Configurations)
# Rewrite the WS requests
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:6001/$1 [P,L]
# Rewrite the HTTP requests
ProxyPass /socket.io http://localhost:6001/socket.io
ProxyPassReverse /socket.io http://localhost:6001/socket.io
# For API requests
<?php
namespace App\Libraries\Queue;
use Illuminate\Events\Dispatcher;
use Illuminate\Queue\DatabaseQueue;
use Illuminate\Support\Str;
use Laravel\Horizon\Events\JobDeleted;
use Laravel\Horizon\Events\JobPushed;
use Laravel\Horizon\Events\JobReleased;