Skip to content

Instantly share code, notes, and snippets.

View simple-rotator
// jQuery
function cycleReviews(){
var $active = $('.content-slider .current');
var $next = ($active.next().length > 0) ? $active.next() : $('.content-slider div:first');
$active.fadeOut(500,function(){
$(this).removeClass('current');
$next.fadeIn().addClass('current');
});
@johnbhartley
johnbhartley / 50-states
Created May 20, 2014
List of 50 States
View 50-states
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
@johnbhartley
johnbhartley / fa-array
Created Jun 9, 2014
Font Awesome Icons Array - Title Only
View fa-array
$icon_array = array(
'fa-glass',
'fa-music',
'fa-search',
'fa-envelope-o',
'fa-heart',
'fa-star',
'fa-star-o',
'fa-user',
'fa-film',
View gist:be54cfddfc5faf6ec4cc
<div class="rrssb-buttons">
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" class="popup facebook">
<span class="icon">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
<path class="path" d="M27.825,4.783c0-2.427-2.182-4.608-4.608-4.608H4.783c-2.422,0-4.608,2.182-4.608,4.608v18.434
c0,2.427,2.181,4.608,4.608,4.608H14V17.379h-3.379v-4.608H14v-1.795c0-3.089,2.335-5.885,5.192-5.885h3.718v4.608h-3.726
c-0.408,0-0.884,0.492-0.884,1.236v1.836h4.609v4.608h-4.609v10.446h4.916c2.422,0,4.608-2.188,4.608-4.608V4.783z"/>
</svg>
</span>
<span class="text">Share on Facebook</span>
@johnbhartley
johnbhartley / round-down-clown-frown
Created Jul 3, 2014
Round down to nearest hundred
View round-down-clown-frown
$min = 780;
$floor = 780/100; // 7.8
$floor_fix = floor($floor); // 7.0
$min = $floor_fix*100; // 700
echo $min; // will output 700
@johnbhartley
johnbhartley / first-word
Created Jul 18, 2014
Span the first word ya dingus
View first-word
$string = 'Test me more';
$pattern = '/^(\S+)/';
$replacement = '<span class="first-word">$1</span>';
echo preg_replace($pattern, $replacement, $string);
// or
echo preg_replace('/^(\S+)/', '<span class="first-word">$1</span>', 'Test me more');
// from @greg5green
@johnbhartley
johnbhartley / lat-long-distance
Last active Aug 29, 2015
Distance between lat/long coordinates
View lat-long-distance
<script>
// from http://html5doctor.com/finding-your-position-with-geolocation/
if (navigator.geolocation) {
var timeoutVal = 10 * 1000 * 1000;
navigator.geolocation.getCurrentPosition(
displayPosition,
displayError,
{ enableHighAccuracy: true, timeout: timeoutVal, maximumAge: 0 }
);
}
@johnbhartley
johnbhartley / mb-do-shortcode
Created Aug 18, 2014
MaxButtons do_shortcode
View mb-do-shortcode
<?php echo do_shortcode('[maxbutton id="17" text="Search Google" url="http://google.com"]'); ?>
@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(),
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>
You can’t perform that action at this time.