Skip to content

Instantly share code, notes, and snippets.

@joshbode
joshbode / logging.py
Last active January 15, 2024 13:39
Colour Logging - Works in Jupyter Lab/Notebook
import sys
import logging
from typing import Optional, Dict
from colorama import Fore, Back, Style
class ColoredFormatter(logging.Formatter):
"""Colored log formatter."""
@ewallz
ewallz / points_shortcode
Created July 26, 2017 07:31
Shortcode fix for WC Points & Rewards
function woocommerce_points_rewards_my_points($atts, $content = null) { // **SHORTCODE** add string ($atts, $content=null)
global $wc_points_rewards;
$points_balance = WC_Points_Rewards_Manager::get_users_points( get_current_user_id() );
$points_label = $wc_points_rewards->get_points_label( $points_balance );
$count = apply_filters( 'wc_points_rewards_my_account_points_events', 5, get_current_user_id() );
// get a set of points events, ordered newest to oldest
$args = array(