Setup pre-commit hook in php projects for lint, code standard, test cases etc.
- php >= 5.6
- composer
- git
| <?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 |
| <?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 |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
| <title>Stripe Sample Form</title> | |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
| <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script> | |
| <script type="text/javascript" src="https://js.stripe.com/v1/"></script> | |
| <script type="text/javascript"> |
| import React from 'react' | |
| import ReactDOM from 'react-dom' | |
| import { Modal } from 'antd' | |
| const useModal = (Component, props) => { | |
| const [open, setOpen] = React.useState(false) | |
| const [loading, setLoading] = React.useState(false) | |
| const onOk = props.onOk || (() => {}) | |
| const handleOk = () => { |
| #!/bin/bash | |
| # | |
| # Backup a Postgresql database into a daily file. | |
| # | |
| BACKUP_DIR=/pg_backup | |
| DAYS_TO_KEEP=14 | |
| FILE_SUFFIX=_pg_backup.sql | |
| DATABASE= | |
| USER=postgres |
| #!/bin/bash | |
| # | |
| # PostgreSQL Backup Script Ver 1.0 | |
| # http://autopgsqlbackup.frozenpc.net | |
| # Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
| # | |
| # This script is based of the AutoMySQLBackup Script Ver 2.2 | |
| # It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
| # | |
| # The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |