Skip to content

Instantly share code, notes, and snippets.

@gianu
Forked from gregersrygg/gist:3899381
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gianu/9071417 to your computer and use it in GitHub Desktop.
Save gianu/9071417 to your computer and use it in GitHub Desktop.
one liner to log to console a random element from the meetup.com attendee list.
// copy-paste into console
console.log(Array.prototype.slice.call(document.querySelectorAll("#rsvp-list h5 a"),0).sort(function () { return Math.random() -0.5; })[0].innerHTML);
//click on the link to the profile
@gianu
Copy link
Author

gianu commented Nov 13, 2014

A good alternative is to call:

console.log(Array.prototype.slice.call(document.querySelectorAll("#rsvp-list h5 a"),0).sort(function () { return Math.random() -0.5; })[0].href);

You can have multiple members with the same name, but the link is unique (or should be at least 👅 )

@gianu
Copy link
Author

gianu commented Nov 13, 2014

A much better alternative:

var element = Array.prototype.slice.call(document.querySelectorAll("#rsvp-list h5 a"),0).sort(function () { return Math.random() -0.5; })[0]; console.log(element.href + " : " + element.innerHTML);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment