Created
March 4, 2014 14:39
-
-
Save SeanRoberts/9347648 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ruby/Rails | |
- Use latest stack (Ruby 2.1.x, Rails 4.x, Postgresql) | |
- Prefer the new hash syntax, but use the old one when necessary (ie. when you need to use strings as keys) | |
- Code in ActiveRecord models should pertain directly to storing or retrieving data | |
- Use Draper to decorate model instances and test your decorators with RSpec (app/decorators is the place for this) | |
- Put business logic into service classes and test them with RSpec (app/services is a fine place for this, you can get more specific if your services folder gets fat) | |
- I like to name my service classes after what they do, or give them cute names occasionally (AddsProductstoCart or CartStuffer) | |
- Don’t hesitate to namespace related models or services into modules. | |
- Use Resque and Redis for background job handling. | |
HTML | |
- Use Profound grid for your layout, Jamie can furnish you with a starting point | |
- Write your skeletal layout code before digging into your CSS (aka content-first approach) | |
- Keep templates small. Use partials and put heavy logic into decorators or helpers. | |
CSS | |
- Separate concerns by files. Take a look at how Jamie has organized McHattie’s CSS. | |
- Target elements by classes or nested selectors, save IDs for Javascript | |
Javascript | |
- Write CoffeeScript | |
- Use the dispatcher pattern to write page-specific Javascript. Don’t put any Javascript in your templates ever. | |
- Use data tags to ferry information from the server-side to Javascript. | |
- Write features as CoffeeScript classes and namespace them under APP.features. | |
- Keep methods under 5ish lines. | |
- Keep files under 100ish lines. | |
- Write classes with an interface. “Private” methods should begin with an underscore. | |
- Variables that refer to a jQuery object should start with a $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment