<commit_before>#  Copyright (C) 2013, 2014, 2015 Dr. <NAME>  (<EMAIL>, <EMAIL>)
#  Licensed under the terms of the GNU Affero General Public License v3.
#  See the LICENSE.txt file provided with this software.

module ApplicationHelper

  def convert_anygit_to_https_url(url)
    url \
      .gsub(/^\w*@?((\w+\.)+\w+):/, 'https://\\1/') \
      .gsub(/\.git$/, '') \
      .gsub(/\/$/, '')
  end

  def gravatar_url(email)
    hs = Digest::MD5.hexdigest email.squish.downcase
    "http://www.gravatar.com/avatar/#{hs}?s=20&d=retro"
  end

  def form_group(label, opts = {}, &block)
    control_id = (opts[:control_id] || SecureRandom.uuid)
    render 'form_group', label: label,
                         control_id: control_id,
                         cols_label: (opts[:cols_label] || 3),
                         label_class: (opts[:label_class] || ''),
                         cols_control: (opts[:cols_control] || 5),
                         block_output: capture(opts.merge(control_id: control_id), &block)
  end

  def git_icon_for_url(url)
    case
    when url =~ /github\.com/
      'fa fa-github'<commit_msg>Switch gravatar url to https<commit_after>#  Copyright (C) 2013, 2014, 2015 Dr. <NAME>  (<EMAIL>, <EMAIL>)
#  Licensed under the terms of the GNU Affero General Public License v3.
#  See the LICENSE.txt file provided with this software.

module ApplicationHelper

  def convert_anygit_to_https_url(url)
    url \
      .gsub(/^\w*@?((\w+\.)+\w+):/, 'https://\\1/') \
      .gsub(/\.git$/, '') \
      .gsub(/\/$/, '')
  end

  def gravatar_url(email)
    hs = Digest::MD5.hexdigest email.squish.downcase
    "https://www.gravatar.com/avatar/#{hs}?s=20&d=retro"
  end

  def form_group(label, opts = {}, &block)
    control_id = (opts[:control_id] || SecureRandom.uuid)
    render 'form_group', label: label,
                         control_id: control_id,
                         cols_label: (opts[:cols_label] || 3),
                         label_class: (opts[:label_class] || ''),
                         cols_control: (opts[:cols_control] || 5),
                         block_output: capture(opts.merge(control_id: control_id), &block)
  end

  def git_icon_for_url(url)
    case
    when url =~ /github\.com/
      'fa fa-github'
{'fraction_non_alphanumeric': 0.15752212389380532, 'fraction_numerical': 0.016814159292035398, 'mean_word_length': 2.272069464544139, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, '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': '7299044', 'n_tokens_mistral': 808, 'n_tokens_neox': 749, 'n_words': 165}