View gist:99fd87f1eeac7e35ddec3ed069c298df
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
///////////////////// | |
// slack2html | |
// by @levelsio | |
///////////////////// | |
// | |
///////////////////// | |
// WHAT DOES THIS DO? | |
///////////////////// | |
// |
View jotform.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe id="JotFormIFrame-71245263674155" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="https://form.jotform.us/71245263674155" frameborder="0" style="width:100%; height:0px; border:none;" scrolling="no"> </iframe> <script type="text/javascript"> var ifr = document.getElementById("JotFormIFrame-71245263674155"); if(window.location.href && window.location.href.indexOf("?") > -1) { var get = window.location.href.substr(window.location.href.indexOf("?") + 1); if(ifr && get.length > 0) { var src = ifr.src; src = src.indexOf("?") > -1 ? src + "&" + get : src + "?" + get; ifr.src = src; } } window.handleIFrameMessage = function(e) { var args = e.data.split(":"); if (args.length > 2) { iframe = document.getElementById("JotFormIFrame-" + args[2]); } else { iframe = document.getElementById("JotFormIFrame"); } if (!iframe) return; switch (args[0]) { case "scrollIntoView": iframe.scrollIntoView(); break; case "setHeight": iframe.style.height = args[1] + "px"; break; case "collapseErrorPage": if (ifr |
View gzip.htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# GZIP COMPRESSION # | |
#################### | |
SetOutputFilter DEFLATE | |
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html | |
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip |
View caching.htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### CACHING STUFF ##### | |
# 1 YEAR | |
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> | |
Header set Cache-Control "max-age=31536000, public" | |
</FilesMatch> | |
# 1 WEEK | |
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> |
View verify-google-recaptcha-with-php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Verify captcha | |
$post_data = http_build_query( | |
array( | |
'secret' => CAPTCHA_SECRET, | |
'response' => $_POST['g-recaptcha-response'], | |
'remoteip' => $_SERVER['REMOTE_ADDR'] | |
) | |
); | |
$opts = array('http' => |
View gist:22ee69e86b0f9177fd2f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* I didn't write this snippet but I can't remeber where I found it. PLMK if you know who the original author is :) */ | |
(function($) { | |
$.fn.uncomment = function(recurse) { | |
$(this).contents().each(function() { | |
if (this.hasChildNodes()) { | |
$(this).uncomment(recurse); | |
} else if (this.nodeType == 8) { | |
// Need to "evaluate" the HTML content, | |
// otherwise simple text won't replace |
View mamp_function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mamp() { | |
# | |
# Default location of the apache conf file for MAMP | |
CONF_FILE="/Applications/MAMP/conf/apache/httpd.conf" | |
# | |
# Fish existing doc root out of conf file | |
LINE=$(cat $CONF_FILE | grep ^DocumentRoot) | |
QUOTED_STRING=${LINE/DocumentRoot /} | |
OLD_DOC_ROOT=${QUOTED_STRING//\"/} | |
# |
View gist:8034686
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modulo bugfix for negative numbers | |
Number.prototype.mod = function(n) { | |
return ((this%n)+n)%n; | |
} |
View gist:7557847
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Failover to PNG if browser can’t hack SVG | |
if(!Modernizr.svg) { | |
$('img').each(function(){ | |
this.src = this.src.replace('svg', 'png'); | |
}); | |
} |
View gist:7557840
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lazy load "below the fold" images | |
$(window).on('load', function(){ | |
$('img').each(function(){ | |
if(this.src.match('1x1.png')) { | |
this.src = $(this).attr('data-src'); | |
} | |
}); | |
}); |
NewerOlder