Skip to content

Instantly share code, notes, and snippets.

View deshabhishek007's full-sized avatar
on Coffee!

Abhishek Deshpande deshabhishek007

on Coffee!
View GitHub Profile
@deshabhishek007
deshabhishek007 / my-custom-cmd.php
Created February 17, 2024 06:48
WCPune 2024 Custom CLI code
<?php
/*
Plugin Name: My CLI Commands
Plugin URI: #
Description:
Author: WC Pune Team
Version: 1.0.0
Author URI: https://pune.wordcamp.org
*/
@deshabhishek007
deshabhishek007 / apache conf
Created June 24, 2020 03:19
Optimizing Apache2
### file to edit \usr\local\apache\conf.d\empty.conf
### Caching, compress and some security added thanks to https://www.gebruikers.eu
# Load mod_deflate.so only if it is not previously enabled, check httpd.conf for this.
# In my case it wasn't enabled. I prefer this empty.conf to load mod_deflate so my config survives updates and rebuilds.
LoadModule deflate_module modules/mod_deflate.so
<Location />
# Insert filter
SetOutputFilter DEFLATE
@deshabhishek007
deshabhishek007 / multiple-analytics-better-amp.php
Created July 9, 2019 06:29
Multiple Google Analytics in Better AMP WordPress Plugin, Use it as plugin or paste it in your function file.
<?php
/*
Plugin Name: Better AMP Mod : Multiple Analytics Code
Plugin URI: https://www.whoisabhi.com/
Description: Update your Analytics Code in this file below. Replicate Triggers if you need multiple Trackers.
Author: Abhishek
Version: 1.0
Author URI: https://www.whoisabhi.com/
*/
@deshabhishek007
deshabhishek007 / disable-payment-gateway-for-specific-country.php
Created May 2, 2019 12:41
WooCommerce Snippet to Disable Paypal for Indian Customers.
add_filter( 'woocommerce_available_payment_gateways', 'wpmudra_payment_gateway_disable_country' );
function wpmudra_payment_gateway_disable_country( $available_gateways ) {
if ( is_admin() ) return $available_gateways;
if ( isset( $available_gateways['paypal'] ) && WC()->customer->get_billing_country() == 'IN' ) {
unset( $available_gateways['paypal'] );
}
return $available_gateways;
@deshabhishek007
deshabhishek007 / remove-post-meta-orphans.php
Created February 8, 2019 07:41
Remove Orphan values from post-meta Table in WordPress
<ol><?php
$link = mysqli_connect("localhost","Username","Password","DBNameHere");
$sql = "SELECT `meta_id`,`post_id`,`meta_key`,Length(`meta_value`) as meta_data, `post_title`, `post_type` FROM `wp_postmeta` LEFT JOIN `wp_posts` on `wp_postmeta`.`post_id` = `wp_posts`.`ID` ORDER BY `wp_posts`.`post_title` ASC ";
$result = mysqli_query($link, $sql);
while($data = mysqli_fetch_assoc($result)){
if($data['post_title'] == NULL && $data['post_type'] == NULL){
@deshabhishek007
deshabhishek007 / Permission Reset
Created September 28, 2018 14:39
Reset File Permission of Linux Server Machine
find public_html -type d -perm 0777 -exec chmod 755 {} \;
find public_html -type f -perm 0666 -exec chmod 644 {} \;
@deshabhishek007
deshabhishek007 / Gutenberg-support-in-functions.php
Created November 29, 2018 08:33
Code to insert in Themes Function.php
/*
* Adding Align wide support for Gutenberg
*/
add_theme_support( 'align-wide' );
/*
* Adding Blocks Style for Gutenberg
*/
@deshabhishek007
deshabhishek007 / gutenberg-support.css
Created November 29, 2018 08:30
CSS for Gutenberg Support in themes
.has-regular-font-size {
font-size: 16px;
}
@media only screen and (min-width: 768px) {
.alignfull {
margin-left: calc(50% - 50vw);
margin-right: calc(50% - 50vw);
width: auto;
@deshabhishek007
deshabhishek007 / gist:8067223cf64ccbc0bdef9bfdf25e222a
Created October 30, 2018 08:29
autostart php, Mariadb, nginx and dnsmasq
brew services start php
sudo brew services start dnsmasq
brew services start mariadb
brew services start nginx
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../../peenak android-release-unsigned.apk key0
~/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 android-release-unsigned.apk release.apk