This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const layerRoot = x => { | |
let l = Math.ceil(Math.sqrt(x)); | |
return l%2 ? l : ++l | |
} | |
const orbit = lr => (lr-1)/2 | |
const centers = lr => [0,1,2,3].map(x => Math.pow(lr,2) - orbit(lr) - (lr-1)*x) | |
const centerDist = x => Math.min(...centers(layerRoot(x)).map(c => Math.abs(c-x))) | |
const dist = x => centerDist(x) + orbit(layerRoot(x)) | |
dist(input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env browser */ | |
'use strict'; | |
import _ from 'underscore'; | |
import 'waypoints/lib/noframework.waypoints.js'; | |
const Waypoint = window.Waypoint; | |
/** | |
* Lazy loading image component. A JQuery element is supplied with a | |
* data-src attribute. Using Waypoints to detect when the element enters the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env browser */ | |
'use strict'; | |
import $ from 'jquery'; | |
import _ from 'underscore'; | |
/** | |
* A component that fires an event when a scroll on the provided element | |
* starts, fires an event when scrolling ends, and tracks the scroll position | |
* of that element then triggers a 'direction-change' event when the new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is no longer maintained. See: https://github.com/bsd/utilities/tree/master/tools-utilities | |
// Adds useful divs around radio/label pairs for credit card type. | |
$('.cc_type_cd').first().before('<div class="cc_type_container">').end() | |
.each(function() { | |
$(this).next('.cc_type_cd_label').andSelf().detach() | |
.appendTo('.cc_type_container').wrapAll('<div class="cc_pair">'); | |
}); | |
// Sets focus on Other Amount text input when other is chosen |