<commit_before>class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  helper_method :current_user

  before_action :set_time_zone

  protected

  def respond_with_json
    respond_to do |format|
      format.json { render json: yield }
    end
  end

  def not_found
    raise ActionController::RoutingError.new('Not found')
  end

  private

  def set_time_zone
    Time.zone = find_time_zone
  end

  def find_time_zone
    if current_user.try(:time_zone).present?
      current_user.time_zone
    else
      ActiveSupport::TimeZone[-cookies[:timezone].to_i.minutes]
    end
  end

  def current_user
    @current_user ||= User.find(session[:user_id]) if session[:user_id]
  rescue Mongoid::Errors::DocumentNotFound
    nil<commit_msg>Remove useless method<commit_after>class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  helper_method :current_user

  before_action :set_time_zone

  protected

  def respond_with_json
    respond_to do |format|
      format.json { render json: yield }
    end
  end

  private

  def set_time_zone
    Time.zone = find_time_zone
  end

  def find_time_zone
    if current_user.try(:time_zone).present?
      current_user.time_zone
    else
      ActiveSupport::TimeZone[-cookies[:timezone].to_i.minutes]
    end
  end

  def current_user
    @current_user ||= User.find(session[:user_id]) if session[:user_id]
  rescue Mongoid::Errors::DocumentNotFound
    nil
{'fraction_non_alphanumeric': 0.07484828051247472, 'fraction_numerical': 0.0, 'mean_word_length': 3.865573770491803, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4542199', 'n_tokens_mistral': 475, 'n_tokens_neox': 458, 'n_words': 99}