<commit_before># encoding: utf-8

class AvatarUploader < CarrierWave::Uploader::Base

  AVATAR_SIZE = 64
  DEFAULT_AVATAR_URL = "http://#{MY_DOMAIN}/images/default-avatar.png"

  include CarrierWave::MiniMagick
  process :resize_and_pad => [AVATAR_SIZE, AVATAR_SIZE]

  def base_dir
    Rails.root.join("uploads")
  end

  def url
    super.sub(base_dir.to_s, "//#{IMG_DOMAIN}")
  end

  def store_dir
    partition = ("%09d" % model.id).scan(/\d{3}/).reverse.join("/")
    base_dir.join "avatars/#{partition}"
  end

  def filename
    "avatar.#{file.extension}" if original_filename
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end
<commit_msg>Allow SVG for avatars<commit_after># encoding: utf-8

class AvatarUploader < CarrierWave::Uploader::Base

  AVATAR_SIZE = 64
  DEFAULT_AVATAR_URL = "http://#{MY_DOMAIN}/images/default-avatar.png"

  include CarrierWave::MiniMagick
  process :resize_and_pad => [AVATAR_SIZE, AVATAR_SIZE]

  def base_dir
    Rails.root.join("uploads")
  end

  def url
    super.sub(base_dir.to_s, "//#{IMG_DOMAIN}")
  end

  def store_dir
    partition = ("%09d" % model.id).scan(/\d{3}/).reverse.join("/")
    base_dir.join "avatars/#{partition}"
  end

  def filename
    "avatar.#{file.extension}" if original_filename
  end

  def extension_white_list
    %w(jpg jpeg gif png svg)
  end

{'fraction_non_alphanumeric': 0.13622754491017963, 'fraction_numerical': 0.008982035928143712, 'mean_word_length': 3.792114695340502, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4417786', 'n_tokens_mistral': 533, 'n_tokens_neox': 510, 'n_words': 96}