Skip to content

Instantly share code, notes, and snippets.

View rohit20001221's full-sized avatar

rohit20001221

View GitHub Profile
@rohit20001221
rohit20001221 / gist:4aabe9ff48339ad63144d5f46546b311
Created February 16, 2023 08:46 — forked from jonathanmoore/gist:c0e0e503aa732bf1c05b7a7be4230c61
Linked options helper methods for Shopify. See this: http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options - Updated to work with sectioned themes (tested with District)
<script>
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: [email protected]
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus
// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore
/*
Updated to work with sectioned themes
- Added required methods from the deprecated options_selection.js
- Triggers an initial variant change
- Hides sold out variants with only one option
@rohit20001221
rohit20001221 / client.html
Created February 5, 2023 07:19 — forked from agrueneberg/client.html
HMAC-SHA256 example for verifying both the data integrity and the authentication of a request in Node.js and web browsers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HMAC-SHA256 Example</title>
</head>
<body>
<script src="http://crypto.stanford.edu/sjcl/sjcl.js"></script>
<script>
var sharedSecret, query, signature, hmac, xhr;
@rohit20001221
rohit20001221 / useFetchWithAbort.tsx
Created January 4, 2023 18:59 — forked from thathurtabit/useFetchWithAbort.tsx
React: Fetch Hook (with AbortController to avoid race conditions and memory leaks)
import { useState, useEffect } from "react";
/* H/T:
Avoiding Race Conditions and Memory Leaks in React useEffect
https://javascript.plainenglish.io/avoiding-race-conditions-and-memory-leaks-in-react-useeffect-2034b8a0a3c7
*/
interface IUseFetchWithAbortResponse {
fetchedData: unknown;
isLoading: boolean;
@rohit20001221
rohit20001221 / backtracking_template.py
Created July 31, 2021 04:10 — forked from RuolinZheng08/backtracking_template.py
[Algo] Backtracking Template & N-Queens Solution
def is_valid_state(state):
# check if it is a valid solution
return True
def get_candidates(state):
return []
def search(state, solutions):
if is_valid_state(state):
solutions.append(state.copy())