Skip to content

Instantly share code, notes, and snippets.

View sarvsav's full-sized avatar
🌲
golang - green developer

Sarvsav Sharma (Max) sarvsav

🌲
golang - green developer
View GitHub Profile
require_relative "rules"
# An object which represents the checkout process or cash register.
# It scans items, which are added to an internal list of items,
# which are then used to return the #total at any given moment.
# This total tries to use the rules which lead to the cheapest price.
class CheckOut < Struct.new(:rules)
attr_accessor :rules # list of available pricing rules (passed on initialization)
attr_accessor :items # hash of scanned items and quantities
# { "A" => 0, "B" => 1 } means we have scanned one "A" and zero "B"s
@sarvsav
sarvsav / embed-gist-in-blogger.js
Created January 23, 2022 08:38 — forked from hanxue/embed-gist-in-blogger.js
Embed Gists in Blogger
At the end of your Blogger post , using HTML editor, append this
<script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script>
In the content of your blog post, simply add this:
<div class="gistLoad" data-id="8488564" id="gist-8488564">Loading https://gist.github.com/8488564....</div>
Note: adding the URL is useful because when the javascript does not work, readers can copy and paste the URL themselves.
@sarvsav
sarvsav / Makefile
Created April 10, 2023 20:00 — forked from thomaspoignant/Makefile
My ultimate Makefile for Golang Projects
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)