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 / README.md
Last active June 18, 2024 14:09 — forked from AminulBD/bootstrap.sh
Ubuntu Server LEMP Setup script

How to Install

  • Download script curl -fsSL https://gist.githubusercontent.com/EmranAhmed/a1a61b710f72317c775715fe1509e99d/raw/bootstrap.sh | bash -s
  • Make it executable chmod +x bootstrap.sh

How to use

  • ./bootstrap.sh --domain=domain.com --user=myname
@EmranAhmed
EmranAhmed / common-chunk.js
Last active April 18, 2024 11:58
Multiple WP Block with external scripts, Custom webpack for wp block
const defaultConfig = require('@wordpress/scripts/config/webpack.config')
const WooCommerceDependencyExtractionWebpackPlugin = require('@woocommerce/dependency-extraction-webpack-plugin')
module.exports = {
...defaultConfig,
plugins : [
...defaultConfig.plugins.filter((plugin) => plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'),
new WooCommerceDependencyExtractionWebpackPlugin({
/*requestToExternal(request) {
if (request.includes('utils')) {
@EmranAhmed
EmranAhmed / docker-compose.yml
Created November 8, 2022 10:37 — forked from glendaviesnz/docker-compose.yml
Basic WordPress docker compose file
version: '3.7'
services:
mysql:
image: mariadb
ports:
- '3306'
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
volumes:
@EmranAhmed
EmranAhmed / update-woo-order-billing-when-user-saves-address.php
Created September 20, 2019 06:31 — forked from zgordon/update-woo-order-billing-when-user-saves-address.php
Update WooCommerce Order Address Dynamically When Customer Updates Their Address
<?php
add_action( 'woocommerce_customer_save_address', 'jsforwp_update_address_for_orders', 10, 2 );
function jsforwp_update_address_for_orders( $user_id ) {
$customer_meta = get_user_meta( $user_id );
$customer_orders = get_posts( array(
'numberposts' => -1,
'meta_key' => '_customer_user',
@EmranAhmed
EmranAhmed / letsencrypt_2018.md
Created February 14, 2019 09:35 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@EmranAhmed
EmranAhmed / custom_embed.php
Created October 21, 2018 10:47 — forked from manchumahara/custom_embed.php
Embed in WordPress Outside of Editor or Content https://manchumahara.com/?p=1135&preview=true
$url = 'https://www.youtube.com/watch?v=08f0tiLdk7w'; //a youtube video url
$autoembed = new WP_Embed(); //initialize the wordpress oEmbed helper class
$content = $autoembed->autoembed($url); //let's parse the url and get the embeded content
@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