Skip to content

Instantly share code, notes, and snippets.

View ciaranmg's full-sized avatar

Ciaran McGrath ciaranmg

  • Waterford, Ireland
  • 06:24 (UTC +01:00)
View GitHub Profile
@ciaranmg
ciaranmg / functions.php
Last active September 28, 2015 20:01
Fixing Wordpress Change Password Email
<?php
add_action('send_password_change_email', 'no_email_update');
function no_email_update(){
return false;
}
@ciaranmg
ciaranmg / test.php
Created June 2, 2014 21:03
Bypassing the default content filter on the Authentication Plugin
<?php
// Grab the plugin global
global $agora_mw_auth_plugin;
// Remove the filter
remove_filter( 'the_content', array($agora_mw_auth_plugin, 'content_filter') );
// Display the content, now without the filter running.
the_content();
@ciaranmg
ciaranmg / .bash_profile
Created May 8, 2014 16:58
Bash Profile with coloured Prompt
# Enable programmable completion features.
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
# Set the PS1 prompt (with colors).
# Based on http://www-128.ibm.com/developerworks/linux/library/l-tip-prompt/
# And http://networking.ringofsaturn.com/Unix/Bash-prompts.php .
#PS1='\n[\u@\h \! \w]\n\[\e[32m\]$ \[\e[0m\]'
@ciaranmg
ciaranmg / .htaccess
Created May 5, 2014 17:45
Apache .htaccess Staging server Password Protection
#-- Staging Server Password -------------------------#
SetEnvIf Host yourstagingserver.com passreq
AuthType Basic
AuthName "Staging Server"
AuthUserFile /home/username/.htpasswd
Require valid-user
Order allow,deny
Allow from all
Deny from env=passreq
Satisfy any
@ciaranmg
ciaranmg / pubsvs.zsh-theme
Created April 2, 2014 18:15
Oh My ZSH Theme
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='%{$fg_bold[white]%}%M %{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@ciaranmg
ciaranmg / check_content_access.php
Last active August 29, 2015 13:57
Check content access
<?php
/*
* You could work this into your template to check if a user has access to a page/post before showing a link to it.
* Or you could wrap this in a function and hook into a wordpress filter like the_title, or the_excerpt
*
*
* First check that the class exists
* This should allow your site to fail gracefully if the plugin is removed
*/
if(class_exists('agora_auth_container')){
@ciaranmg
ciaranmg / new_gist_file.php
Created January 8, 2014 18:46
HTTP Request Method
function httpRequest($req,$hash_config=NULL){
$config = Obj2xml::getConfig($hash_config);
$ch = curl_init();
if($config['proxy'] !== ''){
curl_setopt($ch, CURLOPT_PROXY, $config['proxy']);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
}
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
curl_setopt($ch, CURLOPT_URL, $config['url']);
@ciaranmg
ciaranmg / b64.js
Created November 4, 2013 16:49
Base64 Function for JS
/*
Copyright Vassilis Petroulias [DRDigit]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};