Skip to content

Instantly share code, notes, and snippets.

View jesgundy's full-sized avatar

Jesse Gundy jesgundy

View GitHub Profile
@jesgundy
jesgundy / fonts.scss
Created March 27, 2014 14:47
Font-Icons Cheat Sheet. (Based on http://filamentgroup.com/lab/bulletproof_icon_fonts/) (Assumes Ruby/Rails env w/ Bourbon, Modernizr, Fontello, etc)
// Icon-Font Cheat Sheet
// Based on http://filamentgroup.com/lab/bulletproof_icon_fonts/
// Non-Critical icon
// ---
// <a href="#">
// <span class="icon-x" aria-hidden="true"></span> Menu
// </a>
@jesgundy
jesgundy / evts.js
Created March 31, 2014 16:08
Bind to transition end JS event.
evts = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd';
$menu.bind( evts, function() {
$menu.css('visibility', 'hidden');
$menu.unbind( evts );
});
@jesgundy
jesgundy / window-model.js
Created April 1, 2014 19:19
A require module that leverages backbone jquery and underscore to debounce and keep a running log of the window width for all components to listen to.
define([
'backbone',
'jquery',
'underscore'
], function(Backbone, $, _) {
// x-browser window width test
function winWidth() {
var w = 0;
@jesgundy
jesgundy / line-height.scss
Created April 7, 2014 19:59
Firefox input line-height fix.
input::-moz-focus-inner {
border: 0;
padding: 0;
margin-top:-2px;
margin-bottom: -2px;
}
@jesgundy
jesgundy / delay.js
Created May 8, 2014 18:24
D3 scalable delayed transition effect.
// …
.transition()
.delay(function(d, i) {
return i / dataset.length * 1000; // <-- Where the magic happens
})
.duration(500)
// …
@jesgundy
jesgundy / html.html
Created June 12, 2014 19:20
Conditional HTML classes.
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
@jesgundy
jesgundy / checkvisible.js
Created June 18, 2014 15:39
Check Visible - jQuery function to test presence of element on screen.
function checkvisible( elm ) {
var vph = $(window).height(), // Viewport Height
st = $(window).scrollTop(), // Scroll Top
y = $(elm).offset().top;
// test if element is on screen or has been scrolled past
return (y < (vph + st));
// test if element is on screen
// return (y > st) && (y < (vph + st));
@jesgundy
jesgundy / selection.scss
Created May 21, 2012 00:05
Text selection color
::selection {
background: #000;
}
::-moz-selection {
background: #000;
}
@jesgundy
jesgundy / alpha.scss
Created June 13, 2012 17:21
IE RGBA Filter
// Color format is #AARRGGBB where 'A' is alpha
background: rgba(0,0,0,0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#44000000,endColorstr=#44000000);
@jesgundy
jesgundy / addLoadEvent.js
Created September 11, 2012 13:23
Add load event function
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}