Git Product home page Git Product logo

uonline's Introduction

uonline

A browser-based MMORPG in a fantasy world.

Build Status Coverage Status Dependency Status devDependency Status Planned tasks

Issue Stats PR Stats

Requirements

  • Node.js 0.10 or higher with npm;
  • CoffeeScript;
  • Gulp;
  • Bower;
  • PostgreSQL 9.1 or higher.

uonline expects environment variables DATABASE_URL and DATABASE_URL_TEST to be set. If they are not, it will use following default credentials. You'll probably find it convinient to make the dev environment match them.

  • Hostname localhost;
  • DB user anonymous with password nopassword;
  • Databases: uonline and uonline_test.

How to set up

  • Clone the repo.
  • Run script/setup. Please note that it expects database credentials to be set. Also, it will try to create databases if they don't exist.

By the way, running script/update will update the stuff like dependencies and DB revisions. You typically use it after every pull.

How to run

Run script/run.

There are also some alternatives:

  • foreman start if you want to simulate Heroku environment.
  • ./main.coffee for plain run.
  • make monitor to automatically restart server on changes.

The following environment variables are recognized:

  • IP, PORT — IP and port to listen;
  • DATABASE_URL, DATABASE_URL_TEST — database credentials;
  • SQLPROF=true — show SQL timings in console;
  • NOCSP — don't output CSP header;
  • NEW_RELIC_LICENSE_KEY — you don't need this.

Scripts

This project uses Scripts to Rule Them All for performing routine tasks. All scripts except console are supported.

Gulp hints

Run gulp to check and test your code. It will lint your code, run tests, show coverage stats and so on. Please run it before every commit.

Useful subtasks:

  • gulp check — only lint;
  • gulp build — build static assets;
  • gulp watch — same as gulp build, but works automagically.
  • gulp test — run unittests without additional checks.

Useful options:

  • gulp test --single health-check.coffee — run only one testsuite;
  • gulp test --reporter verbose — use other reporter.

Programmers' guidelines

  • Use tabs, not spaces. Don't mix them and don't use smarttabs.
  • Prefer single quotes. Use double quotes when you need to escape ' itself.
  • Place use strict in every file.
  • Don't omit extension while requiring: require('./utils.js');.
  • Sync is better than async. Async is better than callbacks.
  • Write tests for everything.
  • Write good assert comments: they should answer the question "What do this function should do?".
  • Keep things outside of main thread: use asynchronous API. And remember: fs.readFile.sync() is way better than fs.readFileSync().

CoffeeScript-specific

  • Use ? when checking for null or undefined: if error? then ....
  • Leave two empty lines between function definitions.
  • -> is preferred, () -> is acceptable.
  • Use interpolation instead of concatenation.
  • Use unless instead of if not. Don't use unless ... else at all.
  • Use is instead of == when you don't mean calculations.
  • Overall: don't try to make CS look like JS.

JS-specific

  • Use if (!!something) when checking for null or undefined.
  • Use semicolons even if they're optional.
  • Place figure brackets on the same line when you declare an anonymous function and on separate line otherwise.
exports.closeSession = function(dbConnection, sess, callback) {
	if (!sess)
	{
		callback(undefined, 'Not closing: empty sessid');
	}
	else
	{
		dbConnection.query(
			'UPDATE `uniusers` SET `sessexpire` = NOW() WHERE `sessid` = ?',
			[sess], callback);
	}
};
  • Use trailing commas. Place them even after last element — it allows you to swap lines easily.
var numbers = [
  1,
  2,
  3,
  4,
];

uonline's People

Contributors

3bl3gamer avatar houjing avatar m1kc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

uonline's Issues

About

[1:02:00] m1kc: Так вот. Как ты мог заметить, свеpху есть pаздел "Об игpе".
[1:02:22] m1kc: Как ты мог догадаться своим пpоницательным умом, там будет что-то написано.
[1:03:32] m1kc: Так вот, нужно вкpатце pассказать о наших планах. Для кого игpа, что в ней будет особенного, какие фишки там будут, каким будет миp, игpовой пpоцесс и так далее.
[1:04:27] Dagon: побыть политиком?
[1:04:34] m1kc: Скоpее идеологом.

Хуйня с сессиями

почему-то, если заходить с нуля или когда сессия давно истекла, то в скрипте логина после update инструкции дата истечения сессии обновляется нормально и если её сразу же в скрипте получать, она будет уже обновлённой, и так из любого скрипта и сразу.

через 3 секунды после удачного логина/разлогина мы перемещаемся на главную страницу где видим результат логина/разлогина, но если без перерыва это делать, то запрос даты истечения сессии ещё в login или logout первый раз возвращает обновлённое значение, а в index скрипте - ещё необновлённое значение времени.

что за поведение такое?

Довести index до ума

  • Какие ещё нахуй section? instance.
  • Нахуй там два массива?
  • Кешиpование должно включаться из конфига
  • Дефолтный instance должен задаваться в конфиге
  • Нахуй там pаздельно $se и $instance?
  • Хули блядь сессия не сама обновляется?
  • Если не знаю такой instance, выходить с ошибкой. Хули блядь такого у тебя нет?
  • Что за блядская pеализация pедиpектов?
  • Отсечение "/" в конце

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.