Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ajitbohra's full-sized avatar
🎯
Scaling Operations @lubusIN

Ajit Bohra ajitbohra

🎯
Scaling Operations @lubusIN
View GitHub Profile
@ajitbohra
ajitbohra / index.php
Last active March 6, 2024 09:07
mpdf: HTML/CSS to PDF & send pdf via email
<?php
/*
mPDF: Generate PDF from HTML/CSS (Complete Code)
*/
require_once( 'mpdf/mpdf.php'); // Include mdpf
$stylesheet = file_get_contents('assets/css/pdf.css'); // Get css content
$html = '<div id="pdf-content">
Your PDF Content goes here (Text/HTML)
</div>';
@ajitbohra
ajitbohra / info.md
Created March 5, 2018 03:46
Laravel Development Using Local By FlyWheel
  • 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 / script.js
Created May 25, 2015 18:49
jQuery: SweetAlert throws error logStr is not defined
// This code throws error: logStr is not define
swal({
title: "Problem",
text: "Problem processing request !",
type: "Error"
});
// This code works perfect
// type argument accepts following: error,success,info,warning
// type is case sensitive "Error" in place of "error" will throw error
@ajitbohra
ajitbohra / functions.php
Last active June 5, 2021 06:13
Fixing Wordpress Media Upload HTTP Error on Godaddy / Shared Hosting
<?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' );
@ajitbohra
ajitbohra / script.js
Created November 22, 2016 12:37
DataTables JS - How to change pagination button class ?
/*
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( {
.yoast-settings {
display: none;
}
# 📖 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 / functions.php
Last active May 30, 2017 15:08
Wordpress Adding image size
<?php
add_image_size( 'custom-size', 220, 180 ); // 220 pixels wide by 180 pixels tall, soft proportional crop mode
add_image_size( 'custom-size', 220, 180, true ); // 220 pixels wide by 180 pixels tall, hard crop mode
add_image_size( 'custom-size', 220, 220, array( 'left', 'top' ) ); // Hard crop left top
/*
For Media Library Images (Admin):
--------------------------------
You can also make your custom sizes selectable from your WordPress admin.
@ajitbohra
ajitbohra / .htaccess
Created March 10, 2017 10:48
Force secure access to domain / website
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
@ajitbohra
ajitbohra / .htaccess
Created February 5, 2017 15:52
GZIP Compression
# 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