Skip to content

Instantly share code, notes, and snippets.

View HoangPV's full-sized avatar

Hoang Phan HoangPV

  • Ho Chi Minh City, Vietnam
View GitHub Profile
@HoangPV
HoangPV / xdebug.ini
Created December 26, 2022 09:31
This setting will enable xdebug for cli
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.use_compression=false
xdebug.client_port=9002
xdebug.show_local_vars=1
xdebug.discover_client_host=true
<style>#html-body [data-pb-style=C8PG98K]{justify-content:center;display:flex;flex-direction:column;background-position:center center;background-size:cover;background-repeat:no-repeat;background-attachment:scroll;border-style:none;border-width:1px;border-radius:0;margin:0;padding:0}#html-body [data-pb-style=KN3WQ28]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=YBA15C5]{background-color:transparent}#html-body [data-pb-style=VPAQ1CW]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=R6L3U04]{background-color:transparent}#html-body [data-pb-style=C64VV8P]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=NULGWPY]{background-color:transparent}#html-body [data-pb-style=HRBNL8W]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=DFYRHRV]{background-color:transparent}#html-body [data-pb-style=I4M
@HoangPV
HoangPV / test.html
Last active June 21, 2022 02:16
style
<style>#html-body [data-pb-style=GA07O8L]{justify-content:center;display:flex;flex-direction:column;background-position:center center;background-size:cover;background-repeat:no-repeat;background-attachment:scroll;border-style:none;border-width:1px;border-radius:0;margin:0;padding:0}#html-body [data-pb-style=Y2B806E]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=Q4XNPF9]{background-color:transparent}#html-body [data-pb-style=JLNU1IU]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=V4NWTIG]{background-color:transparent}#html-body [data-pb-style=KGMB7EC]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=LCOLAPC]{background-color:transparent}#html-body [data-pb-style=N4PITBE]{background-position:left top;background-size:cover;background-repeat:no-repeat}#html-body [data-pb-style=H0MLAGD]{background-color:transparent}#html-body [data-pb-style=IU7
@HoangPV
HoangPV / install-composer
Last active June 17, 2022 02:08
install composer 1.x
#!/bin/bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.10.26
php -r "unlink('composer-setup.php');"
@HoangPV
HoangPV / gist:e5e176903059825a331eb371c7901f41
Created August 22, 2021 17:15 — forked from fabriceleal/gist:6163707
Xdebug stuff (debugging) on php.ini
;; if you're using zend server, you may need to
;; 1 - remove/disable etc/conf.d/debugger.ini
;; 2 - comment zend.ini_scandir=... altogether
;;
;; I've had success with both :|
;; on zend server, install xdebug via pecl
;; or if you feel brave, checkout the source
;; and build it yourself (check the README,
;; watch out for the necessary configurations before make)
@HoangPV
HoangPV / xdebug-mac.md
Created August 22, 2021 17:12 — forked from ankurk91/xdebug-mac.md
php xDebug v3 on Ubuntu/Mac and phpStorm

🪲 Install and Configure xDebug v3 on MacOS for PhpStorm 🐘

  • Assuming that you have already installed php and apache via Homebrew

  • Install xDebug php extension

pecl channel-update pecl.php.net
pecl clear-cache

pecl install xdebug
@HoangPV
HoangPV / gist:560075ae6254c2348f98f798ea76c1cb
Created July 14, 2021 15:32 — forked from thachpham92/gist:d57b18cf02e3550acdb5
Tất cả các tham số trong WP_Query
// Source: https://gist.github.com/luetkemj/2023628
// Xem hướng dẫn WP_Query toàn tập: http://goo.gl/kRpzTz
<?php
$args = array(
//////Author Parameters - Tham số lấy bài viết theo tác giả
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20)
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả
@HoangPV
HoangPV / install-docker.md
Created July 8, 2021 03:48 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@HoangPV
HoangPV / Ciphers.php
Created November 7, 2017 03:57 — forked from hinchley/Ciphers.php
Caesar Cipher and Vigenère Cipher in PHP
<?php
class Map {
/* $table = [
* 'encrypt' =>
* ['A' => 'A', 'B' => 'B', ...],
* ['A' => 'B', 'B' => 'C', ...],
* ...
* 'decrypt' =>
* ['A' => 'A', 'B' => 'B', ...],
<?php
/*
* @see https://www.codewars.com/kata/gap-in-primes/train/php
*/
function gap( $g, $m, $n )
{
$prime = FALSE;