Skip to content

Instantly share code, notes, and snippets.

View kartick14's full-sized avatar
🎯
Focusing

Kartick Karmakar kartick14

🎯
Focusing
  • kolkata, India
View GitHub Profile
@kartick14
kartick14 / shopify-filter.liquid
Created June 22, 2018 10:16
Shopify filter section with AND condition
<div id="sidebarColumn" class="col-md-3">
<!-- <div id="sidebar" class="sidebar selection-sec"> -->
<div class="selection-sec">
<div class="selection-sec-inner">
<div class="shape-sec">
<h5>Select a Shape</h5>
<ul class="more">
{% assign file_extension = 'png' %}
{% if collection.handle == 'all' %}
{% for tag in collection.all_tags %}
@kartick14
kartick14 / function.php
Created July 2, 2018 09:49
Wordpress login restriction depends on user role.
<?php add_filter( 'wp_authenticate_user', 'restrict_login', 10, 2 );
function restrict_login( $user, $password ) {
if ( is_wp_error( $user ) ) {
return $user;
}
$roles = array('administrator','subscriber');
//$roles[] = 'administrator';
if (array_reduce( $roles, function ( $allowed, $role ) use ( $user ) {
return $allowed || user_can( $user, $role );
@kartick14
kartick14 / index.html
Created July 17, 2018 06:22
How to change the default message of the required field in the popover of form-control in bootstrap?
<input class="form-control" type="email" required="" placeholder="username"
oninvalid="this.setCustomValidity('Please Enter valid email')"
oninput="setCustomValidity('')"></input>
<!-- Ref site: https://stackoverflow.com/questions/24391078/how-to-change-the-default-message-of-the-required-field-in-the-popover-of-form-c/24392931 -->
@kartick14
kartick14 / google-map-custom.html
Created July 18, 2018 14:10
This example displays a marker with custom color map
https://console.developers.google.com/apis/credentials?project=luca-project-210509
**Add height on map id is must
<!DOCTYPE html>
<html>
<head>
<title>Styled Maps - Night Mode</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
@kartick14
kartick14 / index.html
Created August 3, 2018 14:09
jQuery: check if element is visible on screen
<div class="container">
<div class="text text-1">
Lorem ipsum <span></span>
</div>
<div class="text text-2">
Lorem ipsum <span></span>
</div>
</div>
@kartick14
kartick14 / index.html
Created August 6, 2018 14:54
Jump menu with active class and smooth scroll
<link href='https://fonts.googleapis.com/css?family=Lato:100,400,700' rel='stylesheet' type='text/css'>
<nav class="navigation" id="mainNav">
<a class="navigation__link" href="#1">Section 1</a>
<a class="navigation__link" href="#2">Section 2</a>
<a class="navigation__link" href="#3">Section 3</a>
<a class="navigation__link" href="#4">Section 4</a>
<a class="navigation__link" href="#5">Section 5</a>
<a class="navigation__link" href="#6">Section 6</a>
<a class="navigation__link" href="#7">Section 7</a>
@kartick14
kartick14 / block-search.liquid
Created August 29, 2018 10:26
Shopify popup search box with overlay
{% comment %}
A snippet to include a search bar anywhere in your theme.
Note we are using 'input-group' for the layout. Look under Forms > Input Groups for some demos.
More information:
- http://docs.shopify.com/themes/liquid-variables/search
To return only products in results:
- http://docs.shopify.com/manual/configuration/store-customization/return-only-product-in-storefront-search-results
@kartick14
kartick14 / index.html
Created August 29, 2018 15:00
Show more and less content using jquery
<div class="grid__item one-quarter footer-cat-list"><div class="Block CategoryList Panel">
<h4>Categories</h4>
<div class="BlockContent">
<ul class="sf-menu sf-horizontal sf-js-enabled">
<li style="display: none;"><a href="#">Shop By Subject</a></li>
<li style="display: none;"><a href="#">Shop By Color </a></li>
<li style="display: none;"><a href="#">Shop By Design/Shape</a></li>
<li><a href="#">Panoramic Wall Art</a>
</li>
<li><a href="#">Vertical Wall Art</a></li>
@kartick14
kartick14 / index.html
Created September 21, 2018 08:10
Custom accordion with jquery
<div id='accordian-panel'>
<h3 class="accordian-title">Product Details</h3>
<div class='accordian-body'>SOME CONTENT HERE</div>
<h3 class="accordian-title">Questions & Answers</h3>
<div class='accordian-body'>SOME CONTENT HERE</div>
</div>
<script type="text/javascript">
//On click any <h3> within the container
$('#accordian-panel .accordian-title').click(function(e) {
@kartick14
kartick14 / functions.js
Last active October 4, 2018 05:51
Increase or decrease quantity by click button
/*
<div class="qty-num">
<span class='qtyminus' field='addcart_{{ product.id }}'>-</span>
<span class="quantitySpan">1</span>
<span class='qtyplus' field='addcart_{{ product.id }}'>+</span>
</div>
<input type="hidden" id="addcart_{{ product.id }}" name="quantity" value="1" class="product-form__input" />
*/
jQuery(document).ready(function() {