Skip to content

Instantly share code, notes, and snippets.

View dinhtungdu's full-sized avatar
🏠
On leave

Tung Du dinhtungdu

🏠
On leave
View GitHub Profile
<?php
namespace Automattic\WooCommerce\Blocks\BlockTypes;
use WP_Query;
use WC_Tax;
/**
* ProductCollection class.
*/
<?php
/**
* Return a query for product visibility depending on their stock status.
*
* @param array $stock_query Stock status query.
*
* @return array Tax query for product visibility.
*/
private function get_product_visibility_query( $stock_query, $stock_status ) {
$product_visibility_terms = wc_get_product_visibility_term_ids();
@dinhtungdu
dinhtungdu / .tmux.conf
Created October 25, 2020 05:12
My tmux config
set -g prefix `
bind \ split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
set -g base-index 1
setw -g mode-keys vi
@dinhtungdu
dinhtungdu / blank
Last active April 18, 2018 12:38
Building a Notebook Web app with WordPress and React
|-blank
|—--functions.php
|—--index.php
|—--style.css
@dinhtungdu
dinhtungdu / gist:30f49e38145fd2914496528a4d06e7ea
Last active January 6, 2017 15:32
Lates tmux install on centos
# if installed old version by yum, remove it first
sudo yum remove tmux libevent libevent-devel libevent-headers
# install deps
sudo yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar -xvzf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
@dinhtungdu
dinhtungdu / .Xmodmap
Last active December 7, 2016 05:10
Key remapping for VIM and tmux user on Ubuntu
clear Lock
keycode 66 = Escape NoSymbol Escape # This map Cap Lock key to ESC
keycode 9 = grave asciitilde grave asciitilde # This map ESC on 60% layout to backtick key
<!--
The examples below illustrate different ways to make a reactive and nonreactive join between two collections.
We will retrieve in all of them a list of the 10 most popular posts along with their author profile.
More informations are available on: http://journal.gentlenode.com/
Summary:
1. Nonreactive Join #1: Denormalization.
2. Reactive Join #1: Joining on the client. (by calling a publication)
3. Reactive Join #2: Overpublishing. (and joining with data context)
//framework-customizations/extensions/sidebars
function _filter_fw_ext_sidebars_add_conditional_tag($data) {
$data['is_archive_page_slug'] = array(
'order_option' => 2, // (optional: default is 1) position in the 'Others' lists in backend
'check_priority' => 'last', // (optional: default is last, can be changed to 'first') use it to change priority checking conditional tag
'name' => __('Shop Page', 'fw'), //conditional tag title
'conditional_tag' => array(
'callback' => 'is_post_type_archive', //existing callback
'params' => array('product') //parameters for callback
@dinhtungdu
dinhtungdu / social-share-urls.md
Last active April 18, 2018 04:28
Complete list of share url for social media network using only get parameters

#Create sharing button by just using URL with get parameters, no iframe or javascript require

##For creating Button Use this inline javascript for creating sharing popup windows with ease.

onclick="javascript:window.open(this.href,
  '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"

##Facebook

@dinhtungdu
dinhtungdu / class-widget-online-support.php
Last active February 5, 2019 14:34
Widget with Unyson options
<?php if ( ! defined( 'ABSPATH' ) ) { die( 'Tranquility - the highest manifestation of power!' ); }
class Widget_Online_Support extends WP_Widget {
/**
* Widget constructor.
*/
private $options;
private $prefix;
function __construct() {