Skip to content

Instantly share code, notes, and snippets.

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

Emran Ahmed EmranAhmed

🏠
Working from home
View GitHub Profile
@EmranAhmed
EmranAhmed / discount.html
Last active July 12, 2018 07:21
GWP Live feed message style, live push notification
<p>Happy Deal For WooCommerce Variation Swatches
<span class="big">Discount more than <strong>30%</strong></span></p>
<p><a class="button-primary" href="{pro_link}" target="_blank">Buy Now</a></p>
  • Copy /wp-content/themes/bridge/woocommerce/content-product.php file to your child theme.
  • Add <?php do_action('wvs_pro_variation_show_archive_variation'); ?> end of the file before </li> tag.
  • content-product.php file for example
<?php
	/**
	 * The template for displaying product content within loops
	 *
	 * This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
@EmranAhmed
EmranAhmed / wc-template-override.php
Created May 6, 2018 20:13 — forked from obiPlabon/wc-template-override.php
Helper class to override WooCommerce templates from plugin
<?php
/**
* WooCommerce template overriding class
*
* @author obiPlabon
*/
class WC_Template_Override {
/**
  • Make it exeicutable like: chmod u+x rsync.sh later you have to make chmod u+x .rsyncconfig and chmod u+x .rsyncignore
  • ./rsync.sh init
  • Do you have password less alias host? (Y/n): means if you use passwordless login like: ssh example.com were example.com is your alias hostname on ~/.ssh/config file.
  • ~/.ssh/config file example:
Host example.com
    HostName 12.12.12.12 # Your VPS IP Address
    User root
 Port 22
@EmranAhmed
EmranAhmed / wp-admin-modal-dialog.php
Created February 26, 2018 13:36 — forked from anttiviljami/wp-admin-modal-dialog.php
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>
window.dump = function (data) {
console.log(data);
};
window.dd = function (...data) {
data.forEach(function(element) {
console.log(element);
});
throw {
@EmranAhmed
EmranAhmed / bs-04-wp-mix.md
Last active September 23, 2017 00:03
Bootstrap 4.0 Support wp-mix
$wp_customize->add_setting( 'themeslug_media_setting_id', array(
'sanitize_callback' => 'absint',
'validate_callback' => 'themeslug_validate_image,
) );
$wp_customize->add_control(
new WP_Customize_Media_Control( $wp_customize, 'themeslug_media_setting_id', array(
'label' => __( 'Custom Core Media Setting' ),
'section' => 'custom_section', // Add a default or your own section
'mime_type' => 'image',
@EmranAhmed
EmranAhmed / ignore-file-loader.js
Created May 15, 2017 12:59
ignore-file-loader create `loaders` dir and put `ignore-file-loader.js`
var loaderUtils = require("loader-utils");
module.exports = function (content) {
this.cacheable && this.cacheable();
if (!this.emitFile) throw new Error("emitFile is required from module system");
var query = loaderUtils.getOptions(this) || {};
var configKey = query.config || "ignoreFilesLoader";
var options = this.options[configKey] || {};
@EmranAhmed
EmranAhmed / nginx-tuning.md
Created March 4, 2017 21:29 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.