Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Crosstable for TCEC
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author gitlost
// @match https://fierce-cliffs-15335.herokuapp.com/livedemo
// @grant none
// ==/UserScript==
@gitlost
gitlost / zlib_inflate_filter_bytes_consumed_bug.php
Created September 28, 2017 09:04
php_zlib_inflate_filter() returning 0 bytes_consumed in certain circumstances.
<?php
function non_repeating_str( $len = 8192 ) {
$ret = '';
mt_srand( 1 );
$iterations = (int) ( $len / 256 ) + 1;
for ( $i = 0; $i < $iterations; $i++ ) {
$haves = array();
$cnt = 0;
while ( $cnt < 256 ) {
#!/bin/bash
set -v
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar -nc -q && mv wp-cli-nightly.phar wp-nightly.phar && chmod +x wp-nightly.phar
php -dphar.readonly=0 utils/make-phar.php wp-suggest.phar --version=1.4.0-suggest_help --quiet >/dev/null && chmod +x wp-suggest.phar
# ----------------------------------------------------------------------
# Help typo in subcommand of early processed command with WP install
# BEFORE: nothing happens.
@gitlost
gitlost / tcp_send_order_email_subject
Created June 15, 2013 15:44
TheCartPress example override of action "tcp_send_order_email_subject"
function mytheme_tcp_send_order_email_subject( $subject, $order_id ) {
$blogname = html_entity_decode( get_bloginfo( "name" ), ENT_QUOTES | ENT_HTML401 );
$details = OrdersDetails::getDetails( $order_id );
$skus = array();
foreach ( $details as $detail ) {
$categories = array();
if ( $detail->post_id && ( $terms = get_the_terms( $detail->post_id, TCP_PRODUCT_CATEGORY ) ) ) {
foreach ( $terms as $term ) $categories[] = $term->name;
}
$skus[] = $detail->sku . ( $categories ? ( " (" . implode( ",", $categories ) . ")" ) : "" );