This is the official guide on how to write code for millioncities.com
PHP / HTML / JAVASCRIPT (jQuery)Laravelphp mvc frameworkBackbonejs mvcLessinstead of cssGrunt(node js based task manager)Gitfor version controlTrellostore things todo
- Use
camelCase(first letter small) for variable and function names - Prefix jQuery variables is $, eg.
var $someSelector = $("#selectById") - Make sure your code lints (check the jshint configuration for more details)
- Use dashes on html attributes and css class names
- Use
_(underscore) for variable names, eg.$new_var - Class names should use
CamelCasewith first letter capital - Functions and methods should use
camelCase
- Use snake case for column and table names
Always comment using double slash //, never use multiline comments on any file (JS, PHP, LESS etc.).
This allows to docco to parse the comments and create a documentation.
Be as expressive as you can on the comments (always write code as if the coder afterwards is a crazy phycopath)
How to write comments for docco?
Docco parses comments according to markdown syntax. For more details on docco check their homepage. Also check out a demo of the kind of docs produced by docco. Most commonly used markdown notation:
**Word**for bold*Word*for italics- For
<h1>headers write write the header commentH1 Headerfollowed by========on the next line - For
<h2>headers write write the header commentH2 Headerfollowed by--------on the next line [link text](http://www.somelink.com)for links
- Name files using
camelCaseas in javascript
NOTE: always follow library conventions if neccessary (eg. Laravel file naming) Note: the above conventions do not apply to downloaded libraries which should remain as they are