Skip to content

Instantly share code, notes, and snippets.

View Mamaduka's full-sized avatar

George Mamadashvili Mamaduka

View GitHub Profile
@Mamaduka
Mamaduka / functions.php
Last active December 20, 2015 22:28 — forked from remkus/functions.php
<?php
**/
* How to detect is a certain page template is in use.
*
* @link http://www.wupperpiraten.de/2009/12/is-a-certain-page-template-active/
*/
function is_pagetemplate_active( $pagetemplate = '' ) {
global $wpdb;
if ( empty( $pagetemplate ) )
@Mamaduka
Mamaduka / 0_reuse_code.js
Created July 15, 2014 12:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
/**
* Plugin Name: WooCommerce Email Customer Address
* Plugin URI: https://gist.github.com/BFTrick/7891074
* Description: Email the site admin when a customer changes their address
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 1.1
*
* This program is free software: you can redistribute it and/or modify
# shortform git commands
alias g='git'
# add a tag
git tag -a 1.2 -m "Version 1.2 Stable"
# push tags
git push --tags
# download all files from a gist without git
@Mamaduka
Mamaduka / setup.sh
Last active August 29, 2015 14:07 — forked from bradp/setup.sh
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
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
@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.

@Mamaduka
Mamaduka / gist:29f9b717ba4755e3774ff276d990de73
Created August 2, 2020 13:15 — forked from mannieschumpert/gist:8886289
Code Examples from Andrew Nacin's "Current User Can Watch This Talk"
<?php
// If you can edit pages, you can edit widgets
add_filter( 'user_has_cap',
function( $caps ) {
if ( ! empty( $caps['edit_pages'] ) )
$caps['edit_theme_options'] = true;
return $caps;
} );