Skip to content

Instantly share code, notes, and snippets.

View romankhadka's full-sized avatar
🇺🇸
Building

Roman Khadka romankhadka

🇺🇸
Building
View GitHub Profile
@romankhadka
romankhadka / gist:5f0cee1d68f3fe6ef0fbce0dbc01b3ff
Last active July 28, 2025 19:11
External discount adjustments to the cart

External Discount Callback System - Implementation Plan

Overview

Implement a hybrid system that allows external services to apply discounts to carts through callbacks, while persisting those discounts for cart abandonment scenarios and performance optimization.

Problem Statement

  • Current discount system is tightly coupled to Commerce::DiscountCommerce::CartDiscountCommerce::CartAdjustment chain
  • External systems need to apply discounts that don't fit this rigid structure
  • Discounts must persist for abandoned cart scenarios
  • System should be performant and reliable even when external services are unavailable
@romankhadka
romankhadka / index.liquid
Last active April 20, 2025 17:26
Sample product header
<section class="product-header1">
<div class="padding-global container-lg py-12 product-header1_component">
<!-- Breadcrumbs -->
<div class="mb-4 breadcrumb_component">
{% for breadcrumb in section.settings.breadcrumbs %}
<a href="{{ breadcrumb.link }}" class="breadcrumb-link-2 w-inline-block">
{{ breadcrumb.text }}
</a>
<div class="breadcrumb-divider">
<svg width="16" height="16" viewbox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# gem 'pry-byebug' # Integrates pry with byebug
# gem 'pry-doc' # Provide MRI Core documentation
# gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB
# gem 'pry-rescue' # Start a pry session whenever something goes wrong.
# gem 'pry-theme' # An easy way to customize Pry colors via theme files
# end
@romankhadka
romankhadka / clean_code.md
Created April 14, 2021 11:22 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@romankhadka
romankhadka / selenium-webdriver-cheatsheet.md
Created December 10, 2020 15:08 — forked from shoesCodeFor/selenium-webdriver-cheatsheet.md
Ruby Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore