Skip to content

Instantly share code, notes, and snippets.

@webzunft
webzunft / canceled-subscriptions.sql
Last active October 4, 2022 13:15
SQL queries to analyse canceled subscriptions managed with EDD Recurring Payments
# Basic queries to analyse canceled subscriptions using EDD Recurring Payments pre EDD 3.0
# Use EXPLAIN if you have large stores since the "notes" column is not indexed and queries can take some time
# Some of these reports might be worth storing as Views and look at the graphs PHPMyAdmin can also create from them
# List subscription cancelation with creation and cancelation date, as well as the user who canceled
# good as a basis for further queries
SELECT ID,
created,
REGEXP_SUBSTR( REGEXP_SUBSTR( notes, '.* Status changed from active to cancelled .*' ), '^[a-z]+ [0-9]+, [0-9]+' ) AS 'date',
@jchristopher
jchristopher / my.sql
Last active October 24, 2017 00:27
Get EDD Customer email and license key for Customers with ! 'active' Recurring subscriptions
# THIS IS NOT TESTED ENOUGH !!!!!!!!!!!!!!!!!! EXPECT INACCURACIES !!!!!!!!!!!!!!!!!!
# THIS IS CRAZY CRAZY SLOW
# ADJUST THE LIMIT ON LINE 20 ACCORDINGLY (READ: IF YOU DARE)
SELECT *
FROM (
SELECT
SUBSTRING_INDEX(SUBSTRING_INDEX(edd_customers.name, ' ', 1), ' ', -1) as firstname,
edd_customers.email AS email,
pm2.meta_value as license_key
FROM wp_edd_customers AS edd_customers
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active December 8, 2023 11:02
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@chrpinedo
chrpinedo / insert-signature-in-pdf.md
Created April 4, 2016 10:27
How to insert your signature in a PDF file by using PDFtk

How to insert your signature in a PDF file by using PDFtk

Your signature in all the sheets

  1. convert the signature image to PDF file
convert firma.png firma.pdf
@mattyza
mattyza / matty-double-post-type-rewrite-rule-example.php
Last active October 16, 2023 06:49
A WordPress custom rewrite rule example, combining two post types.
<?php
/**
* Plugin Name: Double Post Type Rewrite Rule Example
* Plugin URI: https://gist.github.com/mattyza/7dfd156992f23835f68e
* Description: Adds a custom rewrite rule to mimic http://domain.com/post-type-01/post-type-02/.
* Author: Matty Cohen
* Author URI: http://matty.co.za/
* Version: 1.0.0
* Stable tag: 1.0.0
* License: GPL v3 - http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@sgmurphy
sgmurphy / podcast-ratings.php
Created February 21, 2012 19:31
Scrape ratings from iTunes store
<?php
/**
* Scrape the number of podcast reviews from iTunes for all country specific storefronts.
*
* @author Sean Murphy <sean@iamseanmurphy.com>
*/
$podcast_id = '366931951'; // Startups For the Rest of Us
//$podcast_id = '318567721'; // techzing