Skip to content

Instantly share code, notes, and snippets.

View mxr576's full-sized avatar

Dezső BICZÓ mxr576

View GitHub Profile
<?php
/**
* @file
* Dumping ground for stubs, until a pattern emerges.
*/
declare(strict_types=1);
namespace Drupal\datetime\Plugin\Field\FieldType {
@ruudk
ruudk / README.md
Created December 8, 2022 15:35
How to find the files that are the slowest to analyze with PHPStan?

How to find the files that are the slowest to analyze with PHPStan?

For us, PHPStan became a bit slower with every release. We have a very large codebase with 10.000+ classes. There seem to be a few known issues related to big arrays.

See: phpstan/phpstan#8353 phpstan/phpstan#8146

To understand which files are problematic we run the following command:

@mglaman
mglaman / drush-loop.php
Created July 7, 2019 02:28
ReactPHP Drupal Tasks
<?php declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
function run_command(string $command): void {
$loop = React\EventLoop\Factory::create();
$process = new React\ChildProcess\Process($command);
$process->start($loop);
$process->on('exit', function ($exitCode) use ($command) {
// Trigger alerts that the command finished.
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@jsor
jsor / ddd_cqrs_event-sourcing_in_php.md
Last active April 23, 2024 19:48
DDD, CQRS and Event Sourcing in PHP

DDD, CQRS and Event Sourcing in PHP

  • Broadway - Infrastructure and testing helpers for creating CQRS and event sourced applications
  • EventCentric.Core - Event Sourcing and CQRS in PHP
  • LiteCQRS - Small convention based CQRS library for PHP
  • predaddy - Common DDD classes including an annotation driven message bus and tools for CQRS and Event Sourcing
  • ProophEventSourcing - Provides basic functionality for event-sourced aggregates
  • ProophEventStore - PHP 5.4+ EventStore Implementation
  • ProophServiceBus - PHP Enterprise Service Bus Implementation supporting CQRS and DDD
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 23, 2024 19:14
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'