Skip to content

Instantly share code, notes, and snippets.

@imthenachoman
imthenachoman / nachoDateDiff.js
Last active August 22, 2017 22:53
javascript pretty date difference with year, month, day
function nachoDateDiff(startDate, endDate)
{
// if start date is past end date stop
if(startDate > endDate) return null;
// calc the various start/end dates
var sy = startDate.getFullYear(),
ey = endDate.getFullYear(),
sm = startDate.getMonth(),
em = endDate.getMonth(),
@imthenachoman
imthenachoman / nXHR.js
Last active October 12, 2016 17:52
cross-browser (IE 8+) XMLHttpRequest that reuses an existing request for recurring requets
/* nXHR
* ----------------------------------------------------------------------------
* cross-browser (IE 8+) XMLHttpRequest that reuses an existing request for recurring requets
*
* url : https://gist.github.com/imthenachoman/8b4bbc1e4aa39fc5e6ef
* author : Anchal Nigam
* e-mail : imthenachoman@gmail.com
*
* Copyright (c) 2015 Anchal Nigam (imthenachoman@gmail.com)
* Licensed under the MIT license: http://opensource.org/licenses/MIT
@imthenachoman
imthenachoman / nCreateElement.js
Last active May 23, 2021 00:34
a JS shim to quickly create DOM elements using document.createElement
/* nCreateElement
* ----------------------------------------------------------------------------
* a JS shim to quickly create DOM elements using document.createElement
*
* url : https://gist.github.com/imthenachoman/4a72ff3f51133ab7eae3
* author : Anchal Nigam
* e-mail : imthenachoman@gmail.com
*
* Copyright (c) 2015 Anchal Nigam (imthenachoman@gmail.com)
* Licensed under the MIT license: http://opensource.org/licenses/MIT
@imthenachoman
imthenachoman / rAF.js
Last active October 12, 2016 17:54 — forked from paulirish/rAF.js
cross-browser (IE 8+) animation framework with easings
/* rAF
* ----------------------------------------------------------------------------
* cross-browser (IE 8+) animation framework with easings
*
* url : https://gist.github.com/imthenachoman/d19dc4cf6e53ad3664ea
* author : Anchal Nigam
* e-mail : imthenachoman@gmail.com
*
* Copyright (c) 2015 Anchal Nigam (imthenachoman@gmail.com)
* Licensed under the MIT license: http://opensource.org/licenses/MIT