Skip to content

Instantly share code, notes, and snippets.

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

Sagar Tamang mi5t4n

🏠
Working from home
View GitHub Profile
@mi5t4n
mi5t4n / apt-repo-playbook.yaml
Created August 31, 2024 18:40 — forked from roib20/apt-repo-playbook.yaml
Example usages of the new `deb822_repository` Ansible module
---
- hosts: localhost
connection: local
gather_facts: true
tasks:
- name: Add APT repositories
when: ansible_os_family == 'Debian'
become: true
block:
@mi5t4n
mi5t4n / wp_core_setup_local_by_flywheel.sh
Created July 16, 2024 14:18 — forked from mehul0810/wp_core_setup_local_by_flywheel.sh
WordPress Core Development SetUp on Local by FlyWheel
#!/bin/bash
# Welcome to the WP Core Development Wizard.
#
# Author: Mehul Gohil
# Email: hello@mehulgohil.com
# Supports: Local 5.2.8. or later
#
# PreRequisites:
# 1. Install wget, subversion, curl, php5-cli, and git
@mi5t4n
mi5t4n / fix-git-line-endings
Created May 28, 2024 14:04 — forked from ajdruff/fix-git-line-endings
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@mi5t4n
mi5t4n / README.md
Created May 14, 2024 04:08 — forked from joemaller/README.md
Fix term counts so wp-admin Taxonomy listings show the correct number of items for the selected post_type.

Fixing post counts for WordPress taxonomies

The problem

For WordPress sites using Custom Post Types, Taxonomy admin listings show cumulative term-assignment totals for all post_types instead of counts specific to the selected post_type. Since Taxonomy listings are always attached to a single post_type, totals for shared taxonomies don't make sense.

The Goal

Fix term counts so wp-admin Taxonomy listings show the correct number of items for the selected post_type.

@mi5t4n
mi5t4n / xdebug.md
Last active February 7, 2024 10:30
xdebug

; ########### Common ################## xdebug.start_with_request=trigger xdebug.profiler_enable=0 memory_limit = 1024M xdebug.max_nesting_level = 1024

; ########### Xdebug v2 ################## ;xdebug.remote_enable=1 ;xdebug.remote_port=9003

@mi5t4n
mi5t4n / dokan-order-split-from-backend.php
Last active April 26, 2022 16:05
Split orders when order containing products from multiple vendor is created from admin dashboard in Dokan plugin.
<?php
/**
* Split orders when order containing products from multiple vendor is created from admin dashboard.
*/
function sagar_order_creation_fix( $post_id, $post, $update ) {
// Bail early if not admin.
if( ! is_admin() ) {
return;
}
@mi5t4n
mi5t4n / dokan-add-to-cart.php
Last active April 26, 2022 15:57
Make product purchasable based on the vendor opening and closing time in dokan plugin.
<?php
/**
* Hide or display add to cart button based on opening hours.
*/
function prefix_woocommerce_is_purchasable( $is_purchasable, $product ) {
// Get the store id.
$store_id = get_post_field( 'post_author', $product->get_id() );
// Get the store info.