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 / 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 [email protected] 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

Keybase proof

I hereby claim:

  • I am dinhquochan on github.
  • I am dinhquochan (https://keybase.io/dinhquochan) on keybase.
  • I have a public key ASDsk46sZUU38_Q3k0FLgkMMcSsV_lPkWSbFx8L72cDuBAo

To claim this, I am signing this object:

@dinhquochan
dinhquochan / tests.yml
Created April 16, 2020 07:40
Github Actions Config for Laravel Package
name: tests
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
@dinhquochan
dinhquochan / web.php
Created March 29, 2019 04:13
Laravel Default Verify Email Routes
<?php
Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');
@dinhquochan
dinhquochan / handle.php
Created March 2, 2019 04:11
Run `composer install` in Web Browser
<?php
declarce(strict_type=1);
use Composer\Console\Application;
use Composer\Command\UpdateCommand;
use Symfony\Component\Console\Input\ArrayInput;
define('COMPOSER_ROOT', __DIR__);
@dinhquochan
dinhquochan / groupBy.php
Last active December 3, 2018 04:37
GroupBy Laravel Posts by Year and Month
<?php
use App\Post;
$posts = Post::query()
->selectRaw(
'YEAR(`published_at`) as `year`, MONTH(`published_at`) as `month`, MONTHNAME(`published_at`) as `month_name`, COUNT(id) as `posts_count`'
)
->groupBy('year')
->groupBy('month')
@dinhquochan
dinhquochan / .zsh_aliases
Created October 31, 2018 14:55
ZSH Aliases
alias laralog="tail -f -n 450 storage/logs/laravel*.log | grep -i -E \"^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:\" --color"
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias wip="git add . && git commit -m 'wip'"
alias nah='git reset --hard;git clean -df'
alias art='php artisan'
alias a='php artisan'
alias tinker='php artisan tinker'
alias migarte='php artisan migrate'
alias mfs='php artisan migrate:fresh'
@dinhquochan
dinhquochan / sluggify.js
Last active November 8, 2018 04:50
Generate a URL friendly "slug" from a given string
const sluggify = (title) => {
title = title.replace(/^\s+|\s+$/g, "")
title = title.toLowerCase()
let original = title
let from = "àáảãạäăắằẳẵặâầấẩẫậđèéẻẽẹêềếểễệëìíỉĩịïîòóỏõọöôồốổỗộơờớởỡợùúủũụưừứửữựüûyỳýỷỹỵñç·/_,:;"
let to = "aaaaaaaaaaaaaaaaaadeeeeeeeeeeeeiiiiiiioooooooooooooooooouuuuuuuuuuuuuyyyyyync------"