<commit_before>require 'rubygems'
require 'sinatra'
require 'json'
require 'fileutils'

# copy rails.js file from src to vendor directory
source_file = File.join( File.dirname(__FILE__) ,  '..', 'src', 'rails.js')
dest_file = File.join(File.dirname(__FILE__), 'public', 'vendor', 'rails.js')
FileUtils.cp(source_file, dest_file)

after do
  ctype = request.xhr? ? 'application/json' : 'text/html'
  content_type ctype, :charset => 'utf-8'
end

get '/' do
  erb :index
end

get '/show' do
  if request.xhr?
    {:hello => :sexy, :request_env => request.env}.to_json
  else
    '/show requested without ajax'
  end<commit_msg>Copy src/rails.js into where it will be served up to the browser every time the index page is refreshed.<commit_after>require 'rubygems'
require 'sinatra'
require 'json'
require 'fileutils'

# copy rails.js file from src to vendor directory
source_file = File.join( File.dirname(__FILE__) ,  '..', 'src', 'rails.js')
dest_file = File.join(File.dirname(__FILE__), 'public', 'vendor', 'rails.js')
FileUtils.cp(source_file, dest_file)

after do
  ctype = request.xhr? ? 'application/json' : 'text/html'
  content_type ctype, :charset => 'utf-8'
end

get '/' do
  FileUtils.cp(source_file, dest_file)
  erb :index
end

get '/show' do
  if request.xhr?
    {:hello => :sexy, :request_env => request.env}.to_json
  else
    '/show requested without ajax'
  end
{'fraction_non_alphanumeric': 0.14296081277213352, 'fraction_numerical': 0.001451378809869376, 'mean_word_length': 4.365758754863813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4068015', 'n_tokens_mistral': 494, 'n_tokens_neox': 480, 'n_words': 137}