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 / nginx-symfony-dev-502.conf
Last active January 1, 2016 16:29
symfony在开发环境nginx报错502可能是因为header太大造成
http {
fastcgi_buffer_size 32k;
fastcgi_buffers 8 16k;
}
@chrisyue
chrisyue / 庐山烟雨.md
Created December 29, 2013 14:28
苏轼(苏东坡) - 庐山烟雨

庐山烟雨浙江潮

未到千般恨不消

到得原来无别事

庐山烟雨浙江潮

@chrisyue
chrisyue / vim-verbose-check-option.md
Created December 29, 2013 18:38
vim查看选项详细设置过程

:verbose se ?

@chrisyue
chrisyue / vim-imap.md
Created January 10, 2014 14:12
vim 察看imap

:verbose imap

@chrisyue
chrisyue / vim-verbose-set.md
Created January 14, 2014 15:41
vim察看某个选项被设置的详情

:verbose set isk?

@chrisyue
chrisyue / file_get_content_post.php
Created January 15, 2014 10:38
使用file_get_content发送POST请求
function tweet($message, $username, $password)
{
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($username.':'.$password)).
"Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query(array('status' => $message)),
'timeout' => 5,
),
@chrisyue
chrisyue / pretty_json.sh
Created February 12, 2014 01:57
在shell下打出好看的json数据
curl http://sample.com/data.json | python -mjson.tool
@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"
@chrisyue
chrisyue / pre-commit
Last active November 17, 2017 09:15
pre-commit for php,使用 php -l / phpmd / php-cs-fixer做检查,需要在项目根目录添加phpmd.xml,.php_cs文件
#!/usr/bin/env php
<?php
// 使用 php -l / phpmd / php-cs-fixer做检查,需要在项目根目录添加phpmd.xml(如果使用phpmd),.php_cs(如果使用phpcs并且有自定义的配置)文件
// 使用前执行 chmod +x path/to/pre-commit
exec('git diff HEAD --name-only --diff-filter=AMRC', $filenames);
$filenames = array_filter($filenames, function($filename) {
return pathinfo($filename, PATHINFO_EXTENSION) === 'php';
@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"/>