Skip to content

Instantly share code, notes, and snippets.

@greg0ire
greg0ire / check-merge-up-state.sh
Last active October 26, 2024 10:08
Allows to get a quick overview of merge up conflicts on a Doctrine repository
#!/bin/bash
set -euo pipefail
function default_branch()
{
printf "%s\n" "$(git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs)"
}
function branch_metadata()
@Ocramius
Ocramius / handling-optional-input-fields-with-type-safe-abstractions.md
Last active January 22, 2025 09:32
Handling optional input parameters in PHP with `vimeo/psalm` and `azjezz/psl`

Handling optional input parameters in PHP with vimeo/psalm and azjezz/psl

I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".

Example: updating a user

We will take a CRUD-ish example, for the sake of simplicity.

For example, in the following scenario, does a null $description mean "remove the description",

@ner00
ner00 / viewimage.user.js
Last active March 20, 2025 17:34 — forked from bijij/viewimage.user.js
Userscript version of the View Image extension
// ==UserScript==
// @name View Image
// @namespace https://github.com/bijij/ViewImage
// @version 3.7.0.16
// @description Re-implements the Google Images' "View Image" and "Search by Image" buttons.
// @author Joshua B
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAFdElEQVRoge2YX2xTVRzHv7ejc8BGmuAYwQXHgxmEIDVqIiEmHULUxIcaffShE2YMgdjBgwRM4HHu5ZpofGDorfpAjA8j0ZjxZxbcwERZWOKTPhjGxv51W9vb293/5/hw1/Z299ze27WgJPs2be89f379/M45v3N+t8C61rWuJ1qcW0X6zIkIR8FTRQ5TVQUIASi1KgvfBa3c02J5qX7r1z+U/cZi7F2K1e2Kt7byognrIvHcCZw+f8TBu4EFr997K2L89U8yPwg2eBl/eR3LCbvI4gKj7yoHVtm42HkaI00HmPYCzEJD4jfs+BMbD00yO7nBVyd/fQY6T2Nk+xHXeuYMEGMpDACNezIAKB4O7ag4vaXRZ5fbtWiS8oKyWbVsb23gfMG7OgBTLkI07skgKAZ6Z29tG2c0dLdssItThHS5tevYtZNvyKTDyEsY2H0KI22V4QGXINZ/bbcNHQU4riv46tRNT2s1KP3RUYHMz8VINuuAL8AMfdzs4GXGgNWl8H70Ssd7LHhRxMBua9kQTSqSAO5h5uLA41M63iOQuVkLvvMURrYfBlGzMOVFxpJ1qoIDj34WrJGfjZGcBT+6Am9IM4kNLTt7/diosIQerYrwooiBzl6Mbj8McwV++NOXuv3aYe9CBRUWnumypaxRdvhLnacw2vYaE97
@SkyyySi
SkyyySi / youtube-vanced-alternatives.md
Last active April 7, 2025 00:27
A list of alternatives after the shutdown of Vanced

NONE OF THESE CLIENTS ARE VERIFIED BY ME FOR SECURITY OR ANYTHING ELSE! USE AT YOUR OWN RISK!

These are the current alternatives (with links when possible):

@faizanakram99
faizanakram99 / MonospaceResponse.php
Created November 18, 2020 12:02
View Monolog in browser with HttpFoundation component
<?php
declare(strict_types=1);
namespace Qbil\CommonBundle\Extension;
use Symfony\Component\HttpFoundation\Response;
use Webmozart\Assert\Assert;
final class MonospaceResponse extends Response
@romaricdrigon
romaricdrigon / docker-compose.override.yaml
Created August 27, 2020 14:36
Using Mutagen Compose
version: '3.7'
volumes:
appdata: ~
code: ~
services:
php:
volumes:
- code:/var/www/html
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}}
@alcaeus
alcaeus / composer.json
Last active May 20, 2020 15:06
Why composer hacks don't help when testing against PHP 8
{
"require": {
"php": "^7.2",
"vendor/extension": "^1 || ^2",
"vendor/restrictive": "^1 || ^2"
}
}
@muglug
muglug / webmozart-assert-stub.php
Created July 31, 2019 14:34
Interim stubs for webmozart/assert
<?php
/*
* This file is part of the webmozart/assert package.
*
* (c) Bernhard Schussek <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active May 28, 2024 02:25
Hardcore Debug Logger
<?php
const STREAM_OPEN_FOR_INCLUDE = 128;
final class HardCoreDebugLogger
{
public static function register(string $output = 'php://stdout')
{
register_tick_function(function () use ($output) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);