Skip to content

Instantly share code, notes, and snippets.

View QuingKhaos's full-sized avatar

Em Karisch QuingKhaos

View GitHub Profile
@frankdejonge
frankdejonge / getter.tpl
Created July 1, 2016 21:46
PHPStorm getter/setter templates.
#set($returnType = ": $TYPE_HINT")
## First we check against a blacklist of primitive and other common types used in documentation.
#set($nonTypeHintableTypes = ["", "mixed", "number", "void", "object", "real", "double", "resource", "null"])
#foreach($nonTypeHintableType in $nonTypeHintableTypes)
#if ($nonTypeHintableType == $TYPE_HINT)
#set($returnType = "")
#end
#end
## Make sure the type hint actually looks like a legal php class name(permitting namespaces too) for future proofing reasons.
## This is important because PSR-5 is coming soon, and will allow documentation of types with syntax like SplStack<int>
@Ocramius
Ocramius / .gitignore
Last active July 22, 2017 15:20
PissOff: a valid, polite and useful alternative to the `void` return type in PHP
vendor
composer.lock
@alexander-schranz
alexander-schranz / AbstractSuluWebsiteController.php
Last active July 26, 2018 15:29
Render twig template with sulu parameters and set a default cache lifetime
<?php
namespace AppBundle\Controller\Website;
use Sulu\Bundle\HttpCacheBundle\Cache\HttpCache;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
abstract class AbstractWebsiteController extends Controller
{
┐┌┐┌┐
┘└┘└┘\ₒ/
┐┌┐┌┐ ∕ Friday
┘└┘└┘ノ)
┐┌┐┌┐ deploy,
┘└┘└┘
┐┌┐┌┐ good
┘└┘└┘
┐┌┐┌┐ luck!
│││││
<?php
namespace Acme\DemoBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class DoctrineEntityListenerPass implements CompilerPassInterface
{
@sthamann
sthamann / OrderMod_Bootstrap.php
Last active March 19, 2021 12:14
Advanced Example how to create 2 custom fields, fill them in order process, display them in backend order list as new columns and make them editable in order detail view
<?php
class Shopware_Plugins_Frontend_OrderMod_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
/**
* (non-PHPdoc)
* @see Shopware_Components_Plugin_Bootstrap::install()
*/
public function install()
{
@Gregoire-M
Gregoire-M / Builder.php
Last active March 30, 2019 20:23 — forked from mrflory/Builder.php
Modified menu template to handle submenus
<?php
namespace Linkofy\CommonBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@tylerhall
tylerhall / strong-passwords.php
Created August 12, 2010 21:38
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@woods
woods / git_svn_bash_prompt.sh
Created December 4, 2008 15:37 — forked from halbtuerke/gist:31934
Set color bash prompt according to git/svn branch, and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE: