<commit_before>require 'sinatra'
require 'slim'
require 'coffee-script'

enable :inline_templates

get '/' do

end

get '/src/monkey.js' do
  # ghetto live reload
  if ENV['AUTORELOAD']
    `cake build`
    `cake build:parser`
    `cake build:browser`
  end
  File.read("./extras/monkey.js")
end

get '/src/:name.coffee' do |name|
  CoffeeScript.compile(File.read("./examples/#{name}.coffee"))
end

get '/src/:name.js' do |name|
  File.read("./examples/#{name}.js")
end

get '/:name' do |name|
  @name = name
  slim :thingy
end

__END__

@@ thingy
doctype html
html
  head
    script[src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"]<commit_msg>List examples on index page<commit_after>require 'sinatra'
require 'slim'
require 'coffee-script'

enable :inline_templates

get '/' do
  @examples = Dir.glob('examples/*.{js,coffee}').map { |e| e.split('/').last }
  slim :index
end

get '/src/monkey.js' do
  # ghetto live reload
  if ENV['AUTORELOAD']
    `cake build`
    `cake build:parser`
    `cake build:browser`
  end
  File.read("./extras/monkey.js")
end

get '/src/:name.coffee' do |name|
  CoffeeScript.compile(File.read("./examples/#{name}.coffee"))
end

get '/src/:name.js' do |name|
  File.read("./examples/#{name}.js")
end

get '/:name' do |name|
  @name = name
  slim :show
end

__END__

@@ index
doctype html
html
  head
  body
    - @examples.each do |example|
      p
        a[href="/#{example}"] = example

@@ show
doctype html
html
  head
    script[src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"]
{'fraction_non_alphanumeric': 0.1737179487179487, 'fraction_numerical': 0.0038461538461538464, 'mean_word_length': 3.4472934472934473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5125717', 'n_tokens_mistral': 625, 'n_tokens_neox': 607, 'n_words': 133}