Today I Learned

TIL, 2017-02-22

  • There are only so many ways to write an API, or do other Rails basic tasks, but at least try to optimize each of those “basic” tasks to make it second nature.
  • Enumerable#find will return nil if an applicable key cannot be found. So in if excess_attributes = attribute_keys.find { |k| !editable_attributes.include?(k) }, we can assign an excess_attributes variable inside the if statement scope, and do not enter the if conditional if editable_attributes did not return anything.
  • I’m sort of reading the Gitlab source code now, not to memorize, but to see things and if I see how it works, I might add it to my knowledge, or at least get me somewhere.
  • Found this from Brunch mailing list. Takeaways: Readable code, be more stringent when thinking of edge cases, the attitude around tests (there is literally no company which has the job description, “must have never written a unit test”), and understanding why you make decisions–not with “it’s the right way to do it”. Also: “Developers that get excited about the latest client side technologies or the ability to spin things up in the cloud are a dime a dozen (at least, inasmuch as developers can be considered a dime a dozen). Developers that get excited about these things and understand how they can make money with them are much rarer.” Always think of code, and why you do the code, from the business standpoint.
  • ActiveSupport::Rescuable.

This project is maintained by daryllxd