Skip to content

Instantly share code, notes, and snippets.

View lionrajkumar's full-sized avatar
💭
Must Learn Today

Rajkumar lionrajkumar

💭
Must Learn Today
View GitHub Profile
@lionrajkumar
lionrajkumar / ConvertJsonToPhpClass.md
Created December 21, 2023 17:14
Converting JSON String to PHP class

Converting JSON String to PHP class

class JSONObject {
    public function __construct($json = false) {
        if ($json) $this->set(json_decode($json, true));
    }

    public function set($data) {
 foreach ($data AS $key => $value) {
@lionrajkumar
lionrajkumar / CreateRssFeed.md
Created June 22, 2023 14:08
Creating Valid RSS feed by using PHP and Mysql

Creating Valid RSS feed in PHP

Mysql Table

CREATE TABLE `tbl_post` (
  `id` mediumint(8) UNSIGNED NOT NULL,
  `title` text,
  `description` text,
  `author` varchar(255) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `image` varchar(150) DEFAULT NULL,
@lionrajkumar
lionrajkumar / UpgradeMariaDB.md
Last active May 23, 2023 19:51
Upgrade MariaDB to latest in Xampp

How to upgrade MySQL to MariaDB in XAMPP in 5 minutes on Windows

Here are the steps I used to to upgrad MySQL to MariaDB in XAMPP on Windows in about 5 minutes. After completing this process, MariaDB will look and work just like MySQL. You may even notice a performance increase in your website. No need to panic fellow developer, increased performance is perfectly normal and just one of the great benefits of MariaDB over MySQL.

IMPORTANT: Before you begin, always be sure to make a good backup. Do not do move instead of copy files in the instructions below as the original files may be required in order to back out and restore the original MySQL environment if it doesn't work out for you.

  1. Open a command prompt.
  2. Go to your xampp folder.
  3. Enter the following command: mysql/bin/mysql --version
  4. Take note of the version of MySQL you have installed. This is the version of MariaDB that you will need. You can now exit the command prompt as the rest of the instructions can be done through Windows Explorer

Script Code

<script src="js/checkout.js" STRIPE_PUBLISHABLE_KEY="<?php echo STRIPE_PUBLISHABLE_KEY; ?>" defer></script>

with in the script

// Get API Key
let STRIPE_PUBLISHABLE_KEY = document.currentScript.getAttribute('STRIPE_PUBLISHABLE_KEY');
@lionrajkumar
lionrajkumar / CopyPagesbetweenSitesinMultisiteNetwork.md
Created March 9, 2023 19:28
Copy Pages between Sites in Multisite Network.md

Copy Pages between Sites in Multisite Network

In this tutorial I will show you an easy way to duplicate WordPress pages to any of your sites within a multisite network.

There are different ways to implement that but we going to use WordPress bulk actions.

Copy Pages between Sites within WordPress Multisite network

As an example I decided to use Pages and we do not only copy them, but move between sites. If you need to create duplicates, you will have to change just one line of code.

@lionrajkumar
lionrajkumar / TodoReminder.md
Last active February 21, 2023 12:31
Automate todo list reminder email To specific user on every day with Google Sheets in 5 minutes.

Todo list and Notifications

Automate todo list reminder email To specific user on every day with Google Sheets in 5 minutes.

Google sheets provide a low cost (free), easy to set up, with a low entry barrier for operating staff to update the data, and less error solution in this case as compared to commercial available CRM which have a learning curve and integration requirement.

Step 1: Prepare your Google Sheet

Prepare your google sheet as below, make sure you had formatted the column Due Date to Date format using:

Format → Number → Date

Battery checkup using Javascript

navigator.getBattery().then((battery)=>{
	var btLvl = battery.level*100;
	console.log('battery Level: ' + btLvl );
	
	if(battery.charging){
		console.log('Battery is charging now');
	}else{
@lionrajkumar
lionrajkumar / MoodleMultitenantSupport.md
Last active October 3, 2022 20:16
Moodle Multi-tenancy support

Moodle Multitenant Support

Contents

  1. Overview
  2. Backwards compatibility
  3. List of changes
    1. Database changes
    2. Tenant setting overrides
    3. Context changes and access control
    4. PAGE
  4. Navigation
@lionrajkumar
lionrajkumar / ApiDocumentationWeb.md
Created September 27, 2022 17:12
Application API documentation by using OpenAPI version 3.0.0 & SwaggerHub

MongoDB Tuts

DB: MongoDB Community Server

GUI: Compass

mongo
show dbs
use myfirstdb