Skip to content

Instantly share code, notes, and snippets.

@mboomaars
mboomaars / gist:2020631
Created March 12, 2012 07:57
PHP: Unzip zip files
function unzip_file( $file, $destination )
{
// create object
$zip = new ZipArchive() ;
// open archive
if ( $zip->open( $file ) !== TRUE ) {
die ( "Could not open archive" );
}
// extract contents to destination directory
$zip->extractTo( $destination );
@mboomaars
mboomaars / gist:2006621
Created March 9, 2012 14:00
CSS: Rounded corners for tables
table {
*border-collapse: collapse; /* IE7 and lower */
border-spacing: 0;
border-radius: 5px;
}
@mboomaars
mboomaars / gist:2006556
Created March 9, 2012 13:46
CSS: Gradient background for whole body
html {
height: 100%;
}
body {
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
}
@mboomaars
mboomaars / gist:2006226
Created March 9, 2012 11:50 — forked from padolsey/gist:527683
JS: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@mboomaars
mboomaars / gist:2006144
Created March 9, 2012 11:25
JS: Submit form with AJAX
// Use like $(“myElement”).submitWithAjax() to add unobtrusive submission via Ajax to your forms.
jQuery.fn.submitWithAjax = function() {
this.submit(function() {
$.post(this.action, $(this).serialize(), null, "script");
return false;
});
return this;
};
@mboomaars
mboomaars / gist:2006138
Created March 9, 2012 11:24
HTML: Starting template
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>