Skip to content

Instantly share code, notes, and snippets.

View taylorkearns's full-sized avatar

Taylor Kearns taylorkearns

View GitHub Profile
@taylorkearns
taylorkearns / application.html.haml
Created August 28, 2013 14:30
Backbone sticky footer polyfil
:javascript
$(function() {
new Survca.StickyFooter({
el: 'body',
headerElem: 'header.global',
contentElem: 'section#main',
footerElem: 'footer.global'
});
});
@taylorkearns
taylorkearns / roundUp49
Created April 20, 2012 14:58
Rounds decimals ending in .49 up to .5. (Native JS Math.round() method rounds XX.49 down to XX.) If you want to use the Math.round() method but want to round up X.49, use this method in place of Math.round().
var _round = function(num) {
if(isDecimal(num)) {
var num_array = num.toString().split(".");
var whole_num = parseInt(num_array[0]);
var decimal_num = parseFloat("." + num_array[1]);
if(decimal_num > .444444444444444 && decimal_num < .5) {
decimal_num = .5;
}
num = whole_num + decimal_num;
}