Skip to content

Instantly share code, notes, and snippets.

View maxxcrawford's full-sized avatar

Maxx Crawford maxxcrawford

View GitHub Profile
@maxxcrawford
maxxcrawford / fizzbuzz-compare.html
Created May 27, 2015 18:53
FizzBuzz Test Comparison
<!-- Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”." -->
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 80px;
height: 20px;
line-height: 20px;
@maxxcrawford
maxxcrawford / morph-button.html
Created September 30, 2015 19:50
Morph Button
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Video Player</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
*, *:before, *:after {
box-sizing: border-box;
}
@maxxcrawford
maxxcrawford / sample .gitignore
Created October 12, 2015 18:56
Sample .gitignore
# Custom #
###################
/vendor
/node_modules
Homestead.yaml
.env
npm-debug.log
.sass-cache
.DS_Store
@maxxcrawford
maxxcrawford / video.html
Created October 15, 2015 20:24
sample-html5 video
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sample Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
body {
@maxxcrawford
maxxcrawford / dateShow.js
Last active December 17, 2015 16:09
Show/Hide Date Expiration
var dateExpire = function(){
var today = new Date(); //Get Raw Current Date
var dd = today.getDate(); // Formate Date
var mm = today.getMonth()+1; // Format Month
var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} today = mm+'/'+dd+'/'+yyyy; // Assemble mm/dd/yy date
$('.boo').each(function(){
if ($(this).attr('data-expire') < today){
$(this).hide();
} else {
@maxxcrawford
maxxcrawford / colorboxResizer.js
Last active December 21, 2015 21:48
Colorbox Responsive Resizer
/* Colorbox resize function */
var resizeTimer;
function resizeColorBox()
{
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
if (jQuery('#cboxOverlay').is(':visible')) {
jQuery.colorbox.load(true);
}
}, 300)
@maxxcrawford
maxxcrawford / addEventListenerIE8.js
Last active December 21, 2015 23:09
addEventListener / IE8 Fix
if (!window.addEventListener) {
// DO NOTHING
//window.attachEvent("orientationchange", resizeColorBox);
}
else {
window.addEventListener("orientationchange", resizeColorBox, false);
}
@maxxcrawford
maxxcrawford / smoothScroll.js
Created November 14, 2013 23:25
Smooth animate/scroll to snippet
$(".scroll").click(function(event){
event.preventDefault();
//calculate destination place
var dest=0;
if($(this.hash).offset().top > $(document).height()-$(window).height()){
dest=$(document).height()-$(window).height();
}else{
dest=$(this.hash).offset().top;
}
//go to destination
@maxxcrawford
maxxcrawford / ajaxCall.js
Created November 19, 2013 21:24
AJAX Call
var cache = {};
function getData( val ){
// Return a promise from the cache (if available)
// or create a new one (a jqXHR object) and store it in the cache.
var promise = cache[val];
if (!promise) {
promise = $.ajax('/foo/', {
data: { value: val },
@maxxcrawford
maxxcrawford / parsley-form.scss
Last active December 28, 2015 22:33
Parsley Validation – Adds overlay once the form is successfully submitted to stop user from selecting submit multiple times.
.parsley, .webform-client-form .form-item .parsley {
&-success {
outline: 1px solid $green;
}
&-error {
outline: 1px solid red;
}
&-errors-list {
display: none;
}