This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="Symfony2 Project"> | |
<description>Coding sniffer rules for Symfony2</description> | |
<rule ref="Symfony2"> | |
<exclude name="Symfony2.Commenting.ClassComment"/> | |
<exclude name="Symfony2.Commenting.FunctionComment"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.Indent"/> | |
</rule> | |
</ruleset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach (new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator('.', FilesystemIterator::SKIP_DOTS)), '/\.m3u8$/') as $file) { | |
$name = $file->getBasename(sprintf('.%s', $file->getExtension())); | |
$content = file_get_contents($file->getRealPath()); | |
$newContent = str_replace($name, urlencode($name), $content); | |
file_put_contents($file->getRealPath(), $newContent); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$finder = Symfony\CS\Finder\DefaultFinder::create() | |
->in('src') | |
->in('app/config') | |
->in('app/Resources') | |
; | |
return Symfony\CS\Config\Config::create() | |
->setUsingCache(true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grant CREATE,INSERT,DELETE,UPDATE,SELECT on pauldb.* to paul@localhost identified by 'password' with grant option |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$str = "0123ABCDFWS\",.?<>{}[]*&^%#@!~()+-|:;"; | |
echo "$str"; | |
echo "<br />"; | |
$str = preg_replace('/\xa3([\xa1-\xfe])/e', 'chr(ord(\1)-0x80)', $str); | |
echo $str; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rename local branch | |
git branch -m <old> <new> | |
git branch -m <new> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl http://sample.com/data.json | python -mjson.tool |
NewerOlder