<commit_before>$(document).on('ready page:load', function () {
  arrayCountry = <%= CountryStateSelect::Constant::COUNTRIES %>

  $("#country_id").change(function() {

    var default_state = []
    var country = $('#country_id option:selected').text()
    var name = $("#state_name").attr("name");
    var select = $('<select name='+ name +' id="stae_name"></select>');
    var indian_state =
    <%= CountryStateSelect::Constant::INDIAN_STATES %>
    var usa_state =
    <%= CountryStateSelect::Constant::USA_STATES %>
    var canadan_state =
    <%= CountryStateSelect::Constant::CANADIAN_STATES %>
    var uk_state =
    <%= CountryStateSelect::Constant::UK_STATES %>
    var options = '';

    switch (country) {
      case "India":
        default_state = indian_state
        break
      case "United Kingdom":
        default_state = uk_state
        break;
      case "Canada":
        default_state = canadan_state
        break;
      case "United States":
        default_state = usa_state
        break;
      default:
        default_state = []
    }
  
  if (default_state.length > 0) {
    for(var val in default_state) {
      $('<option />', {value: default_state[val], text: default_state[val]}).appendTo(select);
    }
  } else {
    select = "<input id='state_name' name="+ name +" type='text' value='' />"
  }
  $('#state_name').replaceWith(select); // it will replace what ever inside the id
  });
});<commit_msg>Removed unused code<commit_after>$(document).on('ready page:load', function () {
  $("#country_id").change(function() {
    var default_state = []
    var country = $('#country_id option:selected').text()
    var name = $("#state_name").attr("name");
    var select = $('<select name='+ name +' id="stae_name"></select>');
    var indian_state =
    <%= CountryStateSelect::Constant::INDIAN_STATES %>
    var usa_state =
    <%= CountryStateSelect::Constant::USA_STATES %>
    var canadan_state =
    <%= CountryStateSelect::Constant::CANADIAN_STATES %>
    var uk_state =
    <%= CountryStateSelect::Constant::UK_STATES %>
    var options = '';

    switch (country) {
      case "India":
        default_state = indian_state
        break
      case "United Kingdom":
        default_state = uk_state
        break;
      case "Canada":
        default_state = canadan_state
        break;
      case "United States":
        default_state = usa_state
        break;
      default:
        default_state = []
    }
  
    if (default_state.length > 0) {
      for(var val in default_state) {
        $('<option />', {value: default_state[val], text: default_state[val]}).appendTo(select);
      }
    } else {
      select = "<input id='state_name' name="+ name +" type='text' value='' />"
    }
    $('#state_name').replaceWith(select); // it will replace what ever inside the id
  });
});
{'fraction_non_alphanumeric': 0.1562942008486563, 'fraction_numerical': 0.0007072135785007072, 'mean_word_length': 2.9957627118644066, 'pattern_counts': {'":': 8, '<': 20, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5931472', 'n_tokens_mistral': 892, 'n_tokens_neox': 858, 'n_words': 180}