Skip to content

Instantly share code, notes, and snippets.

@joelhy
joelhy / composer.json
Created May 4, 2020 01:02
PHP composer package fork example
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": [
"framework",
"laravel",
"lumen"
],
"license": "MIT",
"type": "project",
@joelhy
joelhy / phpcs-git-hook-pre-receive.sh
Last active August 17, 2017 11:07 — forked from paunin/pre-recieve.sh
pre-receive Code Sniffer
#!/bin/sh
# PHP CodeSniffer pre-receive hook for git
PHPCS_BIN="/usr/local/bin/phpcs"
PHPCS_CODING_STANDARD="PSR2"
# use coding standard dir from local repo
PHPCS_DIR_LOCAL=0
TMP_DIR=$(mktemp -d --tmpdir phpcs-pre-receive-hook.XXXXXXXX)
mkdir "$TMP_DIR/source"
@joelhy
joelhy / pre-recieve.sh
Created August 5, 2017 11:07 — forked from paunin/pre-recieve.sh
pre-receive Code Sniffer
#!/bin/sh
# PHP CodeSniffer pre-receive hook for git
#exit 0 #if you want to skip all validation
PHPCS_BIN="phpcs"
PHPCS_CODING_STANDARD="PSR2"
TMP_DIR=$(mktemp -d phpcs-pre-receive-hook.XXXXXXXX)
mkdir "$TMP_DIR/source"
@joelhy
joelhy / phpcs-git-hook-pre-receive
Created August 5, 2017 10:17 — forked from bor/phpcs-git-hook-pre-receive
PHP CodeSniffer pre-receive hook for git
#!/bin/sh
# PHP CodeSniffer pre-receive hook for git
PHPCS_BIN="/usr/bin/phpcs"
PHPCS_CODING_STANDARD="PEAR"
# use coding standart dir from local repo
PHPCS_DIR_LOCAL=0
TMP_DIR=$(mktemp -d --tmpdir phpcs-pre-receive-hook.XXXXXXXX)
mkdir "$TMP_DIR/source"
@joelhy
joelhy / README.md
Created July 31, 2017 06:26 — forked from danielpopdan/README.md
Git hook to check coding standards using PHP CodeSniffer before pushing

About

This is a git pre-push hook intended to help developers keep their Drupal code base clean by performing a scan with Drupal Coder whenever new code is pushed to the repository. When any coding standards violations are present the push is rejected, allowing the developer to fix the code before making it public.

To increase performance only the changed files are checked when new code is

@joelhy
joelhy / convertCase.php
Last active July 19, 2017 07:43
Convert snake case methods, properties and variables to camel case
<?php
function snakeToCamel($val) {
preg_match('#^_*#', $val, $underscores);
$underscores = current($underscores);
$camel = str_replace(' ', '', ucwords(str_replace('_', ' ', $val)));
$camel = strtolower(substr($camel, 0, 1)).substr($camel, 1);
return $underscores.$camel;
}
@joelhy
joelhy / git-pre-receive-hook.sh
Created May 31, 2016 08:37 — forked from caniszczyk/git-pre-receive-hook.sh
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
@joelhy
joelhy / commit-msg.py
Created May 12, 2016 04:17 — forked from onjin/commit-msg.py
Git commit hook to check commit message according to angularjs guidelines: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
#!/usr/bin/env python
"""
Git commit hook:
.git/hooks/commit-msg
Check commit message according to angularjs guidelines:
* https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
"""
import sys