Skip to content

Instantly share code, notes, and snippets.

View 8eecf0d2's full-sized avatar
:octocat:
Slipping down the slope that is GitHub by Microsoft™

Brod 8eecf0d2

:octocat:
Slipping down the slope that is GitHub by Microsoft™
View GitHub Profile
var imageAddr = "yourimage.jpg" + "?n=" + Math.random();
var startTime, endTime;
var downloadSize = [size here...];
var download = new Image();
download.onload = function () {
endTime = (new Date()).getTime();
showResults();
}
startTime = (new Date()).getTime();
download.src = imageAddr;
@kim3er
kim3er / gist:6594588
Last active June 12, 2017 21:49 — forked from Sigmus/gist:4014642
Example of parallel Mongoose execution.
var performers;
performers = {};
async.parallel({
conductor: function(callback) {
return conductor.find({}, function(err, result) {
return callback(err, result);
});
},
@jlbruno
jlbruno / ordinal.js
Last active July 28, 2022 14:58
Javascript Ordinal Numbers
// found here http://forums.shopify.com/categories/2/posts/29259
var getOrdinal = function(n) {
var s=["th","st","nd","rd"],
v=n%100;
return n+(s[(v-20)%10]||s[v]||s[0]);
}