Skip to content

Instantly share code, notes, and snippets.

John Hartley johnbhartley

Block or report user

Report or block johnbhartley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@johnbhartley
johnbhartley / video-container.css
Created Jul 2, 2012
Web Designer Wall's Elastic Video CSS
View video-container.css
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
@johnbhartley
johnbhartley / WordPress CSS
Created Jun 14, 2012
WordPress - necessary CSS
View WordPress CSS
/* =WordPress Core
-------------------------------------------------------------- */
.alignnone {
margin: 5px 20px 20px 0;
}
.aligncenter, div.aligncenter {
display:block;
margin: 5px auto 5px auto;
}
@johnbhartley
johnbhartley / kellum-method.css
Created Apr 19, 2012
Kellum Method Image Replacement
View kellum-method.css
.hide-text {
height: ;
width: ;
display: block;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@johnbhartley
johnbhartley / st3-fnr-xhtml
Last active Sep 22, 2015
A quick little way to update HTML code to have all self-closing elements have a trailing slash in Sublime Text 3
View st3-fnr-xhtml
# find all image elements replace the end with a trailing slash
find: <img(.*?)>
replace: <img\1 />
# find all input elements replace the end with a trailing slash
find: <input(.*?)>
replace: <input\1 />
# take all instances where extra / was made and trash it
find: / />
@johnbhartley
johnbhartley / random-placement
Last active Aug 29, 2015
Randomly places images inside a gallery in different absolute spot.
View random-placement
PlaceImages: function(galH, galW) {
// galH and galW are specified width/height
// either input in the function or could use width/height of gallery
var gal = $('.hp-gallery-images');
var imgs = $('.hp-gallery img');
imgs.each( function (index, el) {
var randNum_T = Math.round(Math.random() * galH);
var randNum_L = Math.round(Math.random() * galW);
@johnbhartley
johnbhartley / wc_checkout_params
Created Dec 26, 2014
WC Quick Checkout wc_checkout_params
View wc_checkout_params
<script type='text/javascript'>
/* <![CDATA[ */
var wc_checkout_params = {"ajax_url":"\/maxbuttons\/wp-admin\/admin-ajax.php","ajax_loader_url":"\/\/localhost:8888\/maxbuttons\/wp-content\/plugins\/woocommerce\/assets\/images\/ajax-loader@2x.gif","update_order_review_nonce":"769c6b66f9","apply_coupon_nonce":"13a129c0bc","option_guest_checkout":"yes","checkout_url":"\/maxbuttons\/wp-admin\/admin-ajax.php?action=woocommerce_checkout","is_checkout":"0","session_expired_message":"<div class=\"woocommerce-error\">Sorry, your session has expired. <a href=\"http:\/\/localhost:8888\/maxbuttons\" class=\"wc-backward\">Return to homepage<\/a><\/div>"};
var wc_checkout_params = {"ajax_url":"\/maxbuttons\/wp-admin\/admin-ajax.php","ajax_loader_url":"\/\/localhost:8888\/maxbuttons\/wp-content\/plugins\/woocommerce\/assets\/images\/ajax-loader@2x.gif","update_order_review_nonce":"769c6b66f9","apply_coupon_nonce":"13a129c0bc","option_guest_checkout":"yes","checkout_url":"\/maxbuttons\/wp-admin\/admin-ajax.php?action=woocomm
View htaccess-bits
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
@johnbhartley
johnbhartley / shareCount.php
Created Dec 10, 2014
A nice class for social sharing numbers - not my own code. Lost it and am keeping here for safe keeping.
View shareCount.php
<?
class shareCount {
private $url,$timeout;
function __construct($url,$timeout=10) {
$this->url=rawurlencode($url);
$this->timeout=$timeout;
}
function get_tweets() {
$json_string = $this->file_get_contents_curl('http://urls.api.twitter.com/1/urls/count.json?url=' . $this->url);
$json = json_decode($json_string, true);
View xml-popcard-GF-integration
function submit_contact_reserve_lead($entry){
$date = date('Y-m-d\TH:i');
$baseURL = 'http://interface.webservices.popcard.ltsolutions.com/service.asmx/InsertTraffic?strRequestXML=';
$xmlRequest = '
<traffic contactdatetime="' . $date . ':00" transactiondatetime="' . $date . ':00">
<trafficsource>
<vendorid>28e30c94-b263-49c5-b190-551d12d8a1de</vendorid>
<emailaddress>Laurel006@myLTSMail.com</emailaddress>
<propertyname>The Laurel</propertyname>
@johnbhartley
johnbhartley / Sticky sidebar after scroll
Last active Aug 29, 2015
Holy terribly named variables Batman!
View Sticky sidebar after scroll
$(function() {
var $sidebar = $(".main-sidebar.sticky"),
preFooter = $('.pre-footer'),
bloggy = $('.main-content'),
blogHeight = bloggy.offset(),
$window = $(window),
offset = $sidebar.offset(),
preOffset = preFooter.offset(),
height = $sidebar.height(),
You can’t perform that action at this time.