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 / 0_reuse_code.js
Last active September 13, 2015 08:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@raihan004
raihan004 / filter-vendor.liquid
Created May 14, 2017 06:34 — forked from Chrisedmo/filter-vendor.liquid
Shopify: Filter by Vendor
<!-- add the vendor as product tag to product then use this code in collection.liquid -->
<!-- if we are on a collection page that is either custom or smart -->
{% if collection.url != blank %}
<h4>Shop by vendor:</h4>
<ul>
{% for product_vendor in collection.all_vendors %}
<li>
{% if current_tags contains product_vendor %}
<a class="active" href="{{ collection.url }}">{{ product_vendor }}</a>
{% else %}
<!-- Ajax API -->
{{ '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js' | script_tag }}
{{ 'api.jquery.js' | shopify_asset_url | script_tag }}
<style type="text/css">
#rv__recent_products.rv__grid{width: 100%; margin-top: 20px;}
.rv__grid .row{ display: block; clear: both;}
.rv__grid .rv__row .rv__column{ float: left; }
.rv__grid .rv__row .rv__column.rv__one{ width: 8.3%; }
.rv__grid .rv__row .rv__column.rv__two{ width: 16.66%; }
@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',
@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 / 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 / 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 / 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 / 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 / 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>