Skip to content

Instantly share code, notes, and snippets.

pitch-gist / gist:2962808
Created Jun 20, 2012
Apache: gzip and cache rules
View gist:2962808
# Enable GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Expires Headers - 2678400s = 31 days
<ifmodule mod_expires.c>
pitch-gist / gist:2920380
Created Jun 12, 2012
JavaScript: jQuery Validation Hide Error Labels
View gist:2920380
// form validation
rules: {
// define extra rules
errorPlacement: function(error, element) {
// don't add the error labels
return true;
pitch-gist / gist:2920368
Created Jun 12, 2012
JavaScript: jQuery Animate Anchor Scroll
View gist:2920368
// smooth anchor
// add a class of scroll to any anchor link and this will smoothly scroll to the location.
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
pitch-gist / gist:2920362
Created Jun 12, 2012
JavaScript: jQuery Make Checkbox Labels Clickable iOS
View gist:2920362
// this makes checkbox labels clickable on iOS
$('label.checkbox').click(function() {});
pitch-gist / gist:2920336
Created Jun 12, 2012
JavaScript: Add iOS Class
View gist:2920336
// find out if the device is an ios device and add a class.
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {