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 / inc.language.php
Created March 29, 2010 20:39
PHP Simple Translation Engine
<?php
define('LANG_ENGLISH', 'en');
define('LANG_FRENCH', 'fr');
define('LANG_SPANISH', 'es');
// Look for l in query string and set as language.
$language = isset($_GET['l']) ? $_GET['l'] : LANG_ENGLISH;
/**
@mpezzi
mpezzi / gist:842194
Created February 24, 2011 14:10
Remove .svn folders
find . -name .svn -print0 | xargs -0 rm -rf
@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:849284
Created March 1, 2011 15:22
PHP Array of Countries
<?php
$countries = array(
'AF' => 'Afghanistan',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
@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