Skip to content

Instantly share code, notes, and snippets.

View Mamaduka's full-sized avatar

George Mamadashvili Mamaduka

View GitHub Profile
@Mamaduka
Mamaduka / wc-queue-docs.md
Created October 10, 2018 08:36 — forked from thenbrent/wc-queue-docs.md
WooCommerce 3.5 introduced a new scalable, traceable job queue. This queue can be leveraged by extensions for processing large sets of jobs in the background. The default handler can also be replaced for custom requirements.

Job Queue API

WooCommerce 3.5 introduced a new scalable, traceable job queue. This queue can be used by extensions and custom code to process large sets of jobs in the background, and track the lifecycle of those jobs. The default handler can also be replaced.

This guide explains how to use the queue APIs for adding jobs, and how to replace the default queue handler.

Jobs are Actions

For flexibility and simplicity, each job is defined by an action hook.

<?php
namespace Mamdauka\WpQuerySpeed\Command;
use WP_CLI;
use WP_CLI\Utils;
use WP_CLI_Command;
use WP_Query;
use Symfony\Component\Stopwatch\Stopwatch;
<?php
function mamaduka_register_bp_component( $components, $type ) {
// Only display custom component when viewing 'All' and 'Optional'.
if ( ! in_array( $type, array( 'all', 'optional' ) ) ) {
return $components;
}
$components[] = array(
'bp-select-home' array(
'title' => __( 'Select Home', 'fp-stroke-community' ),

Update WP-CLI in VVV

Props to @pento mentioning this method in comment.

cd /srv/www/wp-cli
git checkout -- .
git pull origin master
composer update
http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/
https://www.elastic.co/blog/stop-stopping-stop-words-a-look-at-common-terms-query
http://gibrown.com/2013/01/24/elasticsearch-five-things-i-was-doing-wrong/
https://www.elastic.co/blog/searching-with-shingles
https://gist.github.com/jenwachter/30fe30d6714781a3d0ed
<?php
/**
* Handle Team shortcode.
*
* @param array $attr Array of shortcode attributes.
* @return string $output HTML
*/
function maintainn_team_shortcode( $attr = array() ) {
// Get post object.
<?php
/**
* Register Team Members metabox as repeatable group fields.
*/
function maintainn_team_members_metabox() {
$prefix = '_maintainn_team_';
$cmb_group = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => __( 'Team Members', 'maintainn-demo' ),
@Mamaduka
Mamaduka / SassMeister-input-HTML.html
Created April 1, 2015 14:12
Generated by SassMeister.com.
<section>
<div class="newspaper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius.
</div>
</section>
<?php
$key = $wpdb->get_blog_prefix( get_current_blog_id() ) . 'capabilities';
// Setup new meta query for user Roles
$meta_query = array(
'relation' => 'OR',
array(
'key' => $key,
'value' => 'administrator',
'compare' => 'LIKE'