Skip to content

Instantly share code, notes, and snippets.

View hungthai1401's full-sized avatar
:octocat:
Available For Hire

Thai Nguyen Hung hungthai1401

:octocat:
Available For Hire
View GitHub Profile
@hungthai1401
hungthai1401 / installing-node-with-nvm.md
Created October 11, 2018 02:02 — forked from d2s/installing-node-with-nvm.md
Installing Node.js for Linux & macOS with nvm
@hungthai1401
hungthai1401 / phpstorm-cs-fixer.md
Created January 10, 2019 04:43 — forked from nienkedekker/phpstorm-cs-fixer.md
Set up PHP-CS-Fixer in PHPStorm

Use PHP-CS-Fixer in PHPStorm

  • Install PHP-CS-Fixer on your local machine according to these instructions: https://github.com/FriendsOfPHP/PHP-CS-Fixer
  • Open PHPStorm, Preferences > Tools > External Tools and enter these values: img
  • Program, edit to match your path where PHP-CS-Fixer lives: /.composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
  • Parameters: --rules=@PSR2 --verbose fix $FileDir$/$FileName$. Note that previous verions of PHP-CS-Fixer used --levels instead of --rules.
  • Working directory: $ProjectFileDir$

Click OK and Apply. Now we'll set up a shortcut.

  • Go to Preferences > Keymap and search for "PHP Fixer" (or whatever name you gave it). Add whatever shortcut you like, I'm using ctrl + cmd + ]:
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
@hungthai1401
hungthai1401 / simplehttp.service
Created August 23, 2019 09:09 — forked from funzoneq/simplehttp.service
A systemd file for a python SimpleHTTPServer
[Unit]
Description=Job that runs the python SimpleHTTPServer daemon
Documentation=man:SimpleHTTPServer(1)
[Service]
Type=simple
WorkingDirectory=/tmp/letsencrypt
ExecStart=/usr/bin/python -m SimpleHTTPServer 80 &
ExecStop=/bin/kill `/bin/ps aux | /bin/grep SimpleHTTPServer | /bin/grep -v grep | /usr/bin/awk '{ print $2 }'`
@hungthai1401
hungthai1401 / README.md
Created November 8, 2019 01:33 — forked from denji/README.md
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
<?php
use Illuminate\Database\Query\Builder;
Builder::macro('orderByNulls', function ($column, $direction = 'asc', $nulls = 'last', $bindings = []) {
$column = $this->getGrammar()->wrap($column);
$direction = strtolower($direction) === 'asc' ? 'asc' : 'desc';
$nulls = strtolower($nulls) === 'first' ? 'NULLS FIRST' : 'NULLS LAST';
return $this->orderByRaw("$column $direction $nulls", $bindings);
});
@hungthai1401
hungthai1401 / multiple_ssh_setting.md
Created July 2, 2020 09:35 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@hungthai1401
hungthai1401 / Kernel.php
Created September 9, 2020 06:24 — forked from ivanvermeyen/Kernel.php
Find any running "queue:listen" processes for a Laravel project and kill those. Fire "php artisan queue:stop" in your "current" project root. Intended to use with a deploy script when you are using non-daemon listeners and deploy releases. If you are using daemons, run "queue:restart" instead. You can use a process monitoring tool like Superviso…
<?php
namespace App\Console;
use App\Console\Commands\StopQueueListeners;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
@hungthai1401
hungthai1401 / component-app.js
Created April 5, 2021 09:36 — forked from kesor/component-app.js
Vue.js 3.x with ES6 modules in the browser using import-map
import { defineAsyncComponent } from 'vue'
const Content = defineAsyncComponent(() => import('./component-content.js'))
export default {
name: 'App',
components: { Content },
template: /*html*/`
<Content />
`