Skip to content

Instantly share code, notes, and snippets.

View bendavies's full-sized avatar
🏠
Working from home

Ben Davies bendavies

🏠
Working from home
View GitHub Profile
@bendavies
bendavies / JsonFilter.php
Created October 7, 2020 12:23 — forked from thomas-seres/JsonFilter.deprecated.php
API Platform - JSON Filter
<?php
/**
*
* @author Thomas Sérès <thomas.seres@gmail.com>
*/
namespace App\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractContextAwareFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use ApiPlatform\Core\Exception\InvalidArgumentException;
<?php
declare(strict_types=1);
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class SessionListener
{
public function __construct(
<?php
declare(strict_types=1);
namespace App\Form\Type;
...
#[AsEntityAutocompleteField]
class CarrierAutocompleteField extends AbstractType
@bendavies
bendavies / script.sql
Last active March 3, 2023 12:07
tankerkoenig
create table pricereport (
date timestamp without time zone not null,
fueltype character varying(6) not null,
stationid uuid not null,
price numeric(4,3) not null,
change integer not null
);
create table prices (
.DEFAULT_GOAL := help
.EXPORT_ALL_VARIABLES:
APP_ENV = test
APP_DEBUG = false
.PHONY: it
it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis and tests targets
# https://docs.github.com/en/actions
name: "Dependabot Merge"
on:
workflow_run:
workflows: ["Integrate"]
types:
- completed
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}}
#!/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"
<?php
namespace App;
class A
{
public function __construct(B $b)
{
}
}
@bendavies
bendavies / update.sh
Created November 20, 2019 10:27
update phpstan baseline
#!/usr/bin/env bash
set -eu
function os_is_darwin {
[[ $(uname -s) == "Darwin" ]]
}
function file_replace_text {
local -r original_text_regex="$1"