Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Scaling Operations @lubusIN

Ajit Bohra ajitbohra

🎯
Scaling Operations @lubusIN
View GitHub Profile
View .aliases-base
# 📖 WP CLI Auto Completion
autoload bashcompinit
bashcompinit
source ~/wp-completion.bash
# 🏷️ System Paths
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
# ZSH Customization
@ajitbohra
ajitbohra / info.md
Created Mar 5, 2018
Laravel Development Using Local By FlyWheel
View info.md
  • Use local site "app" fodler as root for Laravel
  • Create a .env file using info from Local site domain
  • CLI Run php artisan key:generate
  • CLI Run php artisan config:cache
@ajitbohra
ajitbohra / .htaccess
Created Mar 10, 2017
Force secure access to domain / website
View .htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
@ajitbohra
ajitbohra / .htaccess
Created Feb 5, 2017
GZIP Compression
View .htaccess
# GZIP COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
@ajitbohra
ajitbohra / .htaccess
Created Feb 5, 2017
Browser Caching For Static Resources
View .htaccess
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default expiration: 1 hour after request
ExpiresDefault "now plus 1 hour"
# CSS and JS expiration: 1 week after request
ExpiresByType text/css "now plus 1 week"
ExpiresByType application/javascript "now plus 1 week"
ExpiresByType application/x-javascript "now plus 1 week"
# Image files expiration: 1 month after request
@ajitbohra
ajitbohra / script.js
Created Nov 22, 2016
DataTables JS - How to change pagination button class ?
View script.js
/*
DataTables JS: How to change pagination button class
Read More: http://www.lubus.in/blog/datatables-js-change-pagination-button-class
*/
jQuery(document).ready(function($) {
// Initialize Datatables
$.fn.dataTable.ext.classes.sPageButton = 'button button-primary'; // Change Pagination Button Class
$('#lubus-wordcamp').DataTable( {
@ajitbohra
ajitbohra / functions.php
Last active Nov 17, 2016
Wordpress Generate Plugin Activation Link
View functions.php
<?php
/*
* Generate a Link to Activate a Plugin in WordPress
*/
$path = 'woocommerce/woocommerce.php';
$link = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$path), 'activate-plugin_'.$path);
?>
@ajitbohra
ajitbohra / functions.php
Created Nov 16, 2016
Wordpress generate plugin install URL
View functions.php
<?php
/**
* http://stackoverflow.com/questions/5327920/how-to-generate-a-wordpress-plugin-install-link
**/
$action = 'install-plugin';
$slug = 'akismet';
wp_nonce_url(
add_query_arg(
@ajitbohra
ajitbohra / functions.php
Created Nov 16, 2016
Wordpress Get Plugin Status
View functions.php
<?php
/**
* Check the status of a plugin.
*
* @param string $location Base plugin path from plugins directory.
* @return int 1 if active; 2 if inactive; 0 if not installed
*/
function get_plugin_status($location = '') {
if(is_plugin_active($location)) {
@ajitbohra
ajitbohra / functions.php
Last active Jun 5, 2021
Fixing Wordpress Media Upload HTTP Error on Godaddy / Shared Hosting
View functions.php
<?php
/**
* Facing HTTP Error on wordpress media upload on Godaddy / Shared Host ? This snippet might help you fix issue
* For more details about issue: http://www.lubus.in/blog/wordpress-media-upload-http-error-godaddy-shared-hosting-255
**/
/** Change graphic manuplation library used by wordpress **/
add_filter( 'wp_image_editors', 'change_graphic_lib' );