Skip to content

Instantly share code, notes, and snippets.

@barryvdh
barryvdh / pre-commit
Last active May 16, 2023 12:37
phpunit pre-commit git hook
#!/usr/bin/env php
<?php
echo "Running tests.. ";
exec('vendor/bin/phpunit', $output, $returnCode);
if ($returnCode !== 0) {
// Show full output
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL;
echo "Aborting commit.." . PHP_EOL;
@barryvdh
barryvdh / PushAll.php
Created September 27, 2016 08:14
PushAll example
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Collection;
trait PushAll {
@barryvdh
barryvdh / bench.php
Last active February 2, 2016 08:05 — forked from nikic/bench.php
Benchmark of call_user_func_array vs switch optimization vs argument unpacking syntax
<?php error_reporting(E_ALL);
function test() {}
$nIter = 1000000;
$argNums = [0, 1, 2, 3, 4, 5, 100];
$func = 'test';
foreach ($argNums as $argNum) {
Verifying that +barryvdh is my blockchain ID. https://onename.com/barryvdh
See https://github.com/fruitcakestudio/magerun-modman/blob/master/src/Fruitcake/Magerun/Modman/GenerateCommand.php
@barryvdh
barryvdh / lumen_ide_helper.php
Last active April 10, 2023 10:26
Lumen IDE Helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel Lumen (5.1.1) (Laravel Components 5.1.*) on 2015-08-18.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@barryvdh
barryvdh / PATCH_SUPEE-389_EE_1.12.0.2_v2.sh
Last active August 29, 2015 14:26 — forked from piotrekkaminski/PATCH_SUPEE-389_EE_1.12.0.2_v2.sh
SUPEE-389: Every time the catalog URL is rendexed, a new custom rewrite is created
#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.
# 1. Check required system tools
_check_installed_tools() {
local missed=""
@barryvdh
barryvdh / laravel-docs-scraper.php
Created June 9, 2015 19:20
Laravel docs scraper
<?php
// composer require fabpot/goutte
Route::get('docs', function(){
$host = 'http://laravel.com';
$base = '/docs/5.1/';
$client = new Goutte\Client();
$crawler = $client->request('GET', $host.$base);

Keybase proof

I hereby claim:

  • I am barryvdh on github.
  • I am barryvdh (https://keybase.io/barryvdh) on keybase.
  • I have a public key whose fingerprint is AB59 569C F4B9 989D B442 34B3 A67C 9D6F 2EC7 8E42

To claim this, I am signing this object:

@barryvdh
barryvdh / .phpstorm.meta.php
Last active October 20, 2021 22:16
Laravel PhpStorm Meta file
<?php
namespace PHPSTORM_META {
/**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/