<commit_before>#encoding: utf-8
require 'sqlite3'
require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'


def init_db
	@db = SQLite3::Database.new 'leprozorium.db'
	@db.results_as_hash = true

end

configure do
	init_db
	@db.execute 'CREATE TABLE IF NOT EXISTS
		  Posts 
		  	(
		  		id INTEGER PRIMARY KEY AUTOINCREMENT,
		  		created_date DATE,
		  		content TEXT
		  	)'
end

before do
	init_db
end
get '/' do
	erb "Hello! <a href=\"https://github.com/bootstrap-ruby/sinatra-bootstrap\">Original</a> pattern has been modified for <a href=\"http://rubyschool.us/\">Ruby School</a>"			
end


get '/new' do

	erb :new
end
post "/new" do
	content = params[:content]
		if content.length <= 0
			@error = 'Type post text'
			return erb :new	
		end	
	erb " #{content}"
end<commit_msg>Save content to database<commit_after>#encoding: utf-8
require 'sqlite3'
require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'


def init_db
	@db = SQLite3::Database.new 'leprozorium.db'
	@db.results_as_hash = true

end

configure do
	init_db
	@db.execute 'CREATE TABLE IF NOT EXISTS
		  Posts 
		  	(
		  		id INTEGER PRIMARY KEY AUTOINCREMENT,
		  		created_date DATE,
		  		content TEXT
		  	)'
end

before do
	init_db
end
get '/' do
	erb "Hello! <a href=\"https://github.com/bootstrap-ruby/sinatra-bootstrap\">Original</a> pattern has been modified for <a href=\"http://rubyschool.us/\">Ruby School</a>"			
end


get '/new' do

	erb :new
end
post "/new" do
	content = params[:content]
		if content.length <= 0
			@error = 'Type post text'
			return erb :new	
		end
		@db.execute 'insert into Posts (created_date,content) values (datetime(),?)',[content] 

	erb " #{content}"
end













{'fraction_non_alphanumeric': 0.12382075471698113, 'fraction_numerical': 0.0047169811320754715, 'mean_word_length': 3.329081632653061, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '5402621', 'n_tokens_mistral': 686, 'n_tokens_neox': 615, 'n_words': 173}