Skip to content

Instantly share code, notes, and snippets.

View ackernaut's full-sized avatar

Terry Acker ackernaut

View GitHub Profile
@ackernaut
ackernaut / ua-plat-selectors.css
Created March 20, 2012 20:14
CSS: UA and Platform selectors
html[data-useragent*='iPhone'] h1 {
color:blue;
}
html[data-platform='iPad'] h1 {
color:red;
}
/* See https://gist.github.com/2140799 for JS */
/* Thanks, Rogie! http://rog.ie/post/9089341529/html5boilerplatejs */
@ackernaut
ackernaut / ua-to-html.js
Created March 20, 2012 20:11
JS: UA and Platform on HTML tag
var htmlAttr = document.documentElement;
htmlAttr.setAttribute('data-useragent', navigator.userAgent);
htmlAttr.setAttribute('data-platform', navigator.platform);
// See https://gist.github.com/2140827 for CSS
// Thanks, Rogie! http://rog.ie/post/9089341529/html5boilerplatejs
@ackernaut
ackernaut / hide-text.css
Created March 13, 2012 14:22
CSS: Hide text
.hide-text {
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
}
/* See Zeldman: http://bit.ly/Aazp14 */
@ackernaut
ackernaut / iphone-landscape.css
Created March 10, 2012 19:53
CSS: iPhone landscape
@media screen and (max-width:480px) and (orientation:landscape) {
/* Do stuff for iPhone in landscape */
}
@ackernaut
ackernaut / ios-app-mode-disabled.js
Created March 10, 2012 19:41
JS: iOS app mode disabled
var htmlAttr = document.documentElement;
// Check if app mode is enabled, but not being used
if (("standalone" in window.navigator) && !window.navigator.standalone) {
$(htmlAttr).addClass('ios-app-mode-disabled');
}
// Thanks, Ben! http://bit.ly/95VUOP