Skip to content

Instantly share code, notes, and snippets.

<?php
class SudoObject
{
/**
* @var object
*/
private $instance;
/**
@ScreamingDev
ScreamingDev / sexy-minimal.bash
Created February 26, 2017 10:19
Sexy Minimal Bash Prompt theme for bash-it
# Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Screenshot: http://cloud.gf3.ca/M5rG
# A big thanks to \amethyst on Freenode
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color
elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color
fi
if tput setaf 1 &> /dev/null; then
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
@ScreamingDev
ScreamingDev / WalletRepositoryInterface.php
Created February 11, 2017 17:51
DDD RepositoryInterface to "bypass" collections
<?php
namespace Foo\Domain\Wallet;
use Foo\Domain\RepositoryInterface;
use Foo\Domain\Wallet;
interface WalletRepositoryInterface extends RepositoryInterface
{
@ScreamingDev
ScreamingDev / DeliveryTicketType.php
Created November 10, 2016 06:40
EntityType unit test - no SQL
<?php
namespace Crmp\AccountingBundle\Form;
use Crmp\AccountingBundle\Entity\DeliveryTicket;
use Crmp\AccountingBundle\Entity\Invoice;
use Crmp\AcquisitionBundle\Entity\Contract;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
@ScreamingDev
ScreamingDev / deployer-wordpress-recipe.php
Last active November 16, 2016 07:53
Deployer: WordPress recipe using wp-cli
<?php
// some might like this as 'deploy:clean', most have 'cleanup'
$clean_hook = 'cleanup';
// assume wp cli is in the repo via composer
// change this to the path of your wp executable
set( 'wpcli_command', 'vendor/bin/wp' );
function deployer_wp_cli( $command ) {
@ScreamingDev
ScreamingDev / checkliste.md
Last active July 8, 2016 21:59
Checkliste: Neues Symfony-Project
@ScreamingDev
ScreamingDev / run-apache.sh
Created May 1, 2016 09:52
Docker chown inside container
#!/usr/bin/env bash
adduser --system --uid=$(stat -c "%u" /var/www) "host"
echo "APACHE_RUN_USER=host" >> /etc/apache2/envvars
SERVER_NAME=${SERVER_NAME:=localhost}
echo "ServerName $SERVER_NAME" > /etc/apache2/conf.d/server-name
/etc/init.d/apache2 start
@ScreamingDev
ScreamingDev / auto-loader.php
Created March 15, 2016 17:20
WordPress Autoloader SPL
<?php // Silence is golden.
namespace ScreamingDev {
if ( ! class_exists( '\\ScreamingDev\\Loader', false ) ) {
/**
* Load files of classes via SPL.
*/
class Loader {
@ScreamingDev
ScreamingDev / _.md
Last active March 13, 2016 14:37
WordPress add functions per view

Load additional scripts depending on post-type.

Additional files depending on the current screen will be loaded automatically. Possible screens can be:

  • home
  • search
  • {post-type}
    • {post-type}-archive
  • {post-type}-single
@ScreamingDev
ScreamingDev / command.php
Last active May 23, 2016 17:52
symfony/console - load all commands with their description and help from doc comment
<?php
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
class Application extends \Symfony\Component\Console\Application
{
public function __construct()
{