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 / 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 / main.js
Created August 26, 2016 16:48
Removes Google Analytics UTM variables from url after load
const loc = window.location;
if (loc.search.includes('utm')) {
if (window.history.replaceState) {
history.replaceState({}, '', loc.pathname);
}
else {
loc.hash = '';
}
}
@chancesmith
chancesmith / main.js
Created September 6, 2016 18:06
Write current year in footer with Javascript
<p class="copyright">Copyright &copy 2012 - <script type="text/javascript">var currentTime = new Date();var year = currentTime.getFullYear();document.write(year);</script> Your Company Name, Inc. / All rights reserved.</p>