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 / functions.php
Created April 11, 2023 12:47
Woocommerce product customization with additional data passing
/* ------------------------- ADD TO CART section start --------------------- */
add_action('wp_ajax_nopriv_add_to_cart_ajax', 'add_to_cart_ajax_func');
add_action('wp_ajax_add_to_cart_ajax', 'add_to_cart_ajax_func');
function add_to_cart_ajax_func(){
//print_r($_POST);
$product_id = $_POST['product_id'];
$product_quantity = $_POST['product_quantity'];
$total_price = $_POST['total_price'];
@kartick14
kartick14 / custom.js
Created March 21, 2023 10:31
Filter Image depends on alt tag value
const $img = jQuery(".product__media-list img");
jQuery(".color_input_fields input").on("click",function() {
$img.parents('li').hide();
const val = this.value.trim().toLowerCase();
if (val === "") return;
$img.filter(function() { return this.alt.toLowerCase().includes(val) }).parents('li').show()
});
@kartick14
kartick14 / index.html
Created August 25, 2022 13:18
Custom scrolling animations - pausing sections and scrolling elements horizontally
https://stackoverflow.com/questions/56713668/custom-scrolling-animations-pausing-sections-and-scrolling-elements-horizontal
<script>
$('.nested').each(function() {
let $window = $(window), $body = $('body');
let $nested = $(this), $nestedPlaceholder = $nested.parent();
let verticalScrollRange, upperMargin, lowerMargin;
$window.resize(function(){
$nested.removeClass("sticky").css({left: 0});
let placeholderHeight = $nestedPlaceholder.css({height: ''}).height();
@kartick14
kartick14 / index.html
Created November 3, 2021 11:04
Calculate percentage ratio on scroll ( with Jquery )
<div id="note" ></div>
<br><br><br><br><br><br><br><br><br><br><br>
<div class="scrollratio" ></div>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<style>
body {
@kartick14
kartick14 / sqlq.php
Last active June 30, 2021 15:19
MySQL find exact substring from a string on DB table
$regxp = 'River';
$sql = "SELECT * FROM categories where catinclude RLIKE '(^|,)$regxp(,|\$)'";
@kartick14
kartick14 / function.js
Created April 15, 2021 11:28
Jquery get current url and add/push parameter
function dropdownChange(){
var byDate = document.getElementById('filter-by-date').value;
var myUrl = addQSParm('cat_type',cat_type);
var myUrl = addQSParm('keyword',sKeyword, myUrl);
window.location.href = myUrl;
}
/**************************************************
@ Constructing a URL with parameters using jQuery
@kartick14
kartick14 / header.liquid
Created November 18, 2020 07:10
add currency switcher in shopify theme
{% form 'currency' %}
<select name="currency">
{% for currency in shop.enabled_currencies %}
{% if currency == cart.currency %}
<option selected="true">{{currency.iso_code}} {{currency.symbol}}</option>
{% else %}
<option>{{currency.iso_code}}</option>
{% endif %}
{% endfor %}
</select>
@kartick14
kartick14 / index.html
Created May 12, 2020 11:15
View instagram post
<div id="instagram-feed1" class="instagram_feed"></div>
https://github.com/jsanahuja/jquery.instagramFeed
https://www.sowecms.com/demos/InstagramFeed/
<script >
(function($){
$(window).on('load', function(){
$.instagramFeed({
'username': '{{ section.settings.instagram_id | escape }}',
'container': "#instagram-feed1",
'display_profile': false,
@kartick14
kartick14 / wp-config.php
Created April 24, 2020 11:12 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@kartick14
kartick14 / index.html
Created March 12, 2020 15:36
Smooth Page Scrolling in jQuery
<div id="page-wrap">
<h1 id="top">Smooth Page Scrolling</h1>
<ul>
<li><a href="#two">Scroll to Section Two</a></li>
<li><a href="#three">Scroll to Section Three</a></li>
</ul>
<h2 id="one">Section One</h2>