Skip to content

Instantly share code, notes, and snippets.

View dinhquochan's full-sized avatar
😇
Hello Friend!

Dinh Quoc Han dinhquochan

😇
Hello Friend!
View GitHub Profile
@dinhquochan
dinhquochan / install.sh
Created July 24, 2023 15:39
Install PHP 8.2, Composer, MySQL 8 for Laravel Development on Ubuntu 22.04
## PHP
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.2-cli php8.2-dev php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl php8.2-imap php8.2-mysql php8.2-mbstring php8.2-xml php8.2-zip \
php8.2-bcmath php8.2-soap php8.2-intl php8.2-readline php8.2-ldap php8.2-msgpack \
php8.2-igbinary php8.2-redis php8.2-memcache php8.2-pcov php8.2-xdebug

Git Commit Message Convention

This is adapted from Angular's commit convention.

TL;DR:

Messages must be matched by the following regex:

/^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\(.+\))?: .{1,50}/
@dinhquochan
dinhquochan / deploy.sh
Created June 21, 2022 04:20
Laravel Deploy Script (without assets build)
#!/usr/bin/env bash
# default branch name of git repository
$BRANCH="main"
set -e
# ensure current directory is root of repository.
if [ ! -f artisan ]
then
@dinhquochan
dinhquochan / keybindings.json
Created December 7, 2021 04:13
VSCode Key Bindings
[
/**
* Panels
**/
{
"key": "cmd+k cmd+e",
"command": "workbench.view.explorer"
},
{
"key": "cmd+k cmd+g",
@dinhquochan
dinhquochan / .php-cs-fixer.php
Last active November 12, 2023 10:44
PHP CS Fixer (PSR-12) - Laravel Compatible
<?php
$finder = PhpCsFixer\Finder::create()
->notPath('storage/*')
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
;
@dinhquochan
dinhquochan / AbstractController.php
Created August 31, 2021 07:43
Abstract Controller for Laravel (version 8.x)
<?php
namespace App\Http\Controllers;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\JsonResponse;
use Illuminate\Routing\Controller as BaseController;
@dinhquochan
dinhquochan / Nord.icls
Created August 20, 2021 04:02
Custom Nord Color Scheme for Jetbrains IDEs
<scheme name="Nord" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2021-08-20T10:56:55</property>
<property name="ide">PhpStorm</property>
<property name="ideVersion">2021.2.0.0</property>
<property name="modified">2021-08-20T10:56:59</property>
<property name="originalScheme">_@user_Nord</property>
</metaInfo>
<colors>
<option name="ANNOTATIONS_COLOR" value="d8dee9" />
@dinhquochan
dinhquochan / settings.json
Last active December 7, 2021 04:16
VSCode Settings
{
/**
* Better Defaults
**/
"editor.copyWithSyntaxHighlighting": false,
"editor.cursorSmoothCaretAnimation": true,
"diffEditor.ignoreTrimWhitespace": false,
"editor.emptySelectionClipboard": false,
"workbench.editor.enablePreview": false,
"window.newWindowDimensions": "inherit",
@dinhquochan
dinhquochan / php-version.sh
Created June 7, 2021 16:33
PHP Versions Switcher
function phpv() {
valet stop
brew unlink php@7.4 php
brew link --force --overwrite $1
brew services start $1
composer global update
rm -f ~/.config/valet/valet.sock
valet install
}
@dinhquochan
dinhquochan / xdebug.ini
Created May 20, 2021 10:19
Xdebug in Version 3.x
[xdebug]
zend_extension=
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_port=9003
xdebug.client_host=127.0.0.1
xdebug.discover_client_host=true
xdebug.idekey=PHPSTORM