Skip to content

Instantly share code, notes, and snippets.

@Fauntleroy
Fauntleroy / comment.js
Last active June 23, 2016 01:41
Get a random popular Dribbble comment.
var NO_OP = function(){};
// randomly choose one of dribbble's popular shots
// keep choosing until we get one with comments
var getRandomShotId = function( callback ){
var getRandomShot = function( shots ){
var random_index = Math.floor(Math.random()*shots.length);
var shot = shots[random_index];
if( shot.comments_count === 0 ){
return getRandomShot( shots );