Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
...

demonkoryu demonkoryu

🤔
...
View GitHub Profile
View ImmutableClassGenerator.php
<?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
wojteklu / clean_code.md
Last active Sep 18, 2020
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

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
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: https://medium.com/@azerbike/i-ve-just-liberated-my-modules-9045c06be67c
* and: http://blog.npmjs.org/post/141577284765/kik-left-pad-and-npm
*
* Usage: cd /path/to/your/package && node npm2git
*
* This script is warning because:
@chrisguitarguy
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
<?php
/**
* Copyright (c) 2016 PMG <https://www.pmg.com>
*
* License: MIT
*/
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Form\FormEvents;
@staltz
staltz / introrx.md
Last active Sep 19, 2020
The introduction to Reactive Programming you've been missing
View introrx.md
@callumacrae
callumacrae / build-tools.md
Last active Jan 10, 2020
Build tools written in JavaScript
View build-tools.md
@webmozart
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
<?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
lastguest / access_property.php
Last active Feb 16, 2019
PHP - Read/Write public/protected/private object property
View access_property.php
<?php
// Access a property with no restrictions
function stole($object,$property){
$dict = (array)$object;
$class = get_class($object);
return isset($dict[$property])?
$dict[$property]:(isset($dict["\0*\0$property"])?
$dict["\0*\0$property"]:(isset($dict["\0$class\0$property"])?
$dict["\0$class\0$property"]:null));
@ck-on
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
<?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
AmyStephen / PSR-0 and Composer.md
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 Composer.md

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.