Skip to content

Instantly share code, notes, and snippets.

View mitchellhislop's full-sized avatar

Mitchell Hislop mitchellhislop

View GitHub Profile
@mitchellhislop
mitchellhislop / fbbutton.css
Created August 3, 2011 16:16
FB rounded button css
.styled-button-3 {
-webkit-box-shadow: rgba(0, 0, 0, 0.0.97) 0px 1px 0px 0px;
background-color: #00559F;
border: 1px solid #29447E;
font-family: Arial;
font-size: 12px;
font-weight: bold;
padding: 4px 6px;
height: 20px;
@mitchellhislop
mitchellhislop / switchframe.js
Created August 3, 2011 15:57
Switch iFrame code
function switchFrame() {
var currentFrame = $("#iframetograb").attr('src');
var newFrame, buttnTxt, newHeightWrapper, newHeightContent;
if (currentFrame.indexOf("fb") > 0){
newFrame = '';
buttnTxt = 'Click to signup with Facebook';
newHeightWrapper=470;
newHeightContent=430;
}
else{
@mitchellhislop
mitchellhislop / getSearchString.js
Created July 26, 2011 21:59
Sending the Search Referrer of an Action to GA
function getSearchString(){
var ref = top.document.referrer;
if (ref.indexOf('?') == -1) return;
var querys = ref.substr(ref.indexOf('?')+1);
var qsa = querys.split('&');
for (var i=0;i<qsa.length;i++) {
var qsip = qsa[i].split('=');
if (qsip.length == 1) continue;
if (qsip[0] == 'q' || qsip[0] == 'p') { // q= for Google + Bing, p= for Yahoo
var wordstring = unescape(qsip[1].replace(/\+/g,' '));
@mitchellhislop
mitchellhislop / scale.php
Created May 25, 2011 21:49
Mitchell's Scaling Method
function scale($isAtScale)
{
if ($isAtScale == false)
{
$task = $this->buy_bigger_server();
}
return $task;
}
@mitchellhislop
mitchellhislop / gist:975092
Created May 16, 2011 19:09
Getting PHPStorm to autocomplete CodeIgniter 2.0
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Benchmark $benchmark
* @property CI_Calendar $calendar
* @property CI_Cart $cart
* @property CI_Config $config
* @property CI_Controller $controller
* @property CI_Email $email
* @property CI_Encrypt $encrypt
* @property CI_Exceptions $exceptions
@mitchellhislop
mitchellhislop / php.snippets
Created April 7, 2011 04:17 — forked from aaroneaton/php.snippets
snipMate.vim file for codeigniter 2.0
# SnipMate is required to use snippets
# Download SnipMate: http://www.vim.org/scripts/script.php?script_id=2540
# Put this file in ~/.vim/snippets/ then restart vim
# This snippet file includes many useful snippets for CodeIgniter. Please feel free to fork and contribute!
snippet php
<?php
${1}
?>
snippet ec
echo "${1:string}"${2};
/* First, let's get rid of the Help menu, update nag, Personal Options section */
echo "\n" . '<style type="text/css" media="screen">#your-profile { display: none; } .update-nag, #screen-meta, .color-option, .show-admin-bar { display: none !important; }</style>';
echo "\n" . '<script type="text/javascript">jQuery(document).ready(function($) { $(\'form#your-profile > h3:first\').hide(); $(\'form#your-profile > table:first\').hide(); $(\'form#your-profile\').show(); });</script>' . "\n";
add_action('admin_head',
function remove_menus () {
global $menu, $submenu, $user_ID;
$the_user = new WP_User($user_ID);
$valid_page = "admin.php?page=contact-form-7/admin/admin.php";
$restricted = array('index.php','edit.php','categories.php','upload.php','link-manager.php','edit-pages.php','edit-comments.php', 'themes.php', 'plugins.php', 'users.php', 'profile.php', 'tools.php', 'options-general.php');
$restricted_str = 'widgets.php';
end ($menu);
while (prev($menu)){
$menu_item = $menu[key($menu)];
$restricted_str .= '|'.$menu_item[2];
function remove_submenu() {
global $submenu;
//remove Theme editor
unset($submenu['themes.php'][10]);
}
function remove_menu() {
global $menu;
//remove post top level menu
unset($menu[5]);
function remove_admin_menu_items() {
$remove_menu_items = array(__('Posts'),__('Links'), __('Comments'));
global $menu;
end ($menu);
while (prev($menu)){
$item = explode(' ',$menu[key($menu)][0]);
if(in_array($item[0] != NULL?$item[0]:"" , $remove_menu_items)){
unset($menu[key($menu)]);}
}
}