Skip to content

Instantly share code, notes, and snippets.

View JacobLett's full-sized avatar
🤠
hello!

Jacob Lett JacobLett

🤠
hello!
View GitHub Profile
@JacobLett
JacobLett / gist:4d9297808cb895525744
Created September 28, 2015 13:25
enque style and scripts wordpress with version number timestamp
//scripts addings
add_action( 'wp_enqueue_scripts', 'custom_scripts' );
function custom_scripts() {
//replace .time() with a hard version number for production
wp_enqueue_style( 'application-css', get_stylesheet_directory_uri() . '/css/theme.css?v='.time(), array(), false, 'all' );
wp_enqueue_script( 'application-js', get_stylesheet_directory_uri() . '/js/parallaxSlider.js?v='.time(), array('jquery'), 'all' );
}
@JacobLett
JacobLett / gist:65dc1972f230906ac02e
Created September 28, 2015 15:46 — forked from backflip/gist:1424004
WordPress Shortcodes
<?php
/**
* Enable shortcodes in widgets
*/
add_filter('widget_text', 'do_shortcode');
/**
@JacobLett
JacobLett / jquery_snippets.js
Created October 7, 2015 12:58
Collection of snippets for jquery
//---- Center an element in the center of your screen.
$(document).ready(function() {
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
}
});
@JacobLett
JacobLett / .js
Created October 7, 2015 13:40
grab url pathname replace forward slash / and file extension - to lowercase and add as body class jquery
// find the pathname
var urlPath = window.location.pathname;
//convert to lowercase
urlPath.match(/\/(.*?)(\+|$)/)[1].toLowerCase();
// remove the first character
urlPath = urlPath.replace(/\//g, '-').slice(1);
//remove file extension
urlPath = urlPath.replace(/\.[^/.]+$/, "");
// add class to body
$(document.body).addClass(urlPath);
@JacobLett
JacobLett / Footer.html
Created October 9, 2015 09:11
load javascript after entire document has loaded - add this to Bigcommerce template Footer.html
@JacobLett
JacobLett / gist:1eedf5dde4177e99728b
Last active April 26, 2020 13:37
use jquery soap services to get data from a sharepoint list - BOSS SAUCE
<script type="text/javascript" src="/prodhub/_catalogs/masterpage/AltairNet/js/jquery.SPServices-2014.02/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript">
//this is where the script starts after the page is loaded
$(document).ready(function() {
@JacobLett
JacobLett / .js
Created October 12, 2015 17:50
rss feed parser jquery - feed ek - Sharepoint RSS feed web part using script web part
<script type="text/javascript" src="http://momentjs.com/downloads/moment-with-langs.min.js"></script>
<script>
/*FeedEk jQuery RSS/ATOM Feed Plugin v2.0
* //jquery-plugins.net/FeedEk/FeedEk.html
* https://github.com/enginkizil/FeedEk
* Author : Engin KIZIL //www.enginkizil.com */
@JacobLett
JacobLett / .js
Created October 12, 2015 19:40
randomly show element with same class
/*
<div class="Image"><img src="/image5.jpg">5</div>
<div class="Image"><img src="/image6.jpg">6</div>
<div class="Image"><img src="/image7.jpg">7</div>
*/
@JacobLett
JacobLett / layout.css
Created October 16, 2015 12:11
hubspot COS layout.css - Grids and mobile visibility classes
.row-fluid {
width: 100%;
*zoom: 1
}
.row-fluid:before,.row-fluid:after {
display: table;
content: ""
}
@JacobLett
JacobLett / gist:28d9d9d069988facfdb9
Created October 26, 2015 14:55
countdown timer from a specific date & timezone jquery countdown.js
<span id="clock"></span>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.countdown/2.1.0/jquery.countdown.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment-with-locales.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.4.0/moment-timezone-with-data-2010-2020.min.js"></script>
<script type="text/javascript">
$(function() {
//November 17, 2015 - 10am ET
var nextYear = moment.tz("2015-11-17 10:00", "America/Detroit");