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
//Requires underscore, jquery | |
$(document).on('submit', 'selector.to.the.form.element', function(e){ | |
// The the data from the form | |
var formData = _.reduce($(e.currentTarget).serializeArray(), function(memo, val){ | |
memo[val.name] = val.value; | |
return memo; | |
},{}); | |
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
// Django template | |
(function(){ | |
var _date = new Date(); | |
date = { | |
gmtOffset: {% now "Z" %}, | |
offset: {% now "U" %} - Math.round(_date.getTime() / 1000), | |
now: function(unix){ | |
if(unix) | |
return Math.round(_date.getTime() / 1000) + this.offset + _date.getTimezoneOffset()*60*1000 + this.gmtOffset*1000; | |
return new Date(((Math.round(_date.getTime() / 1000) + this.offset)*1000) + _date.getTimezoneOffset()*60*1000 + this.gmtOffset*1000); |
NewerOlder