This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'ep_prepare_meta_data', | |
function ( $meta ) { | |
$meta_groups = [ | |
'group1' => [ | |
'_sku', | |
'_sale_price_dates_from', | |
'_sale_price_dates_to', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Get token from edit profile API & Mobile https://developer.teamwork.com/projects/apikey/key | |
# Get auth string by base64 encoding <token>:<randomstring> | |
# https://www.base64encode.org/ can be used to create such encoded string | |
token=<authstring> | |
authString="Authorization: Basic $token" | |
# Get user id from your profile url (/#/people/<userid>/tasks) | |
userId=<userid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( | |
'ep_weighting_configuration_for_search', | |
function( $weighting_config ) { | |
global $wpdb; | |
$post_meta = get_transient( 'custom_ep_distinct_post_meta' ); | |
| |
if ( ! $post_meta ) { | |
$post_meta = $wpdb->get_col( | |
"SELECT DISTINCT meta_key | |
FROM {$wpdb->postmeta} pm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'ep_prepare_meta_data', function( $meta ) { | |
foreach( $meta as $key => $value ) { | |
if ( preg_match( '/.+_([0-9]+)_.+/', $key ) ) { | |
unset( $meta[$key] ); | |
} | |
} | |
return $meta; | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function run_cron_due_now { | |
for SITE_URL in $(wp --allow-root site list --fields=url --format=csv | tail -n +2 | sort); do | |
wp --allow-root cron event run --due-now --url="$SITE_URL" && echo -e "\t+ Completed Crons for $SITE_URL" & | |
done | |
wait $(jobs -p) | |
echo "Done" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_to_exact( $formatted_args, $args ) { | |
if ( ! empty( $formatted_args['query']['bool']['should'] ) ) { | |
$formatted_args['query']['bool']['must'] = $formatted_args['query']['bool']['should']; | |
$formatted_args['query']['bool']['must'][0]['multi_match']['operator'] = 'AND'; | |
unset( $formatted_args['query']['bool']['should'] ); | |
unset( $formatted_args["query"]["bool"]["must"][0]["multi_match"]["type"] ); | |
} | |
return $formatted_args; | |
} | |
add_filter( 'ep_formatted_args', 'set_to_exact', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( | |
'ep_formatted_args', | |
function( $formatted_args ) { | |
if ( ! empty( $_GET['s'] ) ) { | |
foreach ( [ 'post_title', 'post_excerpt', 'author_name', 'terms.post_tag.name', 'terms.category.name' ] as $field ) { | |
$formatted_args['highlight']['fields'][ $field ] = [ | |
'pre_tags' => [ '<strong style="background:yellow">' ], | |
'post_tags' => [ '</strong>' ], | |
'type' => 'plain', | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'http_api_debug', 'my_http_api_debug', 10, 5 ); | |
function my_http_api_debug( $response, $type, $class, $args, $url ) { | |
error_log( 'requested url: ' . var_export( $url, true ) ); | |
error_log( 'arguments: ' . var_export( $args, true ) ); | |
error_log( 'http response : ' . var_export( $response, true ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
polybar config | |
[module/date] | |
type = custom/script | |
exec = ~/scripts/popup-calendar.sh | |
interval = 5 | |
click-left = ~/scripts/popup-calendar.sh --popup | |
format-background = ${colors.alt-background} | |
format-foreground = ${colors.alt-foreground} | |
label = %output:25% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import array | |
import usb.core | |
import usb.util | |
import os | |
path = "/tmp/backlight-value" | |
# decimal vendor and product values |
NewerOlder