Skip to content

Instantly share code, notes, and snippets.

View Haehnchen's full-sized avatar

Daniel Espendiller Haehnchen

View GitHub Profile
@gquemener
gquemener / Command.php
Last active July 29, 2020 17:51
Self validating command (using symfony validator)
<?php
abstract class Command
{
// Self-validating command
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addConstraint(
new Callback(function(Command $command, ExecutionContextInterface $context) {
$reflClass = new \ReflectionClass($command);
@Ocramius
Ocramius / psalm-compendium.php
Last active November 9, 2023 07:27
A small compendium of what is possible with `vimeo/psalm` 3.9.x to add some decent type system features to PHP
<?php
// -- types are a compile-time propagated concept
// https://psalm.dev/r/338f74a96c
class TheType
{
/** @var string */
public $foo = 'bar';
}
<?php
declare(strict_types=1);
namespace Test\Feature;
use Shared\Domain\DomainEvent;
use Shared\Domain\EventSourcedAggregateRoot;
use Webmozart\Assert\Assert;
use function array_shift;
@QuantBits
QuantBits / script.js
Created February 8, 2019 17:55
BitMex USD Converter - For TemperMonkey
// ==UserScript==
// @name BitMex USD Converter
// @namespace https://bitmex.com/
// @version 0.11
// @description Get some sanity into your gambling.
// @author koinkraft
// @grant none
// @include https://bitmex.com/*
// @include https://www.bitmex.com/*
// @require https://code.jquery.com/jquery-2.1.4.min.js
@bcremer
bcremer / php-class-name-constant-case sensitivity-and-psr-11.md
Last active July 13, 2017 12:40
PHP class name constant (::class) is case insensitive and that might break your PSR-11 container access

PHP´s magic ::class-constant will not canonical the casing of your imports.

This can lead to hard to debug errors when you a using a case sensitive service PSR-11-locator like Zend\ServiceManager.

namespace FirstNamespace;

class TestClass {}
@weaverryan
weaverryan / FooController.php
Last active April 18, 2017 13:58
Autowiring controller args
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Psr\Log\LoggerInterface;
/**
* This class is now a service, so you can use normal __construct DI if you want!
*/
package de.espend.idea.php.annotation.reference;
import com.intellij.openapi.util.TextRange;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.ProcessingContext;
import com.jetbrains.php.PhpIndex;
import com.jetbrains.php.lang.documentation.phpdoc.lexer.PhpDocTokenTypes;
git rebase -i HEAD~2 (squash) letzten 2 Commits
git rebase -i master alle Commits die im aktuellen Branch mehr enthalten sind als im master
git rebase --continue (nach gelösten Konflikten weiter machen)
git rebase --abort (rebase abrechen)
git push --force-with-lease http://movingfast.io/articles/git-force-pushing/
git pull --rebase origin develop (rebasing)
git branch -d bugfix/fix (lokalen branch löschen)
@msurguy
msurguy / List.md
Last active April 30, 2024 15:14
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@emiller
emiller / git-mv-with-history
Last active April 17, 2024 21:06
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.