Skip to content

Instantly share code, notes, and snippets.

View jongamble's full-sized avatar

Jon Gamble jongamble

View GitHub Profile
@jongamble
jongamble / insertTermsFront
Created February 8, 2013 16:01
Wordpress insert terms function
<?php
$terms = array(
'Birmingham - AL',
'Dothan - AL',
'Huntsville - AL',
'Montgomery - AL',
'Mobile - AL',
'Anchorage - AK',
'Fairbanks - AK',
'Juneau - AK',
@jongamble
jongamble / geocode.py
Last active December 12, 2015 08:09
Geocoding addresses from a CSV file and outputting to a json file
#!/usr/bin/python
# Filename: geocoding.py
import csv
from geopy import geocoders
import time
g = geocoders.Google()
spamReader = csv.reader(open('fileName.csv', 'rbU'), quotechar='|')
@jongamble
jongamble / gist:5065114
Created March 1, 2013 14:48
Minimal header slider
//Header image slider
function remCla( elemLen ){
$(".pager li").removeClass().eq(elemLen).addClass("active");
}
var i = 0;
function InOut( elem ){
elem.delay().fadeIn().delay(7000).fadeOut(800,
function(){
i+=1;
i%=3;
<?php // Let's make a trail of crumbs, whether we are on the post or the page....This DOES NOT support custom Post Types...
function get_breadcrumbs($post){
//Create an is_blog function
function is_blog($post) {
$posttype = get_post_type($post);
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
$bread_crumb_trail = '<span><a href="'.get_bloginfo('url').'">Home</a></span> &raquo;';
//Ancestors will only live on hierarchical posts...just pages.
@jongamble
jongamble / gist:5571531
Created May 13, 2013 21:06
Short jQuery Accordian
jQuery(document).ready(function($) {
var allPanels = $('.termContent').hide();
$('.termHeader').on('click', function(){
$('.termContent.active').removeClass('active').hide(400);
$(this).siblings('.termContent').not('.active').slideToggle().addClass('active');
});
});
@jongamble
jongamble / blogIntegration.php
Created June 24, 2013 16:32
A small jquery mobile file I created to pull down the ten most recent blog posts and display them on a main index page, and subpages for each of the blog posts. Pulled it down using an RSS and jQuery.load() method.
<?php include('../library/includes/config.php'); ?>
<?php
$blogUrl = 'http://www.trimarksolutions.com/inside/feed/';
$blogData = simplexml_load_file($blogUrl);
$blogData = $blogData->channel;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
@jongamble
jongamble / isRussian
Last active December 19, 2015 02:38
An email filter that uses RegEx to check for cyrillic characters
function isRussian($val){
$result = preg_match('/[А-Яа-яЁё]/u', $val);
return $result;
}
@jongamble
jongamble / con_form.php
Created July 3, 2013 13:09
This is a basic contact form to build off of.
<?php //Let's Contact Form This Thing UP!
// Start Your PHP Sessions
session_start();
// Set the contact page variable for redirection later
$contact_page = get_permalink(48);
// Create the necessary variable that will be used in detecting errors
$errorFound = false;
@jongamble
jongamble / flickering-text-fix
Created November 20, 2013 14:47
Fix flickering text that happens with bxSlider occasionally.
-webkit-backface-visibility: hidden;
@jongamble
jongamble / placeholder.sublime-snippet
Created January 8, 2014 16:23
Sublime Placeholder Text Snippet
<snippet>
<content><![CDATA[
::-webkit-input-placeholder {color: ${1:hex-value} }
:-moz-placeholder {color: ${1:hex-value} }
::-moz-placeholder {color: ${1:hex-value} }
:-ms-input-placeholder {color: ${1:hex-value} }
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>placeholder</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->