- Your class can be no longer than a hundred lines of code.
- Your methods can be no longer than five lines of code
- You can pass no more than four parameters and you can't just make it one big hash.
- In your controller, you can only instantiate one object, to do whatever it is that needs to be done.
- Your view can only know about one instance variable.
- Your Rails view should only send messages to that object i.e., no Demeter violations.[ "thunder dome principal". Translated: one model in, one model out! ]
- Rules are meant to be broken if by breaking them you produce better code. [ ...where "better code" is validated by explaining why you want to break the rule to someone else. ]
This file contains 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
# For context, this was inspired by the RubyRogues podcast #79 where they talked about | |
# documentation in Ruby, and specifically grumbled quite a bit about the failings of RDoc. | |
# | |
# http://rubyrogues.com/079-rr-documenting-code/ | |
# | |
# As someone who's spent a lot of time using an IDE for programming C# and Java, I think | |
# Ruby could do a lot better at putting documentation at our fingertips as we program. | |
# | |
# Maybe making the documentation part of the structure of the code would facilitate this? | |
# |
This file contains 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
require 'factory_girl_rails' | |
require 'rspec' | |
require 'rspec-rails' | |
require 'rspec/mocks/standalone' # => if factories need stubs (for remote services for example) | |
include FactoryGirl::Syntax::Methods # make FG methods available at top level, so you can do `> create :user` | |
def reload_factories! | |
FactoryGirl.instance_variable_set(:@factories, nil) # => clear loaded factories/sequences | |
# FactoryGirl.instance_variable_set(:@sequences, nil) |
Was asked to look at this thing again; only reviewed the JS portion. Last I checked, the CSS was similarly reality-challenged. Graphics are nice, but are tantamount to the paint job on a used car. Under the hood, this thing is all junk. It's hard to imagine the innards of any Web or mobile device-based application would end up like this, which raises the question of whether the authors have ever written such applications (or any amount of meaningful JS).
/**
* @class Ext
* @singleton
There (still) are no "classes" or "singletons" in JS (starting off on the wrong foot by mangling JS terms).
This file contains 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
" Settings | |
set noautofocus | |
set cncpcompletion | |
set nosmoothscroll | |
set nohud | |
set autohidecursor | |
set typelinkhints | |
let scrollduration = 10 | |
let searchlimit = 40 |
This file contains 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
#!/bin/bash | |
# | |
# This script will mount /Users in the boot2docker VM using NFS (instead of the | |
# default vboxsf). It's probably not a good idea to run it while there are | |
# Docker containers running in boot2docker. | |
# | |
# Usage: sudo ./boot2docker-use-nfs.sh | |
# |