Skip to content

Instantly share code, notes, and snippets.

View jimboobrien's full-sized avatar

Jimobrien jimboobrien

View GitHub Profile
@jillmugge
jillmugge / Add Sales Reps to WooCommerce
Last active February 5, 2019 18:11
Add Sales Reps to WooCommerce
//Add to funtctions.php file
//Adding Sales reps to the check out
add_action('woocommerce_after_order_notes', 'jmg_custom_checkout_field');
function jmg_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h2>'.__('Who Is Your EdiPure Sales Rep?').'</h2>';
woocommerce_form_field( 'edipure_reps', array(
'type' => 'select',
@klihelp
klihelp / kli-plugin-isolation.php
Created March 12, 2014 12:48
WordPress Plugin Isolation helper
<?php
/**
* WordPress Plugin Isolation helper
* This helps your plugin/theme to have isolated webpages, keeping only your organized prefixed hooks.
* @package Hashtagg
* @subpackage Base
* @author Klipolis
* @copyright 2014 Klipolis
* @since 0.1.0
* @version 0.1.0
@parzonka
parzonka / install-gradle-centos.sh
Last active July 4, 2024 05:28
Install gradle on redhat/centos linux
# installs to /opt/gradle
# existing versions are not overwritten/deleted
# seamless upgrades/downgrades
# $GRADLE_HOME points to latest *installed* (not released)
gradle_version=2.9
wget -N https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
sudo unzip -foq gradle-${gradle_version}-all.zip -d /opt/gradle
sudo ln -sfn gradle-${gradle_version} /opt/gradle/latest
sudo printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh
. /etc/profile.d/gradle.sh
@alexis-gruet-deel
alexis-gruet-deel / gist:9243496
Created February 27, 2014 02:56
Round Robin Algorithm PHP
/**
for( $a=1; $a<20; $a++ ) {
echo '----------------------' . PHP_EOL;
echo 'PROJECT_ID :: ' . $a . PHP_EOL;
$last = $c[ 'predis' ]->get( 'round-robin-dispatch' );
$i = $j = -1;
$n = count( $array );
@inear
inear / gist:7616849
Last active December 29, 2015 04:39
#!/bin/bash
# uses imagemagick to stich together all images in a folder.
# ex command: ./spriter.sh rivendell-title jpg 640 400
if [ $# -gt 3 ]
then
folder=$1;
name=$1; # output will be placed in a folder named this
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active March 20, 2025 17:17
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@strangerstudios
strangerstudios / gist:5573829
Last active January 10, 2025 12:48
Paid Memberships Pro customization to only let members of a certain level checkout if a discount code was used.
/*
Only let level 1 members sign up if they use a discount code.
Place this code in your active theme's functions.php or a custom plugin.
*/
function my_pmpro_registration_checks_require_code_to_register($pmpro_continue_registration)
{
//only bother if things are okay so far
if(!$pmpro_continue_registration)
return $pmpro_continue_registration;
@woogist
woogist / gist:5541418
Created May 8, 2013 15:54
WooCommerce - Change Placeholder Image
/*
* goes in theme functions.php or a custom plugin. Replace the image filename/path with your own :)
*
**/
add_action( 'init', 'custom_fix_thumbnail' );
function custom_fix_thumbnail() {
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
@Rarst
Rarst / r-debug.php
Last active March 27, 2025 16:58
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/
@daltonrooney
daltonrooney / file-upload-handler.php
Created February 4, 2012 13:29
Multi-file WordPress uploads from the front-end
<?php /* This function attaches the image to the post in the database, add it to functions.php */
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');