Skip to content

Instantly share code, notes, and snippets.

View raihan004's full-sized avatar
🏠
Working from home

MH Raihan raihan004

🏠
Working from home
View GitHub Profile
@raihan004
raihan004 / bootstrap-pagination.liquid
Last active August 14, 2018 23:44 — forked from kyleaparker/gist:7588995
Shopify: Show all numbers in pagination
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item {% unless paginate.previous.is_link %} disabled {% endunless %}">
<a class="page-link" href="{{ paginate.previous.url }}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">{{ 'general.pagination.previous' | t }}</span>
</a>
</li>
{% assign count = paginate.pages %}
{% for part in paginate.parts %}
@raihan004
raihan004 / html
Last active May 12, 2020 07:48
Quantity
<label for="Quantity">Quantity</label>
<div class="product-quantity product-single__quantity {% unless section.settings.product_quantity_enable %} is-hidden{% endunless %}">
<input value="-" class="qtyminus" field="Quantity" type="button">
<input id="Quantity" name="quantity" value="1" min="1" max="10" data-product-qty="" class="cart__quantity-selector quantity-selector" type="text">
<input value="+" class="qtyplus" field="Quantity" type="button">
</div>
@raihan004
raihan004 / random.js
Created July 11, 2018 18:47 — forked from kerimdzhanov/random.js
JavaScript: get a random number from a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
@raihan004
raihan004 / index.html
Created June 24, 2018 20:56 — forked from cole007/index.html
Shopify API filter for product prices
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>Shopify filtering Boilerplate</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="_assets/css/style.css">
</head>
<body>
@raihan004
raihan004 / available-colors.liquid
Created June 18, 2018 01:19 — forked from carolineschnapp/available-colors.liquid
Snippet that says 'also available in colors x and y' on the collection page when a product is available in more than 1 color. To include in product-loop.liquid, or product-grid-item.liquid.
{% comment %}
Do we have a Color option?
If so, is it the first, second or third option of that product?
We will need to access values so we need that color index.
{% endcomment %}
{% assign has_color = false %}
{% assign color_option_index = 0 %}
{% for option in product.options %}
{% assign downcased_option = option | downcase %}
@raihan004
raihan004 / gist:133b534a15ac07d2ee488140267bea14
Created April 30, 2018 12:33 — forked from kyleaparker/gist:5949872
Shopify - Show total savings on cart page
{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% capture saving %}{{ item.variant.compare_at_price | minus: item.variant.price }}{% endcapture %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}
...rest of cart code within for loop
{% endfor %}
Display saving:
@raihan004
raihan004 / remove-empty-p.js
Created April 14, 2018 09:09 — forked from MichaelVanDenBerg/remove-empty-p.js
Remove empty <p> tags with jQuery.
/**
* Remove empty <p> tags.
*
* See: http://stackoverflow.com/questions/27781798/wordpress-retain-formatting-when-calling-extended-content#comment43990361_27782619
* This seems to be the easiest solution. Remove this function if this ever gets fixed.
* Credits: http://stackoverflow.com/questions/6092855/how-do-i-remove-empty-p-tags-with-jquery
*/
( function( $ ) {
$( 'p' ).each( function() {
@raihan004
raihan004 / formspree.html
Created April 10, 2018 12:32 — forked from JWizerd/formspree.html
JS: Ajax send forms using the most excellent Formspree » http://formspree.io #snippet
<form id="contact-form" action="//formspree.io/your@email.com" method="post">
<input type="text" name="Name" placeholder="Name" required>
<input type="email" name="Email" placeholder="Email" required>
<textarea name="Message" cols="30" rows="6" placeholder="Message" required></textarea>
<!-- CONFIG -->
<input class="is-hidden" type="text" name="_gotcha">
<input type="hidden" name="_subject" value="Subject">
<input type="hidden" name="_cc" value="email@cc.com">
<!-- /CONFIG -->
<input class="submit" type="submit" value="Send">
@raihan004
raihan004 / Adding a search popup.md
Created January 16, 2018 08:44 — forked from teckx5/Adding a search popup.md
Adding a search box popup / modal to the Brooklyn Theme

Issue

Brooklyn doesn't have a search box by default and adding one to the header somewhat disrupts the aesthetic of the theme. Instead of adding just an icon linking to the search page, why not adding a modal using the already built in popup plugin?

image

Did you see that fade in?! It's actually very smooth IRL.

Steps:

@raihan004
raihan004 / shopify-auto-currencies-switcher.js
Created December 27, 2017 06:11 — forked from chrisgrabinski/shopify-auto-currencies-switcher.js
(Shopify) Automatically change a shop's currency based on the customer's geolocation
// Dependencies
// - https://github.com/carolineschnapp/currencies
// Don't change currency if Cookie has been already set
if (Currency.cookie.read() == null) {
jQuery.ajax( {
url: '//freegeoip.net/json/',
type: 'GET',
dataType: 'jsonp',