Skip to content

Instantly share code, notes, and snippets.

Avatar
on Coffee!

Abhishek Deshpande deshabhishek007

on Coffee!
View GitHub Profile
View apache conf
### 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 Jul 9, 2019
Multiple Google Analytics in Better AMP WordPress Plugin, Use it as plugin or paste it in your function file.
View multiple-analytics-better-amp.php
<?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
WooCommerce Snippet to Disable Paypal for Indian Customers.
View disable-payment-gateway-for-specific-country.php
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 Feb 8, 2019
Remove Orphan values from post-meta Table in WordPress
View remove-post-meta-orphans.php
<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 / Gutenberg-support-in-functions.php
Created Nov 29, 2018
Code to insert in Themes Function.php
View Gutenberg-support-in-functions.php
/*
* Adding Align wide support for Gutenberg
*/
add_theme_support( 'align-wide' );
/*
* Adding Blocks Style for Gutenberg
*/
@deshabhishek007
deshabhishek007 / gutenberg-support.css
Created Nov 29, 2018
CSS for Gutenberg Support in themes
View gutenberg-support.css
.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 Oct 30, 2018
autostart php, Mariadb, nginx and dnsmasq
View gist:8067223cf64ccbc0bdef9bfdf25e222a
brew services start php
sudo brew services start dnsmasq
brew services start mariadb
brew services start nginx
View gist:fe244fac084f8898f39734ea3ff0f846
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
View SublimeLinter-Settings-user.json
// SublimeLinter Settings - User
{
"paths": {
"linux": [],
"osx": ["~/.composer/vendor/squizlabs/php_codesniffer/scripts/",
"~/.composer/vendor/squizlabs/php_codesniffer/bin/",
"/usr/local/bin/"],
"windows": []
},
"linters":{
View .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]