Skip to content

Instantly share code, notes, and snippets.

View mattclements's full-sized avatar

Matt Clements mattclements

View GitHub Profile
@mattclements
mattclements / jquery.placeholder.js
Created March 28, 2012 08:53
Placeholder Support for IE6-8
/*
Original From: http://kamikazemusic.com/quick-tips/jquery-html5-placeholder-fix/
Additions by Matt Clements
Licence: http://mattclements.mit-license.org/
Adjusted to look at .change too
Added support for textarea's and pre-set values on fields
*/
$(document).ready(function() {
@mattclements
mattclements / excel-pad.txt
Created April 11, 2012 11:19
Excel Pad with Leading 0's
#Account Number
=REPT(0,8-LEN(A1))&A1
#Sort Code
=REPT(0,6-LEN(A1))&A1
@mattclements
mattclements / .gitignore
Created April 12, 2012 13:28
Git Ignore File for XCode 4.X.X Projects
.DS_Store
*.swp
*~.nib
build/
xcuserdata
@mattclements
mattclements / CLAlert.h
Created April 14, 2012 05:42 — forked from 0xced/CLAlert.h
CLAlert
/*
* CLAlert is a drop-in replacement for NSAlert
*
* A CLAlert is exactly the same as a NSAlert, except for the alert style behavior
*
* - An alert with the informational style (NSInformationalAlertStyle) will always display a "Note icon" (kAlertNoteIcon)
* - An alert with the warning style (NSWarningAlertStyle) will always display a "Caution icon" (kAlertCautionIcon)
* - An alert with the critical style (NSCriticalAlertStyle) will always display a "Stop icon" (kAlertStopIcon)
*
* Tested on Mac OS X 10.5.8 and 10.6.1
<?php
$mailq = "Error";
$output = array();
$result = "";
//Connect to DB1
$dbcon = mysql_connect('remote_ip','username','password');
mysql_select_db('dbname',$dbcon);
exec('mailq',$output);
@mattclements
mattclements / pflogsumm.pl
Created June 9, 2012 20:46
Postfix Log Summary
#!/usr/bin/perl -w
eval 'exec perl -S $0 "$@"'
if 0;
=head1 NAME
pflogsumm.pl - Produce Postfix MTA logfile summary
Copyright (C) 1998-2010 by James S. Seymour, Release 1.1.3.
@mattclements
mattclements / README.md
Created August 5, 2012 11:49 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@mattclements
mattclements / .htaccess
Created August 10, 2012 20:55
Sample HTAccess File
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
ErrorDocument 400 /error_pages/400.php
ErrorDocument 401 /error_pages/401.php
ErrorDocument 403 /error_pages/403.php
ErrorDocument 404 /error_pages/404.php
ErrorDocument 410 /error_pages/410.php
@mattclements
mattclements / encodingnew.php
Created August 23, 2012 08:58
Encoding New
function Unaccent($string)
{
return preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
}
echo Unaccent('ľľščťžýáíŕďňä'); // llsctzyairdna
echo Unaccent('Iñtërnâtiônàlizætiøn'); // Internationalizaetion