Skip to content

Instantly share code, notes, and snippets.

@steveosoule
steveosoule / ie-detection.js
Created October 11, 2012 18:00 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@steveosoule
steveosoule / cdn-google-jquery.html
Created October 11, 2012 23:04
Google CDN jQuery
// Use this script to load jQuery from Google's server instead of storing a local copy.
// It uses the same code as the Google Analytics tracking code to fetch it from a secure address if necessary.
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="/js/jquery.min.js"%3E%3C/script%3E'))</script>
@steveosoule
steveosoule / mvscreen.js
Created October 18, 2012 00:14
mvscreen.js
var MivaMerchantDesign = {
init: function () {
var mivaScreen = document.body.id;
String.prototype.toCamelCase = function () {
return this.replace(/(\-[a-z])/g, function ($1) {
return $1.toUpperCase().replace('-', '');
});
};
mivaScreen = mivaScreen.toCamelCase();
@steveosoule
steveosoule / pageFunctions.js
Created October 18, 2012 00:17
pageFunctions
var pageFunctions = {
init: function() {
var pageScreen = document.body.id;
if (pageFunctions[pageScreen]) {
$(document).ready(function() {
pageFunctions[pageScreen]();
});
}
},
HOME: function() {
@steveosoule
steveosoule / css-clearfix.css
Created October 30, 2012 23:21
CSS Clearfix
/*
Version 1: Older and Longer
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
@steveosoule
steveosoule / HTML5-template.html
Created November 1, 2012 21:21
HTML5 Template
<!doctype html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Default Page Title</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="styles.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<!--[if lt IE 9]>
@steveosoule
steveosoule / responsive-meta-tags.html
Created November 1, 2012 21:23
Responsive Layout Meta Tag
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="HandheldFriendly" content="true">
@steveosoule
steveosoule / default-links.css
Created November 1, 2012 21:39
Improved Default Link Style
@steveosoule
steveosoule / visually-hidden.css
Created November 1, 2012 21:43
Visually Hidden vs display:none
.visuallyhidden {
position: absolute;
width: 1px; /* Setting this to 0 make it invisible for VoiceOver */
height: 1px; /* Setting this to 0 make it invisible for VoiceOver */
padding: 0;
margin: -1px;
border: 0;
clip: rect(0 0 0 0);
overflow: hidden;
}
@steveosoule
steveosoule / box-sizing-fix.css
Created November 1, 2012 21:43
Box Sizing Fix
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}