Skip to content

Instantly share code, notes, and snippets.

View 0xvbetsun's full-sized avatar
🦀

Vlad 0xvbetsun

🦀
View GitHub Profile
@0xvbetsun
0xvbetsun / pre-commit
Created April 12, 2022 23:22
githook for checking code before commit
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only | grep ".go$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
GOCHECK=$GOPATH/bin/staticcheck
GOSEC=$GOPATH/bin/gosec
@0xvbetsun
0xvbetsun / commit-msg
Last active April 13, 2022 23:06
githook for linting commit message according to conventional commits
#!/bin/sh
COMMIT_MSG=$(cat $1 | head -n1)
# ignore merge branches
if echo "$COMMIT_MSG" | grep -qE "^Merge branch \'"; then
printf "\033[42mCommit hook: ignoring merge branches\033[0m\n"
exit 0
fi
@0xvbetsun
0xvbetsun / MigrateController.php
Created August 14, 2017 04:07
yii2 mongodb custom migrations
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\mongodb\console\controllers;
use Yii;