Skip to content

Instantly share code, notes, and snippets.

View JayWood's full-sized avatar

JayWood

View GitHub Profile
<?php if( $images ): ?>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
@JayWood
JayWood / distance_check.php
Last active August 29, 2015 14:16
Calculate the distance between two lat/long points in the world.
<?php
/**
* Calculate the distance between two points.
*/
class DistanceCheck {
/**
* Calculate
@JayWood
JayWood / vhost.bat
Last active August 29, 2015 14:19
Xampp & Windows host creator
:: I created this with some free time at WebDevStudios. I just got tired of having to edit my vhosts in xampp,
:: then go to my local computer's hosts file and edit that one as well, so why not create a batch file?
::
:: This batch file could use some logic updates as it will not know if the entries already exist in vhosts or
:: in your hosts file.
:: ALSO: I'm a newbie at batch files, so excuse any formatting issues :D
@echo off
[10-Jun-2015 14:40:35 UTC] PHP Fatal error: Class 'Mustache_Cache_NoopCache' not found in /home/dealtrend/public_html/wp-content/plugins/posts-to-posts/vendor/mustache/mustache/src/Mustache/Engine.php on line 528
[10-Jun-2015 14:40:35 UTC] PHP Stack trace:
[10-Jun-2015 14:40:35 UTC] PHP 1. {main}() /home/dealtrend/public_html/wp-admin/post.php:0
[10-Jun-2015 14:40:35 UTC] PHP 2. include() /home/dealtrend/public_html/wp-admin/post.php:209
[10-Jun-2015 14:40:35 UTC] PHP 3. do_meta_boxes($screen = 'locations', $context = 'side', $object = class WP_Post { public $ID = '19622'; public $post_author = '1'; public $post_date = '2015-06-03 09:47:07'; public $post_date_gmt = '2015-06-03 13:47:07'; public $post_content = ''; public $post_title = '3005 31st St , Astoria, NY'; public $post_excerpt = ''; public $post_status = 'publish'; public $comment_status = 'open'; public $ping_status = 'open'; public $post_password = ''; public $post_name = '3005-31st-st-astoria-ny'; public $to_ping = ''; public $pinged = ''; p
// JqueryUI datepicker and Magnific popup don't play well together, this is a fix.
$.magnificPopup.instance._onFocusIn = function(e) {
if( $(e.target).hasClass( 'ui-datepicker-month' )
|| $(e.target).hasClass( 'ui-datepicker-year' )
|| $( e.target ).hasClass( 'ui-state-default' ) ) {
return true;
}
$.magnificPopup.proto._onFocusIn.call(this,e);
};
function wds_dealtrend_deals_main_no_expired( $query ) {
if( ! $query instanceof WP_Query ) {
return 'FALSE';
}
if ( ! $query->is_main_query() || ! $query->is_post_type_archive( 'deals' ) ) {
return false;
}
$query->set( 'meta_query', array(
@JayWood
JayWood / fix_msword.php
Last active August 29, 2015 14:25
Fixes MS Word data
/**
* fixMSWord
*
* Replace ascii chars with utf8. Note there are ascii characters that don't
* correctly map and will be replaced by spaces.
*
* Updated 7-15-2015 by Jay Wood to encode lower end items into HTML entity counterparts.
*
* @author Robin Cafolla,Jay Wood
* @date 2013-03-22
@JayWood
JayWood / pos.css
Created August 3, 2015 05:08
CWv2 Background Positioning
.cwv3.dialog-overlay{
background-image: url("http://www.kikoriwhiskey.com/wp-content/uploads/2015/08/MG_9118Kikori.jpg");
/*
Center the background position
See - http://www.w3schools.com/cssref/pr_background-position.asp
*/
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center center;
@JayWood
JayWood / regen-thumbs-filter.php
Last active August 29, 2015 14:26
Re-generate thumbnails on the fly
<?php
/**
* Converts images on the fly
*
* Allows backwards compatibility if we add_image_size down the road.
*
* @param $post_id
* @param $post_thumbnail_id
* @param $size
*/
@JayWood
JayWood / colliding.js
Created September 8, 2015 13:17
Detect if two elements are colliding/overlapping
/**
* Detects if two elements are colliding
*
* Credit goes to BC on Stack Overflow, cleaned up a little bit
*
* @link http://stackoverflow.com/questions/5419134/how-to-detect-if-two-divs-touch-with-jquery
* @param $div1
* @param $div2
* @returns {boolean}
*/