Skip to content

Instantly share code, notes, and snippets.

View arjunrajkumar's full-sized avatar
🎯
Focusing

arjun.rajkumar arjunrajkumar

🎯
Focusing
  • Bangalore, India
View GitHub Profile
@arjunrajkumar
arjunrajkumar / learnings_2020.md
Last active November 14, 2020 01:52
Learnings from 9 months at a startup.

Learnings from 9 months at a startup.

  • Your team mates shouldn’t have to read the PRD to get context about code they are reviewing. Name methods, variables, files in a way that gives more clarity to what it’s doing.
  • Focus on reducing request times. This can be done by moving non critical tasks to background jobs.
  • Related to this: Show something is being done to the customer ASAP while you do the main work in the background.
  • It’s good to challenge product teams requirements in the ideation phase as product folks don’t always think about (or may not be aware of) performance while deciding on upcoming features. Developers should call out things that could lead to poor performance.
  • While coding, avoid loops/iterating thru all to do calculations. Related: careful loading all records from DB. Example: to check if atleast 10 records exists, use User.first(10).size instead of User.count
  • If you have to update a lot of users manually, try doing it in real time instead of a rake task. Trigger the update
module ShopifyWrapper
class Download
attr_reader :response, :error_message
def initialize(response, error_message)
@response = response
@error_message = error_message
end
def self.all_products(options={})
ShopifyWrapper.activate_session(options[:shop].shopify_domain, options[:shop].shopify_token)
begin

Ruby notes

Everything is an object

Everything - including integers, strings are objects.

For example, in Ruby: -10.abs => 10

Only because '-10' is an object we could call the 'abs' method on it - instead of calling it like a normal function abs(-10).