Skip to content

Instantly share code, notes, and snippets.

@mmcc
Created December 10, 2014 00:32
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 mmcc/a5ba61d93c4704739371 to your computer and use it in GitHub Desktop.
Save mmcc/a5ba61d93c4704739371 to your computer and use it in GitHub Desktop.
Had trouble with too many temporary accounts on slack import, so hacked this together.
var $selects = $('.user_map_selector select');
var throwAwayEmail = function(index) {
return 'oldsupportacct+'+ getRandomInt(2500, 99999) +'@zencoder.com';
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
var count = 0;
$selects.each(function(index) {
var $emailInput = $(this).closest('.user_map_selector').children("div").children("input");
var currentVal = $(this).val();
if (currentVal === '-') {
count++;
$(this).val('create');
$emailInput.removeClass('hidden');
$emailInput.val(throwAwayEmail(index));
}
});
console.log(count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment