Skip to content

Instantly share code, notes, and snippets.

@mzabriskie
Last active March 6, 2021 16:13
Show Gist options
  • Save mzabriskie/bc92a218a7759306af53 to your computer and use it in GitHub Desktop.
Save mzabriskie/bc92a218a7759306af53 to your computer and use it in GitHub Desktop.
Select random Meetup attendee
// Run this from your browser console on your meetup event page (http://www.meetup.com/AngularJS-Utah/events/183104032/)
(function () {
// Query document for attendees and select a random one
const list = document.querySelector('ul.attendees-list').children,
item = list[Math.floor(Math.random() * list.length)],
name = item ? item.querySelector('h4.text--bold').innerText : 'N/A';
// Remove item so they can only be selected once
item && item.parentNode.removeChild(item);
// Return random attendee
return name;
})();
@tylermcginnis
Copy link

This really is the best. Thanks again, we use it every month.

@silentworks
Copy link

This will not work on the new layout, you can will have to change to

// Run this from your browser console on your meetup event page attendees list (https://www.meetup.com/AngularJS-Utah/events/dcspwhyskblb/attendees)
(function () {
    // Query document for attendees and select a random one
    var list = document.querySelector('.attendees-list').children,
        item = list[Math.floor(Math.random() * list.length)],
        name = item ? item.querySelector('h4.text--bold').innerHTML : 'N/A';
    
    // Remove item so they can only be selected once
    item && item.parentNode.removeChild(item);
    
    // Return random attendee
    return name;
})();

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