Skip to content

Instantly share code, notes, and snippets.

View quangbahoa's full-sized avatar
🎯
Focusing

Le Duy Quang quangbahoa

🎯
Focusing
View GitHub Profile
@quangbahoa
quangbahoa / flatsome3-custom-post-type-support.php
Created April 1, 2019 07:13 — forked from webseo-onilne/flatsome3-custom-post-type-support.php
Integrate custom post types into Flatsome 3 page builder application using a child theme; providing: (1.) Page Builder Editor support for custom post types, and (2.) Integration with page builder post element components.
<?php
/**
* Integrate custom post types into Flatsome 3 page builder application using a child theme.
*
* This will provide:
*
* 1. Page Builder Editor support for custom post types
* 2. Integration with page builder post element components
**/
<!doctype html>
<html>
<head>
<title>"PHP Encode v1.0 by zeura.com" decoder =))</title>
<meta charset="utf-8">
</head>
<body>
<form method="POST">
<h1>Decode tool for <a href="http://www.phpencode.org">http://www.phpencode.org</a></h1>
<textarea name="code" rows="10" style="width: 100%" placeholder="Paste code here"></textarea><br />
@quangbahoa
quangbahoa / cdn-jquery.php
Last active February 24, 2019 10:42 — forked from Shelob9/cdn-jquery.php
Replace WordPress' jQuery with CDN jQuery of the right version
add_action( 'init', function(){
if ( ! is_admin()) {
if( is_ssl() ){
$protocol = 'https';
}else {
$protocol = 'http';
}
/** @var WP_Scripts $wp_scripts */
global $wp_scripts;
@quangbahoa
quangbahoa / db-connect-test.php
Created January 11, 2019 10:06 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@quangbahoa
quangbahoa / mail-test.php
Created July 25, 2018 02:23 — forked from Dreyer/mail-test.php
Quick & Dirty PHP Mail Test Script
<?php
/*
DONT FORGET TO DELETE THIS SCRIPT WHEN FINISHED!
*/
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = 'webmaster@example.com';
@quangbahoa
quangbahoa / gist:65c8c0a8773aa4788a2acaac46763368
Last active December 8, 2020 06:57 — forked from vicnicius/gist:8685678
Script for optimizing all .jpg images inside a folder, using jpegoptim

Install first

find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;

For PNG apt-get install optipng

find -name '*.png' -print0 | xargs -0 optipng -o7

For JPG

location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* .php$ {
deny all;
}
location ~ ^(index\.php)?$ {
server {
server_name www.cantwo.net;
rewrite ^(.*) http://cantwo.net$1 permanent;
}
server {
listen 80;
access_log off;
# access_log /home/cantwo.net/logs/access_log;
error_log off;
# error_log /home/cantwo.net/logs/error.log;
@quangbahoa
quangbahoa / wordpress.vcl
Last active June 19, 2021 01:32 — forked from matthewjackowski/wordpress.vcl
Varnish 4 VCL configuration for WordPress. Also allows purging
# A heavily customized VCL to support WordPress
# Some items of note:
# Supports https
# Supports admin cookies for wp-admin
# Caches everything
# Support for custom error html page
vcl 4.0;
import directors;
import std;
<!-- Google Code dành cho Thẻ tiếp thị lại -->
<!--------------------------------------------------
Không thể liên kết thẻ tiếp thị lại với thông tin nhận dạng cá nhân hay đặt thẻ tiếp thị lại trên các trang có liên quan đến danh mục nhạy cảm. Xem thêm thông tin và hướng dẫn về cách thiết lập thẻ trên: http://google.com/ads/remarketingsetup
--------------------------------------------------->
<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: '<?php get_the_ID(); ?>',
ecomm_pagetype: 'singleproduct',
ecomm_totalvalue: '<?php echo $product->get_price_html(); ?>',
dynx_itemid: '<?php get_the_ID(); ?>',