Setup pre-commit hook in php projects for lint, code standard, test cases etc.
- php >= 5.6
- composer
- git
| <?php | |
| function createData($path) | |
| { | |
| $arr = []; | |
| $storagePath = array_diff(scandir($path), array('.', '..')); | |
| foreach ($storagePath as $key => $p) { | |
| $current = $path . '/' . $p; | |
| if (is_dir($current)) { |
| git config --global alias.ignore 'update-index --skip-worktree' | |
| git config --global alias.unignore 'update-index --no-skip-worktree' | |
| git config --global alias.ignored '!git ls-files -v | grep "^S"' | |
| exp: | |
| #to ignore local "config.xml" | |
| git ignore config.xml | |
| #to remove ignore local "config.xml" | |
| git unignore config.xml |
| <?php | |
| use PhpCsFixer\Config; | |
| use PhpCsFixer\Finder; | |
| $rules = [ | |
| 'array_syntax' => ['syntax' => 'short'], | |
| 'binary_operator_spaces' => [ | |
| 'default' => 'single_space', | |
| 'operators' => ['=>' => null] |
| git branch | grep -v "master\|develop" | xargs git branch -D |
| /* | |
| Reads a CSV file in chunks of 10 lines at a time | |
| and returns them in an array of objects for processing. | |
| Assumes the first line of the CSV file has headings | |
| that will be used as the object name for the item you are | |
| processing. i.e. the heading is CurrentURL then refer to | |
| $item->CurrentURL |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="ja"> | |
| <head> | |
| <style type="text/css"> | |
| @font-face{ | |
| font-family: ipag; | |
| font-style: normal; | |
| font-weight: normal; | |
| src:url('/home/hp/develop/project/koala-api/storage/fonts/ipag.ttf'); | |
| } |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xml:lang="ja" xmlns="http://www.w3.org/1999/xhtml" lang="ja"> | |
| <head> | |
| <style type="text/css"> | |
| @font-face{ | |
| font-family: ipag; | |
| font-style: normal; | |
| font-weight: normal; | |
| src:url('/home/hp/develop/project/koala-api/storage/fonts/ipag.ttf'); | |
| } |
| #~/.local/share/DBeaverData/workspace6/General/.dbeaver/credentials-config.json | |
| openssl aes-128-cbc -d \ | |
| -K babb4a9f774ab853c96c2d653dfe544a \ | |
| -iv 00000000000000000000000000000000 \ | |
| -in credentials-config.json | \ | |
| dd bs=1 skip=16 2>/dev/null |
| <?php declare(strict_types=1); | |
| namespace App\JWT\Encoding; | |
| use Lcobucci\JWT\ClaimsFormatter; | |
| use Lcobucci\JWT\Token\RegisteredClaims; | |
| class UnixTimestampDateConversion implements ClaimsFormatter | |
| { | |
| public function formatClaims(array $claims): array |