Skip to content

Instantly share code, notes, and snippets.


Jyothu Mannarkkad jyothu

View GitHub Profile
View import.rb
# Refactor this!
def import(file, partner)
raise if filepath[-3..-1] != 'csv'
CSV.foreach(filepath, headers: true, header_converters: CSV::HeaderConverters[:symbol]) do |row|
order = Order.find_or_initialize_by(partner_order_number: row["order_number"])
location = Location.find_by(location_number: row["location_number"])
customer = Customer.find_by(email: customer_profile.customer_id)
View denominations.rb
# Given an amount like 57 cents
# return how many of each denomination needed to make that total
# these are the denominations:
# 1 cent, 5 cent, 10 cent, 25 cent
jyothu / vehicle.rb
Created Mar 25, 2019
Implement count method - Usage of class variable & instance variable
View vehicle.rb
class Vehicle
class Car < Vehicle
class Bus < Vehicle
class Jeep < Vehicle