Skip to content

Instantly share code, notes, and snippets.

View mpezzi's full-sized avatar

Michael Pezzi mpezzi

View GitHub Profile
@mpezzi
mpezzi / install-aegir-on-ubuntu.sh
Created October 11, 2011 02:23
Install Aegir on Ubuntu 10.04 LTS
#! /bin/bash
#
# Aegir 1.1 install script for Ubuntu 10.4 LTS (Lucid) servers
# (install-aegir-on-ubuntu.sh)
# script on Github: https://raw.github.com/doka/install-aegir-on-ubuntu/lucid/install-aegir-on-ubuntu.sh
#
# run with users with sudo rights
#
# this script assumes:
# - your hostname is: myhost.local (it will be the Aegir admin interface)
@mpezzi
mpezzi / gist:1287269
Created October 14, 2011 14:28
PHP Validate Human Name
function valid_human_name($name) {
return preg_match("/^[A-Z][a-zA-Z '&-]*[A-Za-z]$/", $name);
}
@mpezzi
mpezzi / install-lamp.sh
Created October 24, 2011 19:54
Ubuntu 10.04 / LAMP + Drush + Drupal Sandboxes
#! /bin/bash
# Upgrade and install required packages.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install lamp-server^
sudo apt-get install php5-cli php5-gd php5-curl phpmyadmin
# Configure Apache
sudo sed -ie 's/AllowOverride None/AllowOverride All/g' /etc/apache2/sites-available/default
@mpezzi
mpezzi / .bash_profile
Created November 26, 2011 02:52 — forked from thesven/.bash_profile
Bash Profile OS X
echo "Hello Michael, You are great at turning me on."
### ----------
### PATH SETTINGS
### ----------
PATH=/applications/MacVim/:$PATH
### ----------
### Archive
### ----------
alias tarc="tar -zcf"
@mpezzi
mpezzi / gist:1498447
Created December 19, 2011 19:10
PHP Validate Contains Numbers
<?php
/**
* Validates a string containing numbers.
*
* @param $string
* A string to validate if it contains numbers.
* @return
* TRUE or FALSE if it contains numbers.
*/
@mpezzi
mpezzi / gist:2221593
Created March 27, 2012 23:51
.htaccess 301 redirect
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://example.ca/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://example.ca/$1 [L,R=301]
@mpezzi
mpezzi / gist:2294042
Created April 3, 2012 17:44
Drupal jQuery Update Switch Version
<?php
// jQuery Update Version
if ( arg(0) == 'admin' ) {
$conf['jquery_update_jquery_version'] = '1.5';
}
else {
$conf['jquery_update_jquery_version'] = '1.7';
}
@mpezzi
mpezzi / settings.php
Created May 2, 2012 18:39
Standard Drupal Settings File
<?php
/**
* @file
* Provides settings.
*/
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 100);
ini_set('session.gc_maxlifetime', 200000);
@mpezzi
mpezzi / ec2-ssh-helper
Created May 3, 2012 22:36
Amazon AWS EC2 SSH Helper
#!/bin/bash
AWS_KEY=""
AWS_SECRET=""
if [ $# -ne 1 ]
then
ec2-host --aws-key $AWS_KEY --aws-secret $AWS_SECRET
else
ssh -i ~/.ssh/key.pem ec2-user@$(ec2-host --aws-key $AWS_KEY --aws-secret $AWS_SECRET $1)
@mpezzi
mpezzi / jquery.equal-height.js
Created August 14, 2012 02:28
jQuery Equal Heights
/**
* jQuery Equal Height Plugin by M. Pezzi
* Version: 1.0-alpha (08/13/12)
* Dual licensed under the MIT and GPL licences:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Requires: jQuery v1.4.2 or later
*/
(function($) {