Skip to content

Instantly share code, notes, and snippets.

@adamterlson
adamterlson / fixingAlly.js
Created October 17, 2014 01:50
How Ally can fix their lack of quickly-pickable date ranges
function formatDate(date) {
return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
}
$('form[name=accountDetailForm]').on('submit', function (e) {
alert('Submitted!');
e.preventDefault();
});
$('#dateRange a[data-date-range]').click(function (e) {
@adamterlson
adamterlson / jsonPropertySort.js
Last active August 29, 2015 14:07
Ordering JSON document properties alphabetically
function sortProperties(objToSort) {
var properties = Object.keys(objToSort).sort();
var result = {};
properties.forEach(function (prop) {
if (!objToSort[prop]) {
result[prop] = objToSort[prop];
}
else if (Array.isArray(objToSort[prop])){
result[prop] = objToSort[prop].map(sortProperties);
}