<commit_before>module ProjectsHelper
  def github_select
    # List original then forked Github projects, with headers
    fork_repos, original_repos = fork_and_original
    original_header(original_repos) + original_repos +
      fork_header(fork_repos) + fork_repos
  end

  def fork_and_original
    github = Github.new oauth_token: session[:user_token]
    repo_data = github.repos.list.map do |repo|
      [repo.full_name, repo.fork, repo.html_url]
    end
    repo_data.partition { |repo| repo[1] } # partition on fork
  end

  def original_header(original_repos)
    original_repos.blank? ? [] : [['=> Original Github Repos', '', 'none']]
  end

  def fork_header(fork_repos)
    fork_repos.blank? ? [] : [['=> Forked Github Repos', '', 'none']]
  end
end
<commit_msg>Support Github auto-pagination; closes #110<commit_after>module ProjectsHelper
  def github_select
    # List original then forked Github projects, with headers
    fork_repos, original_repos = fork_and_original
    original_header(original_repos) + original_repos +
      fork_header(fork_repos) + fork_repos
  end

  def fork_and_original
    github = Github.new oauth_token: session[:user_token], auto_pagination: true
    repo_data = github.repos.list.map do |repo|
      [repo.full_name, repo.fork, repo.html_url]
    end
    repo_data.partition { |repo| repo[1] } # partition on fork
  end

  def original_header(original_repos)
    original_repos.blank? ? [] : [['=> Original Github Repos', '', 'none']]
  end

  def fork_header(fork_repos)
    fork_repos.blank? ? [] : [['=> Forked Github Repos', '', 'none']]
  end
end

{'fraction_non_alphanumeric': 0.1091703056768559, 'fraction_numerical': 0.0031191515907673115, 'mean_word_length': 4.044025157232705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3719902', 'n_tokens_mistral': 562, 'n_tokens_neox': 516, 'n_words': 122}