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
We Are The Nerds: The Birth and T... █░░░░░░░░░░░░ 8% | |
Games People Play ████▍░░░░░░░░ 34% | |
System Design Interview – An insi... ██████▌░░░░░░ 50% | |
Designing Data-Intensive Applicat... ████████░░░░░ 62% | |
Ego Is the Enemy ███▎░░░░░░░░░ 25% |
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
🏆 814 Contributions in year 2024 | |
📦 Used 352 MB in GitHub's Storage | |
📜 10 Public Gists | |
🔑 1 Public Keys | |
🚫 Not opted to Hire |
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
Runner.instance_.gameOver = () => {}; | |
Runner.instance_.currentSpeed = 50; |
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 UserSalary < ApplicationRecord | |
attr_reader :a_but_different_name, | |
:b, | |
:c | |
end | |
class JobListing < ApplicationRecord | |
attr_reader :a, | |
:b_but_different_name, | |
:c |
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 PopularSalariesQuery | |
def all | |
# return data in whatever shape is needed | |
end | |
end | |
# Somewhere in the controller | |
@data = PopularSalariesQuery.new.all |
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 Title | |
def initialize(title) | |
@title = title | |
end | |
def to_seniority | |
@title.include?('junior') ? 'junior' : nil | |
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
#=> better code (hiding implementation details with abstractions) | |
STATUS_EMPTY_CART = Status.new(false, "empty cart") | |
STATUS_PRODUCTS_UNAVAILABLE = Status.new(false, "some products are unavailable") | |
STATUS_INSUFFICIENT_MONEY = Status.new(false, "not enough money") | |
STATUS_SUCCESS = Status.new(true, nil) | |
def check_out(current_user) | |
cart = current_user.cart | |
return STATUS_EMPTY_CART if is_cart_empty(cart) |
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
#=> better code (with logical line breaks) | |
def check_out(current_user) | |
if cart.count == 0 | |
return Status.new(false, "empty cart") | |
end | |
total_price = cart.calculate_total_price | |
if current_user.balance < total_price | |
return Status.new(false, "not enough money") |
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 SalaryQuery | |
def new | |
@results = Salary.all | |
end | |
def call(companies:, source:, order_by:) | |
@results = @results.where(company: companies) | |
unless companies.blank? | |
@results = @results.where(source: 'user_submission') |
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
<fieldset cf-questions="What is your favourite band?"> | |
<label for="fav-band-forests">Forests | |
<input type="radio" name="fav-band" id="fav-band-forests" value="Forests" cf-image="/assets/fav-band/forests.jpg"> | |
</label> | |
<label for="fav-band-tmp">TMP | |
<input type="radio" name="fav-band" id="fav-band-tmp" value="TMP" cf-image="/assets/fav-band/tmp.jpg"> | |
</label> | |
<label for="fav-band-xfr">Xingfoo&Roy | |
<input type="radio" name="fav-band" id="fav-band-xfr" value="Xingfoo&Roy" cf-image="/assets/fav-band/xfr.jpg"> | |
</label> |