Skip to content

Instantly share code, notes, and snippets.

View mpezzi's full-sized avatar

Michael Pezzi mpezzi

View GitHub Profile
<select id="state" name="state">
<option value="">Select One</option>
<optgroup label="Canadian Provinces">
<option value="AB">Alberta</option>
<option value="BC">British Columbia</option>
<option value="MB">Manitoba</option>
<option value="NB">New Brunswick</option>
<option value="NF">Newfoundland</option>
<option value="NT">Northwest Territories</option>
<option value="NS">Nova Scotia</option>
@mpezzi
mpezzi / gist:842295
Created February 24, 2011 15:25
Cross browser CSS columns
aside.left {
float: left;
width: 600px;
margin-left: 0;
margin-right: -600px;
}
aside.right {
float: left;
width: 200px;
@mpezzi
mpezzi / gist:842194
Created February 24, 2011 14:10
Remove .svn folders
find . -name .svn -print0 | xargs -0 rm -rf
@mpezzi
mpezzi / gist:849535
Created March 1, 2011 17:47
Number of files in directory
## Number of files in current working directory
ls -lA | wc -l
## Number of files in current working directory (recursive)
find . -type f | wc -l
@mpezzi
mpezzi / gist:980913
Created May 19, 2011 14:46
Remove trailing whitespace
find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 sed -i '' -E "s/[[:space:]]*$//"
@mpezzi
mpezzi / jquery.query.js
Created August 25, 2011 14:58
jQuery Query Plugin
/**
* jQuery Query Plugin by M. Pezzi
* Version: 1.0 (08/25/11)
* https://gist.github.com/1170858
* 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($){
@mpezzi
mpezzi / jquery.delayedHide.js
Created August 25, 2011 17:12
jQuery Delayed Hide Plugin
/**
* jQuery Delayed Hide Plugin by M. Pezzi
* Version: 1.0 (08/25/11)
* https://gist.github.com/1171181
* 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($){
@mpezzi
mpezzi / gist:1171581
Created August 25, 2011 19:29
PHP Validate Phone Number
<?php
/**
* Validate a phone number.
*
* @param $value
* A phone number as string.
* @param $formats
* The formats to validate for.
* @return
@mpezzi
mpezzi / gist:1244064
Created September 27, 2011 01:40
MySQL Command Line
# Create User
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
# Grant Privileges
GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost' IDENTIFIED BY 'password';
@mpezzi
mpezzi / gist:1249870
Created September 29, 2011 02:43
Ubuntu: Gitolite Installation
# Creating git user
sudo adduser -system -shell /bin/bash -gecos 'git version control' -group -disabled-password -home /var/git git
# Clone Gitolite
git clone git://github.com/sitaramc/gitolite
cd gitolite
src/gl-system-install
# Run setup as git user.
sudo su