Skip to content

Instantly share code, notes, and snippets.

View stowball's full-sized avatar

Matt Stow stowball

View GitHub Profile
@stowball
stowball / wp8-ie10-fix.js
Last active April 17, 2022 19:09
Microsoft's stop-gap solution to fix IE 10 & 11's viewport on Windows Phone 8. I've also added another condition so it won't run on other browsers that spoof the user agent. Details: http://mattstow.com/responsive-design-in-ie10-on-windows-phone-8.html
(function() {
if ("-ms-user-select" in document.documentElement.style && navigator.userAgent.match(/IEMobile/)) {
var msViewportStyle = document.createElement("style");
msViewportStyle.appendChild(
document.createTextNode("@-ms-viewport{width:auto!important}")
);
document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
}
})();
@stowball
stowball / ie7-clearfix.css
Last active December 11, 2015 20:09
The simplest way to contain floats in IE 7 (clearfix)
.container {
min-height: 0;
}
@stowball
stowball / retina.css
Last active December 11, 2015 20:18
The simplest "retina" media query
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx) {
}
@stowball
stowball / clearfix.css
Created February 1, 2013 04:07
Cross-browser Clearfix
.clearfix:after {
clear: both;
content: '.';
display: block;
height: 0;
visibility: hidden;
}
@stowball
stowball / responsive-image.html
Created February 1, 2013 04:08
base64 spacer GIF for retina content images redux
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" alt="" />
@stowball
stowball / update-forked-repo.txt
Created February 18, 2013 11:07
How to update a forked repo (remote upstream)
git remote add upstream <original repo url>
git pull upstream master
git push origin
@stowball
stowball / tabs.css
Last active December 20, 2016 22:46
ARIA accessible, simple jQuery tabs which cater for nested levels
/* Add .js on <html> by default or with Modernizr, CssUserAgent or similar */
.js .pane {
display: none;
}
.js .pane:first-child {
display: block;
}
.tabs a.current {}
@stowball
stowball / meta-viewport.html
Created March 7, 2013 00:43
Responsive/Mobile meta viewport tags
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@stowball
stowball / jquery.rwdImageMaps-hilight.js
Created April 3, 2013 08:58
rwdImagesMaps modified to allow mapHilight (buggy)
/*
* rwdImageMaps jQuery plugin v1.5
*
* Allows image maps to be used in a responsive design by recalculating the area coordinates to match the actual image size on load and window.resize
*
* Copyright (c) 2013 Matt Stow
* https://github.com/stowball/jQuery-rwdImageMaps
* http://mattstow.com
* Licensed under the MIT license
*/
@stowball
stowball / crazy-heading-selector.css
Last active December 15, 2015 23:49
Crazy heading selector to account for every possible combination of a heading followed by another heading (including a heading class)
h1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, h6:first-child,
.h1:first-child, .h2:first-child, .h3:first-child, .h4:first-child, .h5:first-child, .h6:first-child,
h1 + h1, h1 + h2, h1 + h3, h1 + h4, h1 + h5, h1 + h6, .h1 + h1, .h1 + h2, .h1 + h3, .h1 + h4, .h1 + h5, .h1 + h6, h1 + .h1, h1 + .h2, h1 + .h3, h1 + .h4, h1 + .h5, h1 + .h6, .h1 + .h1, .h1 + .h2, .h1 + .h3, .h1 + .h4, .h1 + .h5, .h1 + .h6,
h2 + h1, h2 + h2, h2 + h3, h2 + h4, h2 + h5, h2 + h6, .h2 + h1, .h2 + h2, .h2 + h3, .h2 + h4, .h2 + h5, .h2 + h6, h2 + .h1, h2 + .h2, h2 + .h3, h2 + .h4, h2 + .h5, h2 + .h6, .h2 + .h1, .h2 + .h2, .h2 + .h3, .h2 + .h4, .h2 + .h5, .h2 + .h6,
h3 + h1, h3 + h2, h3 + h3, h3 + h4, h3 + h5, h3 + h6, .h3 + h1, .h3 + h2, .h3 + h3, .h3 + h4, .h3 + h5, .h3 + h6, h3 + .h1, h3 + .h2, h3 + .h3, h3 + .h4, h3 + .h5, h3 + .h6, .h3 + .h1, .h3 + .h2, .h3 + .h3, .h3 + .h4, .h3 + .h5, .h3 + .h6,
h4 + h1, h4 + h2, h4 + h3, h4 + h4, h4 + h5, h4 + h6, .h4 + h1, .h4 + h2, .h4 + h3, .h4 + h4, .h4 + h5, .h