Skip to content

Instantly share code, notes, and snippets.

@mib348
mib348 / .js
Created April 26, 2020 13:37 — forked from JacobLett/.js
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);
@mib348
mib348 / jquery_snippets.js
Created April 26, 2020 13:37 — forked from JacobLett/jquery_snippets.js
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;
}
});
@mib348
mib348 / gist:0becfceeefe74d2371b7366c72c9c050
Created April 26, 2020 13:37 — forked from JacobLett/gist:1eedf5dde4177e99728b
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() {
@mib348
mib348 / gist:049270fd54b017b84bb629803be7ad74
Created April 26, 2020 13:37 — forked from JacobLett/gist:28d9d9d069988facfdb9
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");
@mib348
mib348 / iframe_defer.js
Created April 26, 2020 13:36 — forked from JacobLett/iframe_defer.js
Defer loading of iframes
/**
* Defer iframe loading.
*
* Markup:
* <div class="defer-iframe" data-src="{SOURCE URL}" data-{ATTR}="{VAL}"></div>
*/
$(window).load( function(){
if ($('.defer-iframe').length) {
$('.defer-iframe').each( function() {
var $iframe = $('<iframe frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');
<select name="" id="" class="form-control">
<option value="">Select</option>
<option value="AFG">Afghanistan</option>
<option value="ALB">Albania</option>
<option value="DZA">Algeria</option>
<option value="ASM">American Samoa</option>
<option value="AND">Andorra</option>
<option value="AGO">Angola</option>
<option value="AIA">Anguilla</option>
<option value="ATA">Antarctica</option>
@mib348
mib348 / gist:870473f042af46e6d6b9e15bd3cd3828
Created April 26, 2020 13:36 — forked from JacobLett/gist:b8eb00eafc3f78cd271a043b7adb9883
shopify snippets{% include '<filename goes here>' %}
include
{% include '<filename goes here>' %}
@mib348
mib348 / gist:71763707ce187309c46764a8ce3a9078
Created April 26, 2020 13:36 — forked from JacobLett/gist:b0abf3c4b589a3e916aad61ab4b4ad61
youtube embed without related videos and watch on youtbe
<div class="embed-responsive embed-responsive-16by9">
<iframe width="1280" height="720" src="https://www.youtube-nocookie.com/embed/UNIQUEID?rel=0&amp;showinfo=0&amp;modestbranding=1" frameborder="0" allowfullscreen></iframe>
</div>
<link href="primary.css" rel="stylesheet">
<link href="secodary.css" rel="stylesheet">
<link href="sm.css" rel="stylesheet" media="(min-width: 544px)">
<link href="md.css" rel="stylesheet" media="(min-width: 768px)">
<link href="lg.css" rel="stylesheet" media="(min-width: 992px)">
<link href="xl.css" rel="stylesheet" media="(min-width: 1200px)">
<link href="print.css" rel="stylesheet" media="print">
//Human Resources
$('#hrNav a').click(function(){
$.getJSON("https://freegeoip.net/json/?callback=?", function(location) {
//United States
if (location.country_code == 'US') {
window.top.location.href = 'https://';
//India
} else if (location.country_code == 'IN') {