Skip to content

Instantly share code, notes, and snippets.

@chancesmith
chancesmith / logo-set-rotation.html
Last active March 30, 2016 20:28
Client logos rotate or fade-in/fade-out [all-in-sets] (non-carousel)
<ul class="social-proofs">
<li class="clientLogo"> <a href="#"><img src="/wp-content/uploads/2015/04/s_zenefits.png" alt=""></a> </li>
<li class="clientLogo"> <a href="#"><img src="/wp-content/uploads/2016/02/s_pac_12.png" alt=""></a> </li>
<li class="clientLogo"> <a href="#"><img src="/wp-content/uploads/2015/04/s_turner.png" alt=""></a> </li>
<li class="clientLogo"> <a href="#"><img src="/wp-content/uploads/2016/02/wholefoods.png" alt=""></a> </li>
<li class="clientLogo"> <a href="#"><img src="/wp-content/uploads/2015/04/s_edeva.png" alt=""></a> </li>
<li class="clientLogo" style="display: none;"> <a href="#"><img src="/wp-content/uploads/2015/04/s_google.png" alt=""></a> </li>
<li class="clientLogo" style="display: none;"> <a href="#"><img src="/wp-content/uploads/2015/04/s_thrillist.png" alt=""></a> </li>
<li class="clientLogo" style="display: none;"> <a href="#"><img src="/wp-content/uploads/2015/04/s_harrys.png" alt=""></a> </li>
<li class="clientLogo" style="display:
@chancesmith
chancesmith / Example HTML template
Created March 30, 2016 20:29
Use for example HTML markup
<h1>HTML Ipsum Presents</h1>
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
<h2>Header Level 2</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetr
@chancesmith
chancesmith / wp_functions.php
Created March 31, 2016 15:50
Wordpress Functions (background image, Appearance/Menus, dashboard link for tutorial videos, ifMobile function)
<?php
// functions.php file
// anchor all forms on site on submission (Gravity Forms)
add_filter( 'gform_confirmation_anchor', '__return_true' );
//if mobile function
function isMobile() {
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
@chancesmith
chancesmith / ismobile.js
Created April 20, 2016 19:38
A function to check if mobile device or browser is mobile size.
// if mobile function
function isMobile(){
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
return true;
} else if ($(window).width() < 991) {
return true;
}
}
@chancesmith
chancesmith / main.js
Created April 27, 2016 18:15
Get variable from URL - javascript
function getUrlVar(q) {
return (window.location.search.match(new RegExp('[?&]' + q + '=([^&]+)')) || [, null])[1];
}
@chancesmith
chancesmith / confirm-external-links.js
Created May 2, 2016 20:30
Confirm with user that they are about to leave the current site. (security confirmation for banking industry)
@chancesmith
chancesmith / .bash_profile
Created May 26, 2016 19:17
Terminal aliases for Git
#git
alias gs='git status'
alias ga='git add .'
alias gaa='git add --all'
alias gc='git commit -m'
alias gca='git commit --amend -m'
alias gl='git pull'
alias gp='git push'
alias gco='git checkout'
alias gpom="git pull origin master"
@chancesmith
chancesmith / index.html
Created June 9, 2016 16:12
Hide email address. Replaces NO and FIND with @ and .
<a href = "mailto:sarajaneviaNOgmailFINDcom"
onclick = "this.href=this.href
.replace(/NO/,'&#64;')
.replace(/FIND/,'&#46;')"
class="btn btn-default btn-lg"><i class="fa fa-envelope fa-fw"></i> <span class="network-name">Email Us</span></a>
@chancesmith
chancesmith / footer.php
Created July 19, 2016 14:54
Remove empty <p> tags from Wordpress
@chancesmith
chancesmith / jquery.overlayMap.js
Last active September 23, 2016 21:46
Disable Google-Map/iFrame scroll until clicked. We first wrap all iframes with .overlay div, to disable the iframe. Then the user clicks to use. Then adds the overlay back when mouseleave
// // wrap all iFrames, except those with an id of #noOverlay
$('iframe').not( document.getElementById( "noOverlay" ) ).wrap('<div class="overlayiFrame" />');
//overlay on iframes
$('.overlayiFrame iframe').css("pointer-events","none");
$('.overlayiFrame').click(function () {
$('.overlayiFrame iframe').css("pointer-events", "auto");
});
$('.overlayiFrame').mouseleave(function () {
$('.overlayiFrame iframe').css("pointer-events", "none");