Skip to content

Instantly share code, notes, and snippets.

View srinidhi-lwt's full-sized avatar
🎯
Focusing

Srinidhi G S srinidhi-lwt

🎯
Focusing
View GitHub Profile
@srinidhi-lwt
srinidhi-lwt / bug_fixing_and_collaboration.txt
Last active July 8, 2019 20:45
Bug fixing and Collaboration
# BUG FIXING
1. First of all, I would look into the line number where the code has been broken and what is the exception thrown.
Stack trace helps us to know how this erroneous method is executed. This gives me a context of the issue.
2. Second, I would access the page or action as a customer/admin to know where and when we are facing this issue.
We need to know how the error occurred by doing this. Otherwise, we need to reproduce the error.
We get the frequency and severity of the issue or the bug by reproducing it.
3. Remember, that we need to understand the system before changing the code.
resources :questions, only: [:index, :show] do
resources :feedbacks, only: :show do
put '/acknowledge' => 'feedbacks#acknowledge'
post '/converse' => 'feedbacks#converse'
put '/resolve' => 'feedbacks#resolve'
end
end
@srinidhi-lwt
srinidhi-lwt / set_checker.rb
Last active July 8, 2019 20:19
Set Checker
def set?(*cards)
shapes = cards.map(&:shape).uniq
colours = cards.map(&:colour).uniq
fills = cards.map(&:fill).uniq
count = cards.map(&:count).uniq
[shapes, colours, fills, count].all? do |attribute|
attribute.length.odd?
end
end
@srinidhi-lwt
srinidhi-lwt / code_example_4.rb
Created June 10, 2019 20:19
Ruby Method Hierarchy
module Reviewer
def name
puts "Hi. This is Reviewer"
super rescue nil
end
end
module Manager
def name
@srinidhi-lwt
srinidhi-lwt / code_example_3.rb
Last active June 10, 2019 20:11
Ruby Method Hierarchy
module Developer
def name
puts "Hi. This is Developer"
end
end
module Analyst
def name
puts "Hi. This is Analyst"
end
@srinidhi-lwt
srinidhi-lwt / code_example_2.rb
Last active June 10, 2019 20:51
Ruby Method Hierarchy
module Developer
def name
puts "Hi. This is Developer"
end
end
module Analyst
def name
puts "Hi. This is Analyst"
end
@srinidhi-lwt
srinidhi-lwt / code_example_1.rb
Last active June 10, 2019 19:14
Ruby Method Hierarchy.
module Developer
def name
puts "Hi. This is Developer"
end
end
class Employee
def name
puts "Hi. This is Employee"
end
@srinidhi-lwt
srinidhi-lwt / code_example.rb
Last active May 17, 2019 09:29
BRUG MAY 2019 - Code Examples
# example for send
'brug'.split('')
'brug'.class.ancestors
# ====================================================
# LEVEL 0
class Employee
class InterviewTest
def balanced?(string)
return false if string.length.odd? or string.blank?
res = []
string.split('').each do |char|
if opening_brackets.include?(char)
res << char
elsif matching_brackets[res[-1]] == char
res.pop