Skip to content

Instantly share code, notes, and snippets.

@ryanjadhav
Last active August 29, 2015 14:22
Show Gist options
  • Save ryanjadhav/3d0d9d7ce05609d37797 to your computer and use it in GitHub Desktop.
Save ryanjadhav/3d0d9d7ce05609d37797 to your computer and use it in GitHub Desktop.
copy_braintree_codes.js
// Copies braintree webpage table into a more easily to consume json object.
// Steps:
// 1: go to https://developers.braintreepayments.com/ios+ruby/reference/general/countries
// 2: include jquery on the page
// 3: execute js below
// grabs all country codes and puts it into a json object like so: {name: 'United States', code: 'US' }
var json = []; $('table').find('tr').each(function(i, el) { json.push({'name': $(el).find('td:nth(0)').html(), 'code': $(el).find('td:nth(1)').html()} ) }); copy(json);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment