Skip to content

Instantly share code, notes, and snippets.

Avatar

Jake Jackson jakejackson1

View GitHub Profile
@polevaultweb
polevaultweb / edd_perpetual_discounts.php
Last active Jun 28, 2022
EDD - Allow discounts to be set to apply to all renewals
View edd_perpetual_discounts.php
<?php
// Add new Discount setting the to discount add and edit forms
add_action( 'edd_add_discount_form_before_use_once', array( $this, 'edd_perpetual_discounts_setting_add_form' ) );
add_action( 'edd_edit_discount_form_before_use_once', array( $this, 'edd_perpetual_discounts_setting_edit_form' ) );
// Handle saving the settings on form submission
add_filter( 'edd_update_discount', 'edd_perpetual_discounts_add_meta' );
add_filter( 'edd_insert_discount', 'edd_perpetual_discounts_add_meta' );
@adamcapriola
adamcapriola / page_discourse-sso.php
Last active Mar 24, 2020
WordPress Page Template for SSO with Discourse
View page_discourse-sso.php
<?php
/**
* Template Name: Discourse SSO
* Author: Adam Capriola
* Version: 1.1
* Author URI: https://meta.discourse.org/users/AdamCapriola/activity
* Adapted From: https://github.com/ArmedGuy/discourse_sso_php
* Uses: https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
*
*/
@spivurno
spivurno / gw-gravity-forms-advanced-merge-tags.php
Last active May 5, 2022
Gravity Wiz // Gravity Forms // Advanced Merge Tags
View gw-gravity-forms-advanced-merge-tags.php
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-advanced-merge-tags.php
*/
/**
* Gravity Wiz // Gravity Forms // Advanced Merge Tags
*
* Adds support for several advanced merge tags:
@andreyvit
andreyvit / fpdi_with_annots.php
Created Mar 12, 2012
FPDI extension to preserve external hyperlinks
View fpdi_with_annots.php
<?php
// FPDI extension that preserves hyperlinks when copying PDF pages.
//
// (c) 2012, Andrey Tarantsov <andrey@tarantsov.com>, provided under the MIT license.
//
// Published at: https://gist.github.com/2020422
//
// Note: the free version of FPDI requires unprotected PDFs conforming to spec version 1.4.
// I use qpdf (http://qpdf.sourceforge.net/) to preprocess PDFs before running through this
@alexkingorg
alexkingorg / hex_color_mod.php
Created Sep 3, 2011
Change the brightness of the passed in hex color in PHP
View hex_color_mod.php
<?php
/**
* Change the brightness of the passed in color
*
* $diff should be negative to go darker, positive to go lighter and
* is subtracted from the decimal (0-255) value of the color
*
* @param string $hex color to be modified
* @param string $diff amount to change the color