Skip to content

Instantly share code, notes, and snippets.

View dwmoore's full-sized avatar
😎

Dave Moore dwmoore

😎
View GitHub Profile
@wojteklu
wojteklu / clean_code.md
Last active January 20, 2026 11:58
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@dwmoore
dwmoore / ar_module_spec.rb
Created January 10, 2018 17:05
Testing Ruby modules included on and making use of ActiveRecrord Model functionality in RSpec
# Recently I had need to work on an ActiveRecord model
# that gained much of its functionality through the
# inclusion of a Ruby Module. Over the course of the
# work, I found that many of the models that include
# the module also included duplicated specs to cover
# the inherited behavior.
#
# Of course, this isn't ideal.
#
# In a perfect world, the module's behavior would be