Skip to content

Instantly share code, notes, and snippets.

View Jayphen's full-sized avatar
🏠
Working from home

Jayphen Jayphen

🏠
Working from home
View GitHub Profile
@Jayphen
Jayphen / gist:2374987
Created April 13, 2012 07:59
Yield custom trackPageview parameters for Google Analytics
-if content_for?(:track_page_view)
="_gaq.push(['_trackPageview', #{yield(:track_page_view).gsub(/\s+/, '')} ]);"
-else
_gaq.push(['_trackPageview']);
@Jayphen
Jayphen / Modernizr Box-sizing
Created September 21, 2011 05:30
Modernizr box-sizing check
Modernizr.addTest('box-sizing', function() {
var test = document.createElement('div'),
root = document.documentElement.appendChild(document.createElement('body'));
test.style.cssText = '-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;padding:0 10px;margin:0;border:0;position:absolute;top:0;left:0;width:100px';
root.appendChild(test);
var ret = test.offsetWidth === 100;
root.removeChild(test);
@Jayphen
Jayphen / Modernizr min-width extension
Created March 28, 2011 02:23
Extend modernizr to check if minwidth is supported or not
Modernizr.addTest('minwidth', function() {
var test = document.createElement('div'),
root = document.documentElement.appendChild(document.createElement('body'));
test.style.cssText = 'min-width:22px;padding:0;margin:0;position:absolute;top:0;left:0';
root.appendChild(test);
var ret = test.offsetWidth === 22;
root.removeChild(test);