Skip to content

Instantly share code, notes, and snippets.

View joshuafredrickson's full-sized avatar
🍊
Orange pineapple

Joshua Fredrickson joshuafredrickson

🍊
Orange pineapple
View GitHub Profile
@joshuafredrickson
joshuafredrickson / index.html
Last active August 7, 2017 16:49 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<html>
<head>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
@joshuafredrickson
joshuafredrickson / functions.php
Last active August 29, 2015 14:25 — forked from bitfade/gist:4555047
Remove empty p tags for custom shortcodes
// Remove empty p tags for custom shortcodes
add_filter('the_content', 'op_content_filter');
function op_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join('|',array('shortcode1'));
// opening tag
$rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);
// closing tag
@joshuafredrickson
joshuafredrickson / gist:5389226
Last active December 16, 2015 06:09 — forked from alkos333/gist:1771618
jQuery: Get query string variable
// Given a query string "?to=email&why=because&first=John&Last=smith"
// $.getUrlVar("to") will return "email"
(function($){
$.getUrlVar = function(key){
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
return result && unescape(result[1]) || "";
};
})(jQuery);
@joshuafredrickson
joshuafredrickson / gist:4758120
Last active December 12, 2015 10:19 — forked from plavet/gist:2806211
jQuery: function, noConflict
// jQuery.noConflict();
(function($) {
})(jQuery);