Skip to content

Instantly share code, notes, and snippets.

View chrisyue's full-sized avatar
:octocat:
=。=

chris yue chrisyue

:octocat:
=。=
View GitHub Profile
@chrisyue
chrisyue / pretty_json.sh
Created February 12, 2014 01:57
在shell下打出好看的json数据
curl http://sample.com/data.json | python -mjson.tool
@chrisyue
chrisyue / phpmd.xml
Created March 8, 2014 09:47
phpmd ruleset overview
<?xml version="1.0"?>
<ruleset name="xxx"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>xxx</description>
<!-- @see http://phpmd.org/rules/codesize.html#cyclomaticcomplexity -->
<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
@chrisyue
chrisyue / composer.json
Last active August 29, 2015 13:57
global composer.json php常用工具
{
"require": {
"composer/composer": "dev-master",
"phpmd/phpmd": "dev-master",
"fabpot/php-cs-fixer": "dev-master",
"phpunit/phpunit": "3.7.*",
"sebastian/phpcpd": "*",
"phpdocumentor/phpdocumentor": "2.*",
"sami/sami": "1.*",
"squizlabs/php_codesniffer": "dev-master"
// rename local branch
git branch -m <old> <new>
git branch -m <new>
$str = "0123ABCDFWS\",.?<>{}[]*&^%#@!~()+-|:;";
echo "$str";
echo "<br />";
$str = preg_replace('/\xa3([\xa1-\xfe])/e', 'chr(ord(\1)-0x80)', $str);
echo $str;
grant CREATE,INSERT,DELETE,UPDATE,SELECT on pauldb.* to paul@localhost identified by 'password' with grant option
@chrisyue
chrisyue / .php_cs.php
Last active August 29, 2015 14:05
php-cs-fixer config for Symfony2 project
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->in('src')
->in('app/config')
->in('app/Resources')
;
return Symfony\CS\Config\Config::create()
->setUsingCache(true)
@chrisyue
chrisyue / han.md
Last active December 28, 2015 02:19
匹配UTF-8中文正则,php测试可用
/\p{Han}+/u

非汉字

/\P{Han}+/u

server {
server_name ~^(?<project>.*)\.localhost$;
root /var/www/repos/$project/web;
index app_dev.php;
location ~ \.php($|/) {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}

composer

http_proxy=http://127.0.0.1:8087 composer update

apt-get

http_proxy=http://127.0.0.1:8087 apt-get update