Skip to content

Instantly share code, notes, and snippets.

View jahid32's full-sized avatar

Md Mostafizur Rahman jahid32

  • Sourcetop Inc.
  • Bangladesh
View GitHub Profile
@neotohin
neotohin / fix_collate.php
Created April 5, 2023 11:03
MySQL Collate fix
<?php
// Stolen from: http://www.holisticsystems.co.uk/blog/?p=931
// Modified to work using mysqli
$server = 'localhost';
$username = 'root';
$password = 'root';
$database = 'ojs';
$new_charset = 'utf8';
$new_collation = 'utf8_unicode_ci';
@erikyo
erikyo / replacevar-script.js
Last active July 23, 2024 22:03
Adds to Yoast an additional replacement variable both in frontend and snippet preview (backend)
/* inspired from https://github.com/Yoast/wpseo-woocommerce/blob/trunk/js/src/yoastseo-woo-replacevars.js */
/* global jQuery, YoastSEO, app, globals YoastACFAnalysisConfig */
var pluginName = "additionalVariablePlugin";
var ReplaceVar = window.YoastReplaceVarPlugin && window.YoastReplaceVarPlugin.ReplaceVar;
var placeholders = {};
var modifiableFields = [
"content",
"title",
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active September 18, 2024 10:59
Online Resources For Web Developers (No Downloading)
@carlosbensant
carlosbensant / webpack.mix.js
Created April 18, 2018 15:26
Using Webpack/Laravel-Mix to bundle/compile Drupal 8 Theme assets.
const { mix } = require('laravel-mix')
const path = require('path')
/*
|--------------------------------------------------------------------------
| Asset Management
|--------------------------------------------------------------------------
|
| This file defines the building steps of the application. Here's where the
| client-side technologies are configured according to the needs. Steps such
@mahfuzul
mahfuzul / switch_php_version.sh
Last active December 15, 2017 13:18
Switch between Multiple PHP Version on Ubuntu
##From PHP 5.6 => PHP 7.1
Default PHP 5.6 is set on your system and you need to switch to PHP 7.1. Run the following commands to switch for Apache and command line.
#Apache:-
$ sudo a2dismod php5.6
$ sudo a2enmod php7.1
$ sudo service apache2 restart
@prasadshir
prasadshir / HelloController.php
Last active May 9, 2020 07:08
D728 Task-01: Create a custom page
<?php
/**
* Controller file for Lotus Drupal 8 module.
* Place this file in src/Controller folder inside the lotus module folder
**/
namespace Drupal\lotus\Controller;
use Drupal\Core\Controller\ControllerBase;
class HelloController extends ControllerBase {
@richtabor
richtabor / google-fonts-the-right-way.php
Last active April 3, 2019 04:43
Demonstrates how to properly include Google Fonts into WordPress themes. Ref: http://themeshaper.com/2014/08/13/how-to-add-google-fonts-to-wordpress-themes/
if ( ! function_exists( 'prefix_fonts_url' ) ) :
/**
* Register Google fonts.
*
* @return string Google fonts URL for the theme.
*/
function prefix_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = '';
@aaronbloomfield
aaronbloomfield / multiple-php-versions-on-ubuntu-16.04.md
Last active July 9, 2020 01:53
Running multiple PHP versions on Apache2 and Ubuntu 16.04

Setting up multiple apache2 instances on Ubuntu 16.04

PHP handling on apache is done via modules of one sort or another, and running multiple version is problematic on a single instance. The solution is to run two instances of apache on the same machine. This allows one instance to run PHP 7 (the default on 16.04), and another can run PHP 5. Since normal http/https is on ports 80 and 443, the second instance will run on ports 81 and 444. Since it is running on the same machine, all file system and database access is the exact same.

All the commands herein have to be run as root, or with sudo prefixed to the command.

  1. Read /usr/share/doc/apache2/README.multiple-instances

  2. Run sh ./setup-instance php5 from /usr/share/doc/apache2/examples, where php5 is the suffix for the second site; all commands for the second site will have that suffix. This will keep all of the same configuration for all sites on the new instance, including SSL certif

@thenbrent
thenbrent / subscription-renewal-process.md
Created August 8, 2016 17:52
Brief developer's guide to the application flow during the subscription renewal process within WooCommerce Subscriptions

WoCommerce Subscriptions processes automatic renewal payments via the following flow:

  1. its scheduling system, Action Scheduler, will run every minute and find any woocommerce_scheduled_subscription_payment actions scheduled to run now or within the last minute
  2. if there are woocommerce_scheduled_subscription_payment actions scheduled for anytime before now, Action Scheduler will grab a batch of those actions and begin processing them (which just means triggering do_action( 'scheduled_subscription_payment', $subscription_id ) for any 3rd party code to handle)
  3. Subscriptions attaches two important functions as callbacks on the 'woocommerce_scheduled_subscription_payment' hook to process renewal for that subscription when it is called:
  4. WC_Subscriptions_Manager::prepare_renewal(), which is responsible for