<commit_before>require 'sinatra'
require 'twitter'
require 'tzinfo'
require 'sinatra-logentries'
require_relative 'lib/twitter_integration'
require_relative 'helpers/view_helper'

configure { Sinatra::Logentries.token = ENV['LOGENTRIES_TOKEN'] }
DEFAULT_LAYOUT = :'layouts/default.html'

get '/' do
  twitter = TwitterIntegration.new; user = ENV['TWITTER_USERNAME']
  options = {:count => 100, :include_rts => false, :exclude_replies => true}
  
  erb :'home.html', :layout => DEFAULT_LAYOUT, :locals => {:tweets => twitter.client.user_timeline(user, options), :helper => ViewHelper}
end

get '/:things' do
  erb :'not_found.html', :layout => DEFAULT_LAYOUT, :locals => {:things => params[:things]}
end

not_found do
  erb :'not_found.html', :layout => DEFAULT_LAYOUT
end<commit_msg>Enhance app.rb for using Instagram integration<commit_after>require 'sinatra'
require 'twitter'
require 'tzinfo'
require 'sinatra-logentries'
require 'tilt/erb'
require_relative 'lib/twitter_integration'
require_relative 'lib/instagram_integration'
require_relative 'helpers/view_helper'
require_relative 'helpers/application_helper'

configure { Sinatra::Logentries.token = ENV['LOGENTRIES_TOKEN'] }
DEFAULT_LAYOUT = :'layouts/default.html'

get '/' do
  twitter = TwitterIntegration.new
  instagram = InstagramIntegration.new
  timeline =
      ApplicationHelper.merge_timelines(
          twitter.client.user_timeline(twitter.user_name, twitter.options),
          instagram.media
      )
  ApplicationHelper.remove_instagram_duplicates_from(timeline)
  erb :'home.html', :layout => DEFAULT_LAYOUT, :locals => {:timeline => timeline, :helper => ViewHelper}
end

get '/:things' do
  erb :'not_found.html', :layout => DEFAULT_LAYOUT, :locals => {:things => params[:things]}
end

not_found do
  erb :'not_found.html', :layout => DEFAULT_LAYOUT
end
{'fraction_non_alphanumeric': 0.12950819672131147, 'fraction_numerical': 0.001639344262295082, 'mean_word_length': 5.857677902621723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '266632', 'n_tokens_mistral': 617, 'n_tokens_neox': 597, 'n_words': 126}