Skip to content

Instantly share code, notes, and snippets.

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

Ronak J Vanpariya vanpariyar

🏠
Working from home
View GitHub Profile
@vanpariyar
vanpariyar / git rollback backup plan with git.md
Last active November 15, 2022 09:54
Backup Plan - Git Rollback to specific version for the large project

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 November 1, 2022 07:55
Google App script day to day working functions that i use for development tasks

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
Last active March 25, 2023 17:08
Wordpress HTTPS redirect prevent

put in wp-config.php file

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false){
   $_SERVER['HTTPS']='on';
}   

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
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
Created August 26, 2022 07:57 — forked from CMCDragonkai/connecting_wordpress_database_unix_domain_socket.md
Connecting Wordpress to Database using Unix Domain Socket #wordpress #php

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');
@vanpariyar
vanpariyar / change_render_callback.php
Created August 2, 2022 07:22
change gutenberg block's render callback
add_filter('register_block_type_args', function ($settings, $name) {
if ($name == 'demo/content-with-sidebar') {
$settings['render_callback'] = 'demo_blocks_content_with_sidebar';
}
return $settings;
}, null, 2);
@vanpariyar
vanpariyar / bootstrap-pagination.php
Created August 1, 2022 09:17 — forked from ediamin/bootstrap-pagination.php
Bootstrap Pagination for WordPress
/*
* custom pagination with bootstrap .pagination class
* source: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/
*/
function bootstrap_pagination( $echo = true ) {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
@vanpariyar
vanpariyar / quotes.json
Created July 8, 2022 04:58 — forked from nasrulhazim/quotes.json
Quotes List in JSON Format
{
"quotes": [
{
"quote":"Life isn’t about getting and having, it’s about giving and being.","author":"Kevin Kruse"},
{
"quote":"Whatever the mind of man can conceive and believe, it can achieve.","author":"Napoleon Hill"},
{
"quote":"Strive not to be a success, but rather to be of value.","author":"Albert Einstein"},
{
@vanpariyar
vanpariyar / SlackApp.gs
Created July 2, 2022 08:43 — forked from seratch/SlackApp.gs
Slack App in Google Apps Script
// *** Request Verification ***
// The currently recommended way is to verify request signature: https://api.slack.com/authentication/verifying-requests-from-slack
// Unfortunately, GAS web apps don"t have means to access request headers. Thus, this example uses the old way to verify requests.
// >>> Settings > Basic Information > App Credentials > Verification Token
const legacyVerificationToken = PropertiesService.getScriptProperties().getProperty("SLACK_VERIFICATION_TOKEN");
// *** OAuth Access Token ***
// Install your Slack app into its development workspace.
// >>> Settings > Install App > Bot User OAuth Access Token
const token = PropertiesService.getScriptProperties().getProperty("SLACK_BOT_TOKEN");