Skip to content

Instantly share code, notes, and snippets.

View davidicus's full-sized avatar

David Conner davidicus

View GitHub Profile
@davidicus
davidicus / formValidation
Created June 14, 2012 14:09
A collection of jQuery form validations and input formatting.
// Form Validation
jQuery('document').ready(function() {
/****************************
phone number restriction
*****************************/
//restrict input to numeric values, ., and - for phone numbers
@davidicus
davidicus / gist:4504081
Created January 10, 2013 17:36
new API for adding an event listener and testing for media queries.
var mq = window.matchMedia("(min-width: 480px)");
if (mq.matches) {
// window width is at least 480px
$('.slideOne').attr('src', 'img/slideOne.jpg');
$('.slideTwo').attr('src', 'img/slideTwo.jpg');
$('.slideThree').attr('src', 'img/slideThree.jpg');
$('.slideFour').attr('src', 'img/slideFour.jpg');
$('.slideFive').attr('src', 'img/slideFive.jpg');
$('.slideSix').attr('src', 'img/slideSix.jpg');
@davidicus
davidicus / SassGrid.css
Last active August 29, 2015 14:04
A grid by @Guilh made with sass
.grid-1 {
width: 6.5%;
}
.grid-2 {
width: 15%;
}
.grid-3 {
width: 23.5%;
@davidicus
davidicus / SassMeister-input-HTML.html
Created July 28, 2014 19:29
Generated by SassMeister.com.
<div class="box box___blue-grey">blue-grey</div>
<div class="box box___grey">grey</div>
<div class="box box___brown">brown</div>
<div class="box box___deep-orange">deep-orange</div>
<div class="box box___orange">orange</div>
<div class="box box___amber">amber</div>
<div class="box box___yellow">yellow</div>
<div class="box box___lime">lime</div>
<div class="box box___light-green">light-green</div>
<div class="box box___green">green</div>
@davidicus
davidicus / SassMeister-input.scss
Created September 12, 2014 13:24
Generated by SassMeister.com.
// ----
// Sass (v3.4.1)
// Compass (v1.0.1)
// ----
@mixin display (
$disp,
$padding: null,
$r-margin: null,
$l-margin: null) {
@davidicus
davidicus / atRootAppend.css
Last active August 29, 2015 14:16
Use of @at-root to append an element to the front of a class
.btn {
height: 18px;
background: green;
line-height: 12px;
}
a.btn {
line-height: 18px;
}
@davidicus
davidicus / Last-part-selector
Last active August 29, 2015 14:16
get last part of selector and Then use the double ampersand mixin.
/// Grab the last part of a selector
///
/// @param {List} $selector
/// @returns String
@function x-tail($selector) {
@return nth(nth($selector, -1), -1);
}
/// Double
/// @param {Number} $margin [null]
@davidicus
davidicus / randomName.css
Last active August 29, 2015 14:17
Random Animation naming
.some-element {
animation: 10s linear infinite;
animation-name: uziq13y6g;
}
@keyframes uziq13y6g {
from {
background-position: 0% 0%;
}
to {
background-position: 114.2857% 0%;
@davidicus
davidicus / unique names with unique-id()
Last active August 29, 2015 14:18
create unique names for keyframes with unique-id()
.some-element {
animation: 10s linear infinite;
animation-name: uevk2bess;
}
@keyframes uevk2bess {
from {
background-position: 0% 0%;
}
to {
background-position: 114.2857% 0%;
@davidicus
davidicus / longShadowMixin
Created May 7, 2015 21:33
Long shadow mixin
@mixin long-shadow-text ($distance, $blur, $color) {
$shadows: null;
$color: darken($color, 10);
$blur: $blur + px;
@for$i from 0 through $distance {
$dist: $i + px;
$shadows: append($shadows, ($dist $dist $blur $color), comma);
}
text-shadow: $shadows;
}