Skip to content

Instantly share code, notes, and snippets.


demonkoryu demonkoryu

View GitHub Profile
View ImmutableClassGenerator.php
namespace GoetasWebservices\Xsd\XsdToPhp\Php;
use GoetasWebservices\Xsd\XsdToPhp\Php\Structure\PHPClass;
use GoetasWebservices\Xsd\XsdToPhp\Php\Structure\PHPProperty;
use Zend\Code\Generator\ClassGenerator;
use Zend\Code\Generator\DocBlock\Tag\VarTag;
use Zend\Code\Generator\DocBlockGenerator;
use Zend\Code\Generator\MethodGenerator;
wojteklu /
Last active Sep 18, 2020
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

MakeNowJust / npm2git.js
Created Mar 24, 2016
Bye npm, Hello Git repository.
View npm2git.js
'use strict'
* Rewrite package.json to get dependencies from Git repository instead of npm.
* See also:
* and:
* Usage: cd /path/to/your/package && node npm2git
* This script is warning because:
chrisguitarguy / KeepValueListener.php
Created Feb 26, 2016
A way to keep original values around when a Symfony form is submitted with an empty value. Useful for password fields especially
View KeepValueListener.php
* Copyright (c) 2016 PMG <>
* License: MIT
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Form\FormEvents;
staltz /
Last active Sep 19, 2020
The introduction to Reactive Programming you've been missing
callumacrae /
Last active Jan 10, 2020
Build tools written in JavaScript
webmozart / array-validation-error-mapping.php
Last active Jul 28, 2020
A little experiment: Validating (potentially multi-leveled) arrays with the Symfony2 Validator component and returning the errors in the same data structure as the validated array by using the Symfony2 PropertyAccess component.
View array-validation-error-mapping.php
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Optional;
use Symfony\Component\Validator\Constraints\Required;
lastguest / access_property.php
Last active Feb 16, 2019
PHP - Read/Write public/protected/private object property
View access_property.php
// Access a property with no restrictions
function stole($object,$property){
$dict = (array)$object;
$class = get_class($object);
return isset($dict[$property])?
ck-on / ocp.php
Last active Aug 9, 2020
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
View ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
AmyStephen / PSR-0 and
Last active Dec 12, 2015
Documentation of how the environment and how utilizing Composer parameters and the package repository structure, itself, impact the installation path and provide options for how best to implement the PSR-0 for your package.
View PSR-0 and

PSR-0 and Composer

It's helpful to understand how Composer works and how to best utilize the environment as you implement your PSR-0 Namespace. There are factors that you, where you, as a user of the environment, will not be able to change and you should be aware of those points. There are areas where your choices directly impact the folder path and the implementation of your namespace.

##1. Composer Name Parameter##

The first data relevant to the package install path is the name you provide to Composer.

###What is the purpose of the name parameter?###

You can’t perform that action at this time.