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 / code.md
Created August 20, 2024 06:20
How to Migrate website Database from Mysql to Sqlite or vice versa

Hey! I was experimenting with moving site data in and out of SQLite with this plugin. The import step in was pretty straightforward using the following script:

#!/bin/bash

# Export WordPress database to a SQL file
wp db export wordpress.sql

# Convert MySQL to SQLite compatible SQL using https://github.com/dumblob/mysql2sqlite
mysql2sqlite.sh wordpress.sql > wordpress.sqlite
@vanpariyar
vanpariyar / file.md
Created February 14, 2024 09:37
How to fix Unix socket error in Docker in WSL2

Unix Error that i get

Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Solution 💡

Run on Terminal

@vanpariyar
vanpariyar / My customise code files for wordpress.md
Created September 26, 2023 08:50
Day to day customisation needed for code so making one plugin to reuse in every plugin
class Customise_WordPress {

  function __construct($name) {
  // Remove the REST API HTML entities.
    $post_type = "post";
    add_filter( 'rest_prepare_ . $post_type', array( $this, 'decode_rest_api_title' ), 20, 3 );
  }
  
 /**
@vanpariyar
vanpariyar / get_title_permalink_mysql.md
Created May 12, 2023 12:06
Get permalink and title from the database WordPress
@vanpariyar
vanpariyar / register_callback for dynamic block.md
Created April 24, 2023 07:00
Register callback for dynamic block from PHP

Try This one on your functions.php or main Plugin file

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);
<?xml version="1.0" encoding="UTF-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xmlns:tts="http://www.w3.org/ns/ttml#styling" xml:lang="en">
<head />
<body region="subtitleArea">
<p begin="0.27s" dur="">વર્ડપ્રેસ શીખવા માટે આપનું સ્વાગત છે. અમે સાથે જોડાઓ કારણ કે આપણે સાથે વધુ પરિચિત થઈએ છીએ</p>
<p begin="4.44s" dur="">ડેશબોર્ડ. તમારી સાઇટ પર login કરવા માટે, વેબ બ્રાઉઝર સરનામાંમાં નીચેના દાખલ કરો</p>
<p begin="9.93s" dur="">બાર, તમારી વિગતો ભરો અને login પર ક્લિક કરો. એકવાર અમે ડેશબોર્ડમાં login કરીએ,</p>
<p begin="16.23s" dur="">અમે ટોચ પર એડમિન બાર જોઈ શકીએ છીએ અને જ્યારે તમે વર્ડપ્રેસ આયકન પર ફરતા હોવ ત્યારે,</p>
<p begin="21.69s" dur="">ચાર લિંક્સ સાથે ગતિશીલ મેનૂ દેખાય છે. WordPress.org મુખ્ય સાથે લિંક્સ</p>
<p begin="26.64s" dur="">વર્ડપ્રેસ સાઇટ. સત્તાવાર વર્ડપ્રેસ સપોર્ટ સાથે દસ્તાવેજીકરણ લિંક્સ</p>
@vanpariyar
vanpariyar / googleappscript_wordpress.gs
Last active September 15, 2023 06:57
get WordPress URL to the google sheet with sheetwise
const websiteUrl = "";
function mainLoop(){
// createSheets();
fetchApi( websiteUrl );
}
const headersList = {
"Accept": "*/*",
"User-Agent": "Thunder Client (https://www.thunderclient.com)",
@vanpariyar
vanpariyar / appscript_for_website_monitor.md
Created January 12, 2023 11:29
Google App script for the website monitor and updates via slack or email

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",
  ];

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 December 7, 2022 07:43
This file includes countries with iso2code with the given time zone
[
{
"Country Code": "AF",
"Country Name": "Afghanistan",
"GMT Offset": "UTC+04:30"
},
{
"Country Code": "AL",
"Country Name": "Albania",
"GMT Offset": "UTC+01:00"