<commit_before>require 'sinatra/base'

module Sinatra
  module ViewHelper
    module Helpers
      def body_class(body)
        body ? body : nil
      end

      def versioned_stylesheet(stylesheet)
        "/stylesheets/#{stylesheet}.css?" + File.mtime(File.join("public", "stylesheets", "#{stylesheet}.css")).to_i.to_s
      end

      def versioned_javascript(js)
        "/javascript/#{js}.js?" + File.mtime(File.join("public", "javascript", "#{js}.js")).to_i.to_s
      end

      def is_admin?(email)
        if ENV['PRIMARY_DOMAINS'].nil?
          false
        else
          domains = ENV['PRIMARY_DOMAINS'].split(",").map(&:strip)
          domains.any? { |domain| email.include?(domain) }
        end
      end
    end

    def self.registered(app)
      app.helpers ViewHelper::Helpers
    end
  end

  register ViewHelper
end<commit_msg>Ensure the PRIMARY_DOMAINS variable is optional<commit_after>require 'sinatra/base'

module Sinatra
  module ViewHelper
    module Helpers
      def body_class(body)
        body ? body : nil
      end

      def versioned_stylesheet(stylesheet)
        "/stylesheets/#{stylesheet}.css?" + File.mtime(File.join("public", "stylesheets", "#{stylesheet}.css")).to_i.to_s
      end

      def versioned_javascript(js)
        "/javascript/#{js}.js?" + File.mtime(File.join("public", "javascript", "#{js}.js")).to_i.to_s
      end

      def is_admin?(email)
        if ENV['PRIMARY_DOMAINS'].blank?
          false
        else
          domains = ENV['PRIMARY_DOMAINS'].split(",").map(&:strip)
          domains.any? { |domain| email.include?(domain) }
        end
      end
    end

    def self.registered(app)
      app.helpers ViewHelper::Helpers
    end
  end

  register ViewHelper
end
{'fraction_non_alphanumeric': 0.13218390804597702, 'fraction_numerical': 0.0, 'mean_word_length': 2.567622950819672, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1024448', 'n_tokens_mistral': 561, 'n_tokens_neox': 550, 'n_words': 106}