This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Reviewer | |
def name | |
puts "Hi. This is Reviewer" | |
super rescue nil | |
end | |
end | |
module Manager | |
def name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Developer | |
def name | |
puts "Hi. This is Developer" | |
end | |
end | |
module Analyst | |
def name | |
puts "Hi. This is Analyst" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Developer | |
def name | |
puts "Hi. This is Developer" | |
end | |
end | |
module Analyst | |
def name | |
puts "Hi. This is Analyst" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Developer | |
def name | |
puts "Hi. This is Developer" | |
end | |
end | |
class Employee | |
def name | |
puts "Hi. This is Employee" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example for send | |
'brug'.split('') | |
'brug'.class.ancestors | |
# ==================================================== | |
# LEVEL 0 | |
class Employee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |