<commit_before>http = require 'http'
express = require 'express'
redis = require 'redis'
bcrypt = require 'bcrypt'
async = require 'async'
require 'express-namespace'
require 'sugar'

request = require 'request'

{BattleServer, ConnectionServer} = require './server'

server = new BattleServer()
app = express()
httpServer = http.createServer(app)

# Configuration
app.set("views", "client")
app.use(express.logger())
app.use(express.compress())  # gzip
app.use(express.bodyParser())
app.use(express.methodOverride())
app.use(app.router)
app.use(express.static(__dirname + "/public"))

process.env.NODE_ENV ||= "development"

PORT = process.env.PORT || 8000


# User store
if process.env.REDIS_DB_URL
  parts = require("url").parse(process.env.REDIS_DB_URL)
  db = redis.createClient(parts.port, parts.hostname)
  db.auth(parts.auth.split(":")[1])  if parts.auth
else
  db = redis.createClient()

# Routing
app.get '/', (req, res) ->
  {PokemonData, MoveData, ItemData} = require './data/bw'
  local = process.env.NODE_ENV in [ 'development', 'test' ]
  res.render 'index.jade', {local, PokemonData, MoveData, ItemData}
<commit_msg>Small refactor<commit_after>http = require 'http'
express = require 'express'
redis = require 'redis'
bcrypt = require 'bcrypt'
async = require 'async'
require 'express-namespace'
require 'sugar'

request = require 'request'

{BattleServer, ConnectionServer} = require './server'

server = new BattleServer()
app = express()
httpServer = http.createServer(app)

# Variables
process.env.NODE_ENV ||= "development"
PORT = process.env.PORT || 8000

# Connect to redis
if process.env.REDIS_DB_URL
  parts = require("url").parse(process.env.REDIS_DB_URL)
  db = redis.createClient(parts.port, parts.hostname)
  db.auth(parts.auth.split(":")[1])  if parts.auth
else
  db = redis.createClient()

# Configuration
app.set("views", "client")
app.use(express.logger())
app.use(express.compress())  # gzip
app.use(express.bodyParser())
app.use(express.methodOverride())
app.use(app.router)
app.use(express.static(__dirname + "/public"))

# Routing
app.get '/', (req, res) ->
  {PokemonData, MoveData, ItemData} = require './data/bw'
  local = process.env.NODE_ENV in [ 'development', 'test' ]
  res.render 'index.jade', {local, PokemonData, MoveData, ItemData}

{'fraction_non_alphanumeric': 0.1600175361683472, 'fraction_numerical': 0.004384042086804033, 'mean_word_length': 5.252054794520548, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, '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': '554483', 'n_tokens_mistral': 785, 'n_tokens_neox': 772, 'n_words': 171}