Skip to content

Instantly share code, notes, and snippets.

Barry vd. Heuvel barryvdh

Block or report user

Report or block barryvdh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@barryvdh
barryvdh / bitbucket-pipelines.yml
Last active Nov 15, 2019
Bitbucket Pipeline config for Laravel Vapor, make sure to `composer require laravel/vapor-cli` and set the VAPOR_API_TOKEN environment var.
View bitbucket-pipelines.yml
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 Magento 2.2 patch for PRODSECBUG-2198 in composer.patches.json format for magento/framework, using `cweagans/composer-patches`
View PRODSECBUG-2198-2.2-CE-2019-03-25-08-43-16-framework.patch
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);
View composer.json
"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 Nov 26, 2018
Httpd.conf Customization for Apache (DirectAdmin Custom HTTPD Configurations)
View Httpd.conf
# 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
View HorizonDatabaseQueue.php
<?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;
@barryvdh
barryvdh / deploy.php
Last active Sep 7, 2018 — forked from jakebathman/logslaravel.sh
Tail Laravel logs and filter out the stack traces using https://deployer.org/
View deploy.php
desc('Tail your laravel.log file');
task('tail', function () {
$numLines = isVerbose() ? '100' : '1000';
$tail = "tail -n {$numLines} {{deploy_path}}/current/storage/logs/laravel*.log ";
if (!isVerbose()) {
// Change -P to -E, depending on OS or grep version.
$tail .= '| grep -i -P "^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" | tail -n 100 ';
}
$output = run($tail);
@barryvdh
barryvdh / imageoptim.sh
Created Jul 17, 2018
Optimize images in last 24 hours
View imageoptim.sh
#!/bin/bash
find ./media -mmin -1440 -type f -iname '*.gif' -exec sh -c 'gifsicle -b -O3 "{}"' \;
find ./media -mmin -1440 -type f -iname '*.png' -exec optipng -o7 -strip all -preserve '{}' \;
find ./media -mmin -1440 -type f -iname '*.jpg' -exec jpegoptim --strip-all -m85 -o -p {} \;
View forge.nginx.conf
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/default/before/*;
upstream fastcgi_backend {
server unix:/var/run/php/php7.1-fpm.sock;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
@barryvdh
barryvdh / ForceHttps.php
Created Aug 22, 2017
Force HTTPS Middleware
View ForceHttps.php
<?php
namespace App\Http\Middleware;
use Closure;
class ForceHttps
{
/**
* Force non-local requests to be HTTPS
View ControllerInspector.php
<?php
namespace App\Libraries;
use ReflectionClass;
use ReflectionMethod;
use Illuminate\Support\Str;
/**
* @deprecated since version 5.2.
You can’t perform that action at this time.