Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ben Davies bendavies

🏠
Working from home
View GitHub Profile
View continuous-integration.yml
jobs:
strategy:
fail-fast: false
matrix:
chunk_count: [5]
chunk_number: [1, 2, 3, 4, 5]
env:
CHUNK_COUNT: ${{matrix.chunk_count}}
CHUNK_NUMBER: ${{matrix.chunk_number}}
View tests.sh
#!/bin/bash
set -eu
mkdir -p build/logs/phpunit build/coverage
split_tests=$(find tests -name '*Test.php')
export PARALLEL='-j10% --joblog build/logs/parallel.log --rpl {_}\ s/\\//_/g;'
phpunit_cmd='TEST_TOKEN={%} vendor/bin/phpunit --coverage-php build/coverage/coverage-{_}.cov --log-junit build/logs/phpunit/{_}.xml --colors=always {}'
echo "$split_tests" | parallel "$phpunit_cmd"
View A.php
<?php
namespace App;
class A
{
public function __construct(B $b)
{
}
}
@bendavies
bendavies / update.sh
Created Nov 20, 2019
update phpstan baseline
View update.sh
#!/usr/bin/env bash
set -eu
function os_is_darwin {
[[ $(uname -s) == "Darwin" ]]
}
function file_replace_text {
local -r original_text_regex="$1"
View monolog.yaml
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped
excluded_404s:
# regex: exclude all 404 errors from the logs
- ^/
grouped:
View gyp.log
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/srv/app/node_modules/contextify/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
View SymfonyCustomNormalizerBenchmark.php
<?php
namespace Ivory\Tests\Serializer\Benchmark;
use Ivory\Tests\Serializer\Benchmark\Model\Category;
use Ivory\Tests\Serializer\Benchmark\Model\Comment;
use Ivory\Tests\Serializer\Benchmark\Model\Forum;
use Ivory\Tests\Serializer\Benchmark\Model\Thread;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
View Division.php
<?php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Uuid;
View CachedResourceClassResolver.php
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
View is_array.php
<?php
namespace Foo;
$a = [];
$start = microtime(true);
for ($i = 0; $i <= 1000000000; $i++) {
is_array($a);
}
You can’t perform that action at this time.