Skip to content

Instantly share code, notes, and snippets.

View dbox's full-sized avatar

Daniel Box dbox

View GitHub Profile
@dbox
dbox / nav order
Last active August 29, 2015 14:04
Android tab nav order
<ul class="page-jump clearfix">
<!-- make sure these match order of content on page -->
<li><a href="#android_overview">Overview</a></li>
<li><a href="#android_quickStart" class="">Quick Guide<span class="locked"><img src="img/lock.png"></span></a></li>
<li><a href="#android_apiPackage" class="">API<span class="locked"><img src="img/lock.png"></span></a></li>
<li><a href="#android_codeSnippet" class="">Code Snippet</a></li>
<li><a href="#android_specs" class="active">Specs</a></li>
<li><a href="#android_videoDownloads">Video Downloads</a></li>
</ul>
@dbox
dbox / gist:b7a953f4de1b236f44a9
Created August 4, 2014 16:03
vertically align any element
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
@dbox
dbox / gist:8200937
Created December 31, 2013 19:05
Title Caps
/*
* Title Caps
*
* Ported to JavaScript By John Resig - http://ejohn.org/ - 21 May 2008
* Original by John Gruber - http://daringfireball.net/ - 10 May 2008
* License: http://www.opensource.org/licenses/mit-license.php
*/
(function(){
var small = "(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v[.]?|via|vs[.]?)";
@dbox
dbox / section-centering
Last active December 23, 2015 17:49
Centering without using an inner element via @LeaVerou
section {
width: 700px;
padding: 0 calc(50% - 350px);
}
@dbox
dbox / Simple resets
Last active December 21, 2015 11:39
/* ==========================================================================
Defaults
========================================================================== */
/* apply a natural box layout model to all elements */
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@dbox
dbox / kni-mixins
Created August 21, 2013 19:10
KNI mixins
@mixin transition-all($time) {
-webkit-transition: all $time+s ease;
-moz-transition: all $time+s ease;
-o-transition: all $time+s ease;
transition: all $time+s ease;
}
@mixin transition($property, $time) {
-webkit-transition: $property $time+s ease;
-moz-transition: $property $time+s ease;
@media only screen and (min-width: 1100px) {
#homecontent {
min-height: 650px;
background-size: cover;
}
}
@dbox
dbox / copy paste append
Created August 22, 2012 15:39
append text after a copy and paste
var radium=[];
if("undefined"==typeof radium.init){var readatURL="",ctrl;(function(){var f=function(){var d=document.body,j=document.documentElement,l=function(b,a){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},k=function(b,a,c){b=document.createElement(b);l(a,b);l(c,b.style);return b},f=function(){var b,a=function(){window.removeEventListener("blur",a,!1);m(b);return!0};return function(c){b=c.target||c.srcElement;window.removeEventListener("blur",a,!1);"IMG"==b.nodeName&&"A"!=b.parentNode.nodeName&&(window.addEventListener("blur",
a,!1),setTimeout(function(){document.removeEventListener("blur",a,!1)},1E3));return!0}}(),n=function(){},o=function(b){m(b.target||b.srcElement,!0)},e;radium.inited?e=function(){}:(radium.inited=!0,e=function(){window.addEventListener?(navigator.userAgent.match("Firefox/2")||d.addEventListener("copy",o,!1),window.addEventListener("mousedown",n,!1),document.addEventListener("contextmenu",f,!1)):(d.attachEvent("oncopy",o),d.attachEvent("onmousedown",n));return function(b,a){var c;
@dbox
dbox / gist:3373317
Created August 16, 2012 20:20
Union bank bg
background: #fbfdff; /* Old browsers */
background: -moz-linear-gradient(-45deg, #fbfdff 0%, #e8eff7 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#fbfdff), color-stop(100%,#e8eff7)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(-45deg, #fbfdff 0%,#e8eff7 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(-45deg, #fbfdff 0%,#e8eff7 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(-45deg, #fbfdff 0%,#e8eff7 100%); /* IE10+ */
background: linear-gradient(135deg, #fbfdff 0%,#e8eff7 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fbfdff', endColorstr='#e8eff7',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
@dbox
dbox / iphone:fixed
Created May 3, 2012 17:01
iPhone position:fixed scroll fix
// Fixed position fix
$('nav ul a').click(function(){
// Find anchor position based on href
var y=Math.floor($($(this).attr('href')).offset().top);
// Add position fixed to nav
fixIt();
// Animate to anchor position
$('html,body').animate({ scrollTop:y},500,function(){
// On animation complete add position absolute to nav
// using the anchor position as top