Skip to content

Instantly share code, notes, and snippets.

View Matt-Jensen's full-sized avatar
🟩
GREEN SQUARE GOOD

Matt-Jensen Matt-Jensen

🟩
GREEN SQUARE GOOD
View GitHub Profile
var phoneRegExp = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
@Matt-Jensen
Matt-Jensen / Sass Retina Query Mixin
Last active December 22, 2015 01:19
A sass function to generate retina media queries.
/* Update: 5/3/14 - supports IE9+, FF3.5+, Opera9.5+ */
@mixin retina($query: null, $density: 2) {
$dpi: $density * 96;
/* Accepts optional @media query conditions */
@if $query {
$query: "and (#{$query})";
}
@else {
@Matt-Jensen
Matt-Jensen / 100% viewport height and width
Last active December 19, 2015 19:18
Quick css snippet for a 100% viewport width and height for full screen background images and the like. Keeps everything in the flow of the DOM as well.
/* Parent Element */
#background-container {
height: 100%;
min-height: 100%;
width: 100%;
position: relative;
background: black;
}
/* Child Element */
@Matt-Jensen
Matt-Jensen / Detect Pointer Type
Last active December 19, 2015 03:19
This could be a horrible idea but this is a short function that detects the supported pointer type and returns a string to use with event listeners.
// Determine the supported pointer event, whether click or touch ect.
function supportedClickEvent() {
var supportedEvent = 'click';
if( 'ontouchstart' in window ) {
supportedEvent = 'touchstart';
}
else if( window.navigator.msPointerEnabled ) {
supportedEvent = 'MSPointerDown';
}