Skip to content

Instantly share code, notes, and snippets.

View vikbert's full-sized avatar

Xun Zhou vikbert

View GitHub Profile
@vikbert
vikbert / doctrine.md
Last active April 13, 2018 09:29
[doctrine] doctrine snippets #doctrine

truncate or reset the tables

// sample code in test cases to reset/truncate all test tables
$connection = static::$entityManager->getConnection();
$platform = $connection->getDatabasePlatform();
foreach (self::getMetadataOfClasses() as $classMetadata) {
  $truncateSql = $platform->getTruncateTableSql($classMetadata->getTableName());
  $connection->executeUpdate($truncateSql);
}
@vikbert
vikbert / fixtures.md
Created April 10, 2018 15:03
[fixtures] nelmio alice bundle #fixtures

common used

created: '<dateTimeBetween("-200 days", "now")>'
updated: '<dateTimeBetween($created, "now")>'
number: '<numberBetween(1, 20)>'
@vikbert
vikbert / phpunit.md
Last active April 13, 2018 10:58
[phpunit] something about phpunit

skip the specific test

add this line to the first line of test

$this->markTestSkipped('must be revisited.');
@vikbert
vikbert / ansible.md
Last active June 21, 2018 09:36
[ansible] the lightweight tutorial of ansible #ansible

Koza ansible commands

tasks

- apt: pkg=vim state=present		# task one-line
@vikbert
vikbert / composer.md
Last active December 11, 2018 14:31
[composer] best practice for using composer #composer

Koza composer

execute on Mac Host machine $ env COMPOSER_MEMORY_LIMIT=-1 composer update --no-scripts

# update feature branch packages
$ composer update vendor/{package name}

# avoid the problem with out of memory in KOZA
$ COMPOSER_MEMORY_LIMIT=-1 composer install vendor/lib
@vikbert
vikbert / programming.md
Last active May 29, 2018 12:50
[zen of programming] #programming, #编程准则

Zend of Python

The Zen of Python by Tim Peters

Beautiful is better than ugly.
要优美,不要粗燥

Explicit is better than implicit.
要直白, 不要含蓄

Simple is better than complex.
@vikbert
vikbert / mac_favorite_apps.md
Last active March 4, 2019 08:24
[macOS Apps] my favorite software on macOS #mac

How to handle the problem with the message, e.g. a cracked applicaiton can not be opened.

"XXX can't be opened. You should move it to trash." is thrown.

sudo spctl --master-disable

docute

简单好用的说明书工具。

@vikbert
vikbert / coding_dojo.MD
Last active July 24, 2018 20:38
[coding_dojo] #dojo, #coding,

composer project with autoloader

  1. prepare the project files structure
mkdir coding_test
cd coding_test
mkdir src tests
touch composer.json
  1. update the composer.json with the following content:
@vikbert
vikbert / ddd.MD
Last active March 11, 2019 10:09
[DDD] DDD #ddd, #symfony

DDD Tutorial in PluralSight

Tutorial: clena Architecture: patterns, practices, and principles

recommended websites:

  • Martin Fowler: martinfowler.com
  • Greg Young goodenoughsoftware.net
  • Udi Dahan: udidahan.com
  • Matthew Renze: matthewrenze.com