Check out
- https://github.com/thoughtbot/guides/tree/master/style
- https://github.com/styleguide
- https://gist.github.com/bobbygrace/9e961e8982f42eb91b80
The following are key points
- Only use
unless
if there is noelse
- Indent
when
as deep ascase
- Use single quotes unless there is string interpolation
- Use the new hash syntax
{ key: 'value' }
- No trailing white space. Configure your editor to get rid of it
- Use soft-tabs with a two space indent
- If you are at all worried about deploying code in a branch, deploy the branch first and make sure it works before merging into master
- If assets change at all run
rake assets:precompile
locally and make sure it works and moves assets as expected - Use
format: /html/
in routes if you are missing templates for weird formats - Prefer
expect(thing).to
overthing.should
- Indent a maximum of three levels
- Follow http://smacss.com/
- Rebasing / squashing - https://www.evernote.com/shard/s54/sh/20b86177-637a-4af9-9866-bebd804ce79e/c9b94e6d27e03f54c21a6c38743ad04c
- Range issues: https://gist.github.com/r38y/6312196
- Custom 404 pages: https://gist.github.com/r38y/6345790
- CSRF: https://gist.github.com/r38y/6178603
- Use
format: /html/
insteadFunky formats: https://gist.github.com/r38y/5779440 - console.log fallback: https://gist.github.com/r38y/6312262
- Use magazine stuff from twinit in the other apps