Skip to content

Instantly share code, notes, and snippets.

View khoipro's full-sized avatar
💭
#devops #wordpress #vuejs #docker

Nguyễn Minh Khôi khoipro

💭
#devops #wordpress #vuejs #docker
View GitHub Profile
@khoipro
khoipro / hanoi-streets.csv
Last active December 23, 2021 07:49
Example data for importing streets
Hà Nội Quận Ba Đình Phường Phúc Xá Đường An Xá
Hà Nội Quận Ba Đình Phường Trúc Bạch Đường Bắc Sơn
Hà Nội Quận Ba Đình Phường Vĩnh Phúc Đường Bưởi
@khoipro
khoipro / import-quan-huyen-vietnam.php
Created December 16, 2021 09:38
WordPress: Import quận huyện Việt Nam vào taxonomy 'location'.
<?php
/**
* Sử dụng để nhập danh sách quận huyện vào Tỉnh/Thành phố.
* Bạn cần tạo đủ danh sách Tỉnh Thành phố rồi mới chạy phần import này.
* Set trong wp-config.php WP_DEBUG = true và WP_DEBUG_LOG = TRUE, rồi mở file wp-content/debug.log để xem kết quả import từng dòng
*/
/**
* Import district
*
<?php
/**
* Register assets
*
* @package Example_Plugin
* @author codetot
* @since 0.0.1
*/
class Example_Assets {
@khoipro
khoipro / query.php
Created August 5, 2021 02:14
Extends WordPress custom post query using wp_parse_args()
<?php
/**
* Get WP_Query object from custom arguments
*/
function codetot_get_post_query($custom_post_args) {
$default_args = array(
'post_type' => 'post',
'posts_per_page' => get_option('posts_per_page')
);
:root {
--black: #000;
--white: #fff;
--dark: #1e1e1e;
--dark-2: #141414;
--dark-3: #444;
--dark-green: #253c57;
--gray: #8f8f8f;
--light: #f8f8f8;
--light-2: #f1f3f5;
@khoipro
khoipro / lazy.html
Created January 11, 2021 07:51
Lazyload
<!-- Facebook Pixel Tracking-->
<script>
setTimeout(function(){
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
@khoipro
khoipro / post-receive.sh
Created January 7, 2021 02:10
.git/hooks/post-receive to auto update when Git has changed to specific branch. Example folder with cPanel user.
#!/bin/bash
set -eu
TARGET="/home/<username>/public_html/"
GIT_DIR="/home/<username>/public_html/.git"
BRANCH="production"
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
@khoipro
khoipro / default-style.css
Created December 27, 2020 16:15
Default style for elements.
h1, h2, h3, h4, h5, h6, .faux-heading {
color: #444;
font-feature-settings: "lnum";
font-variant-numeric: lining-nums;
font-weight: 700;
line-height: 1.2;
margin: 50px 0 25px;
}
h1 { font-size: 2em; }
@khoipro
khoipro / unsubscribe-form.html
Created July 14, 2020 04:01
Example of advanced form editing in Mailchimp. Display a subscribe form with your own style.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Change the width below to just wider than your form's width
to optimize its initial scale on Apple iOS and Android devices -->
<meta name="viewport" content="width=640">
<title>Unsubscribe form - Mailchimp</title>
image: "node:12-alpine"
stages:
- build
- test
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths: