Skip to content

Instantly share code, notes, and snippets.

@davidrleonard
Last active April 28, 2016 03:20
Show Gist options
  • Save davidrleonard/d093ec7c4b0316e9658fbeb74cc18317 to your computer and use it in GitHub Desktop.
Save davidrleonard/d093ec7c4b0316e9658fbeb74cc18317 to your computer and use it in GitHub Desktop.
Eventbrite snippet - Copy all discount codes for event by scraping DOM
// Visit the Eventbrite discount/access code page for your event
// Expand the discount code table
// Open your JavaScript developer console and dump this code in
// Get the discount table rows
var t = $('#table_discount').find('tbody').find('tr');
// Create an array to hold the codes
var codes = new Array;
// Loop over the table rows, find the anchor link holding the code string, and push the string to `codes`
$.each(t, function(index,z){
codes.push($(z).children().first().find('a').text());
});
// Copy the codes to browser clipboard in array format i.e. ["Code-1","Code-2"]
copy(codes);
// You'll now have all the codes on clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment