Skip to content

Instantly share code, notes, and snippets.

View adeel-raza's full-sized avatar

Adeel adeel-raza

View GitHub Profile
@NateWr
NateWr / edd-retro-license-emails.php
Created July 23, 2014 21:36
Send an email with the license key to customers when retroactively generating licenses with Easy Digital Download's Software Licensing.
<?php
/**
* Plugin Name: Retroactive License Emails for EDD Software Licensing
* Plugin URI: http://themeofthecrop.com
* Description: Send an email with the license key to customers when retroactively generating licenses with Easy Digital Download's Software Licensing.
* Version: 0.0.1
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@codelion7
codelion7 / mycred-hook-learndash
Created November 24, 2014 13:10
myCRED Custom Hook: LearnDash
/**
* Register Custom myCRED Hook
* @since 1.0
* @version 1.0
*/
add_filter( 'mycred_setup_hooks', 'Learndash_myCRED_Hook' );
function Learndash_myCRED_Hook( $installed ) {
$installed['hook_learndash'] = array(
'title' => __( 'LearnDash', 'mycred' ),
@rahilwazir
rahilwazir / repeater_field.md
Last active September 14, 2017 10:32
Repeater Field in WordPress

Repeater Field in WordPress

PHP

Inject the following script to your PHP file

function my_enqueue_scripts() {
    wp_enqueue_script( 'phq', '/your/path/to/script.js', [ 'jquery', 'underscore', 'wp-util' ], '1.0', true );
}
@onecooltaco
onecooltaco / my.cnf
Created April 15, 2016 22:33 — forked from fevangelou/my.cnf
Optimized MySQL configuration
# Optimized MySQL configuration by Fotis Evangelou - Updated Jan 2016
#
# The settings provided below are a starting point for a 4GB-8GB RAM server with 4 CPU cores.
# If you have less or more resources available you MUST adjust accordingly to save CPU, RAM and disk I/O usage.
# To fine tune these settings for your system, use MySQL DB diagnostics tools like:
# https://launchpad.net/mysql-tuning-primer
# or
# http://blog.mysqltuner.com/download/
# Note that if there is no comment beside a setting, then you don't need to adjust it.
@rahilwazir
rahilwazir / access_parent_private_member.php
Last active March 21, 2018 06:24
Access parent class private member from child class
<?php
/**
* Access parent class private member from child class
* @param $class $this|object
* @param $property string
* @param $cache bool
* @return mixed
*/
$cacheStorage = [];
<?php
# RegEx For Eval Removal: \s+(eval\(base64.*?\))\);
exit;
function back_to_for_slash($str) {
return str_replace('\\', '/', $str);
}
$current_dir = back_to_for_slash(dirname(__FILE__) . '/public_html');
$directory = $current_dir;
@rahilwazir
rahilwazir / uploads-remote-nginx-apache.md
Last active October 31, 2018 13:18
Map uploads dir to remote server

Nginx

Put this within server { ... } block of your vhost

location ~ "^(.*)/wp-content/uploads/(.*)$" {
    if (!-e $request_filename) {
        return 302 http://yourlivesite.com$request_uri;
    }
}
@strangerstudios
strangerstudios / pmpro_add_billing_fields_to_profile.php
Last active October 22, 2020 18:30
Add PMPro billing fields to the edit user profile page. You must Paid Memberships Pro and the Register Helper plugin installed. Then add this to a custom plugin or your active theme's functions.php
/*
Add PMPro billing fields to the edit user profile page.
You must Paid Memberships Pro and the Register Helper plugin installed:
http://wordpress.org/extend/plugins/paid-memberships-pro
https://github.com/strangerstudios/pmpro-register-helper
*/
function add_billing_fields_to_profile()
{
global $pmpro_countries;
@sabarasaba
sabarasaba / gist:1387550
Created November 23, 2011 00:36
Setting a timeout for the file_get_contents function
<?php
// Create the stream context
$context = stream_context_create(array(
'http' => array(
'timeout' => 3 // Timeout in seconds
)
));
// Fetch the URL's contents
@shyim
shyim / ShyimCron.php
Created October 4, 2016 12:09
Simple Cron in Shopware 5.2 Pluginsystem
<?php
namespace ShyimCron;
use Shopware\Components\Plugin;
use Shopware\Components\Plugin\Context\InstallContext;
use Shopware\Components\Plugin\Context\UninstallContext;
class ShyimCron extends Plugin {
public static function getSubscribedEvents()