Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ronak J Vanpariya vanpariyar

🏠
Working from home
View GitHub Profile
@vanpariyar
vanpariyar / appscript_for_website_monitor.md
Created Jan 12, 2023
Google App script for the website monitor and updates via slack or email
View appscript_for_website_monitor.md

Google App script for the website monitor and updates via slack or email

  • Customizable as per needed
function init(){
  const urls = [
    "URL_1",
    "URL_2",
  ];
View phpcs-tips.md

PHP setup useful commands

phpcs_ipath=$(phpcs --config-show installed_paths); oldpath=${phpcs_ipath##*:}; phpcs --config-set installed_paths ${oldpath},$(pwd)
@vanpariyar
vanpariyar / country-code-with-utc-time-and-name.json
Created Dec 7, 2022
This file includes countries with iso2code with the given time zone
View country-code-with-utc-time-and-name.json
[
{
"Country Code": "AF",
"Country Name": "Afghanistan",
"GMT Offset": "UTC+04:30"
},
{
"Country Code": "AL",
"Country Name": "Albania",
"GMT Offset": "UTC+01:00"
@vanpariyar
vanpariyar / Multisite tricks.md
Created Nov 16, 2022
Some of the useful WordPress VIP CLI & WP CLI commands curated list
View Multisite tricks.md

Individual site If you have a site with slug blog on a WordPress multisite instance using subdomains, you can use the full URL to run a command against the site:

wp --url=blog.example.com

Think of the --url= parameter as any URL you can put in your browser.

Multiple sites Need to run a given WP-CLI command against multiple sites on a WordPress multisite install? You can do so using a combination of wp site list and xargs.

@vanpariyar
vanpariyar / git rollback backup plan with git.md
Last active Nov 15, 2022
Backup Plan - Git Rollback to specific version for the large project
View git rollback backup plan with git.md

This isn't a direct answer to the question but this page comes back when searching for ways to revert a branch's code to a tag release.

Another way is to create a diff between the current state of the branch and the tag you want to revert to and then apply that to the branch. This keeps the version history correct and shows the changes going in then coming back out again.

Assuming your branch is called master and the tag you want to go back to is called 1.1.1

https://stackoverflow.com/questions/6872223/how-do-i-revert-master-branch-to-a-tag-in-git

git checkout 1.1.1
git diff master > ~/diff.patch
@vanpariyar
vanpariyar / Google app script useful function list.md
Created Nov 1, 2022
Google App script day to day working functions that i use for development tasks
View Google app script useful function list.md

get slug from URL and change URL of article links

function GETCONTENTCREATORURL( articleUrl ) {
  const contentSiteUrl = "REPLACE_CONTENTENT_SITE_URL";
  const slug = articleUrl.split('/');
  return contentSiteUrl+slug[ slug.length-2 ]+'/'+slug[ slug.length-1 ];
}
@vanpariyar
vanpariyar / Readme.md
Created Oct 25, 2022
Wordpress HTTPS redirect prevent
View Readme.md

put in wp-config.php file

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
   $_SERVER['HTTPS']='on';
View Server Setup Apache with ubuntu.md

Virtualhost Manage Script

Bash Script to allow create or delete apache/nginx virtual hosts on Ubuntu on a quick way.

Installation

@vanpariyar
vanpariyar / Full Apache2, Multi PHP & MariaDB - Web Server on Ubuntu 18.04 or later Full Installation and Configuration of Apache2, Multiple PHP, MariaDB, phpMyAdmin, LetsEncrypt, HTTP/2, IonCube, Postfix, Dovecot, SPF, DKIM, Roundcube Webmail and Files Permission Commands on Ubuntu 18.04 and 18.10 Web Server
View Full Apache2, Multi PHP & MariaDB - Web Server on Ubuntu 18.04 or later
Complete Installation and Configuration of Apache2, Multiple PHP, MariaDB, phpMyAdmin, LetsEncrypt,
HTTP/2, IonCube, Postfix, Dovecot, SPF, DKIM, Roundcube Webmail and
Files Permission Commands on Ubuntu 18.04 and 18.10 Web Server
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
This is a complete Ubuntu Linux based web server for Website, PHP, SSL, TLS, Database and Email hosting purpose.
Built with the below components for good performance. Also, I tried to make it as secure as possible.
@vanpariyar
vanpariyar / connecting_wordpress_database_unix_domain_socket.md Connecting Wordpress to Database using Unix Domain Socket #wordpress #php
View connecting_wordpress_database_unix_domain_socket.md

Connecting Wordpress to Database using Unix Domain Socket

Do this inside your wp-config.php.

It must be the absolute path to the socket.

define('DB_HOST', 'localhost:' . __DIR__ . '/.mysql/mysql.sock');