Skip to content

Instantly share code, notes, and snippets.

View git-bhanu's full-sized avatar

Bhanu git-bhanu

View GitHub Profile
@git-bhanu
git-bhanu / es6importexport.js
Created August 19, 2020 16:57
Importing and Exporting ES6 modules for sage roots.
PAGE NAME : group-slider.js at "script/components/group-slider.js"
//////////////////////////////
import Swiper, {Navigation, Pagination} from 'swiper';
Swiper.use([Navigation, Pagination]);
const groupSlider = new Swiper('#group-cards', {
spaceBetween: 5,
speed: 300,
@git-bhanu
git-bhanu / Form_wordpressAjaxwithAlpinejs.html
Created September 1, 2020 12:50
Example : Using Alpine Js to set WordPress AJAX method.
<form method="POST" x-data="checkoutGuestForm()" @submit.prevent="submitData">
<p>
<span>
<input type="email"
placeholder="Enter Email"
name="email"
x-model="formData.email"
required
>
</span>
function getProductForMenuSearch() {
check_ajax_referer('ajax-nonce', 'nonce');
$search_term = sanitize_text_field($_POST['query']);
$args = array(
's' => $search_term,
'post_type' => 'product',
@git-bhanu
git-bhanu / setup.php
Created September 13, 2020 04:49
Relevanssi Customcode settings
// Enable one letter search
add_filter('relevanssi_block_one_letter_searches', __NAMESPACE__.'\\one_word_searches');
function one_word_searches() {
return false;
}
// https://www.relevanssi.com/knowledge-base/indexing-product-variation-skus-main-product/
add_filter( 'relevanssi_content_to_index', __NAMESPACE__.'\\rlv_index_variation_skus', 10, 2 );
@git-bhanu
git-bhanu / AjaxSearch.php
Created October 7, 2020 11:45
AjaxSearch.php
<?php
namespace App;
use App\Product;
use function Arrayy\create as a;
function categoryProductSearch() {
// check_ajax_referer('ajax-nonce', 'nonce');
$maincategory = sanitize_text_field($_POST['mainCategory']);

Get all the possible materials for a particular type of product which have $maincatergory (say Mens | product_cat) marked in them.

    public static function getMaterials($search_term, $maincategory) {

      $return_arr = a(array());

      $terms = a(array());

      $args  = array(
@git-bhanu
git-bhanu / woocommerce.md
Last active December 4, 2020 13:25
WooCommerce Learnings resource

This gist will contain all the learnings gathered while working with WooCommerce which we can come back in case of confusion.

@git-bhanu
git-bhanu / ols_conf.md
Last active December 9, 2021 15:22
OLS droplet configuration settings.

PHP INI changes:

upload_max_filesize = 64M
max_file_uploads = 200
post_max_size = 64M
memory_limit = 2000M
max_execution_time = 120
@git-bhanu
git-bhanu / scrape.py
Created June 4, 2021 09:31
python script to scrape data
import pandas as pd
from tqdm import tqdm
from selenium.webdriver import Chrome
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException
from time import sleep
data = pd.read_csv("D:\Scrape\WooCommerce Plugin\woocommerce_resultData.csv")
@git-bhanu
git-bhanu / useful_packages.md
Last active July 7, 2021 20:14
A list of useful packages that can be used in projects.

JavaScript

  1. Tippy JS : Tippy.js is the complete tooltip, popover, dropdown, and menu solution for the web
  2. Parsley JS : JavaScript form validation library
  3. Atlaskit : Design Kit by Atlassian : Atlassian's official UI library, built according to the Atlassian Design System.
  4. Ant Design : A design system for enterprise-level products. Create an efficient and enjoyable work experience.
  5. VueUse