Skip to content

Instantly share code, notes, and snippets.

View ackernaut's full-sized avatar

Terry Acker ackernaut

View GitHub Profile
@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
@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 / 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 / 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 / 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 / text-overflow.css
Created April 16, 2012 20:29
CSS: Text overflow with ellipsis
/* Seen in jQuery Mobile, Twitter's Bootstrap, etc. */
/* Requires inline-block or block for proper styling */
.text-overflow {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@ackernaut
ackernaut / border-box-sizing.css
Created April 16, 2012 20:35
CSS: Border-box sizing
// Border-box sizing
.box-sizing {
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@ackernaut
ackernaut / brand-colors.less
Created September 26, 2012 02:38
BrandColors as LESS variables
// BrandColors
// Curated by: Galen Gidman
// http://galengidman.com/brandcolors/
// LESS CSS Variables
// Using @bc'BrandColor' as naming convention
// LESS file by @ackernaut
@bcAboutMeBlue: #00405d;
@bcAboutMeYellow: #ffcc33;
@ackernaut
ackernaut / detection.js
Created October 31, 2012 14:36
Detect platforms, devices, etc.
// File: detection.js
(function($){
var htmlAttr = document.documentElement;
var ua = navigator.userAgent.toLowerCase();
// Global variables
isiPhone = ua.indexOf("iphone") > -1;
isiPad = ua.indexOf("ipad") > -1;
@ackernaut
ackernaut / ios-dimension-vars.less
Created December 7, 2012 16:42
LESS variables for iOS device dimensions
// iOS Device Dimensions
@iPadLandHeight: 768px;
@iPadPortHeight: 1024px;
@iPadLandWidth: 1024px;
@iPadPortWidth: 768px;
@iPhoneLandHeight: 320px; // 640 / 2
@iPhonePortHeight: 480px; // 960 / 2