Skip to content

Instantly share code, notes, and snippets.

Geraint Palmer geraintp

Block or report user

Report or block geraintp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View apache_request_headers.php
if( !function_exists('apache_request_headers') ) {
function apache_request_headers() {
$arh = array();
$rx_http = '/\AHTTP_/';
foreach($_SERVER as $key => $val) {
if( preg_match($rx_http, $key) ) {
$arh_key = preg_replace($rx_http, '', $key);
$rx_matches = array();
// do some nasty string manipulations to restore the original letter case
geraintp / EmailAsserts.php
Created Feb 18, 2018
EmailAsserts Laravel Email test trait
View EmailAsserts.php
namespace Tests;
use Swift_Message;
trait EmailAsserts
protected $emails = [];
View gist:52547996a7e174fb8424
SELECT `post_type`,COUNT(*) FROM `wp_posts` GROUP BY `post_type`;
geraintp /
Last active Aug 29, 2015
Shell script to automatically (ish) convert a SVN repo to a a bare GIT repo
# based on with a some tweeks
# (NB: its quick and dirty, has no error checking and only works on repos structured with a stdlayout i.e. a trunk folder)
# use:
# $:./ new-repo-name http://user@server/repo/
View fix_for_woo_launch_pad.php
<?php // only add this line if you need to! i.e. the file is blank.. and doesnt already start with <?php
* print_custom_html_code_head
* @return void
add_action("init", "fix_launch_pad" , 1);
function fix_launch_pad()
global $woodojo_launch_pad;
View gist:7433502
# Prepare the location of the slider's folder to enable movement accross folders
// $path = dirname(__FILE__);
// $path = str_replace('\\', '/', $path);
// $path = str_replace(str_replace('\\', '/', ABSPATH), '', $path);
// $path = trailingslashit(site_url()) . $path;
// $path = trailingslashit($path);
# Fix wrong path code!
$file = str_replace('\\','/', dirname(__FILE__)); // sanitize for Win32 installs
You can’t perform that action at this time.