Skip to content

Instantly share code, notes, and snippets.

View asharirfan's full-sized avatar

Ashar Irfan asharirfan

View GitHub Profile
@asharirfan
asharirfan / eslint.js.md
Last active January 23, 2023 10:45
Introducing ESLint in your JS workflow

Introducing ESLint in Your JS Workflow

👀 TL;DR

  1. ESLint is a modern linting tool for JS development to make your code consistent and bug free.
  2. Use npm install eslint --global to install ESLint globally.
  3. Go to your project in the terminal and run eslint --init to initiate and setup linting for your project.
  4. Install and automate your workflow in VSCode using ESLint extension.

📦 Step 1: Installation

To install ESLint, you need Node — version greater or equal to 4.0 — and npm — version greater or equal to 2. Open the terminal and enter npm install eslint --global. This command will install ESLint globally in your computer.

@asharirfan
asharirfan / ReadMe.md
Last active June 10, 2022 17:10
How to Generate a Static Website Using GatsbyJS & Host the Website on Linode Server

How to Generate a Static Website Using GatsbyJS & Host the Website on Linode Server

  • Login to https://www.linode.com & create a linode server.

  • Install Ubuntu Latest LTS — Long Term Support — version on it.

  • Login to the server using SSH.

  • Install easy engine on it.

@asharirfan
asharirfan / useful-wpcli-commands.sh
Created March 31, 2022 19:28
Some useful WP CLI commands
# Add username to all subsites on a multisite as administrator
for site in $(wp site list --field=url); do wp user set-role myusername administrator --url=$site; done
@asharirfan
asharirfan / test-db.php
Last active March 15, 2022 20:40
🚀 📦 🔥 Create and test connection to an external database in WordPress using this plugin. ⚠️NOTE: Change the values of the constants according to your database.
<?php
/**
* Plugin Name: WP Test External DB
* Plugin URI: https://asharirfan.com
* Description: Create and test connection to an external WordPress database.
* Author: Ashar Irfan
* Version: 1.0.0
* Text Domain: test-db
* Author URI: https://asharirfan.com/
* License: GPL2
@asharirfan
asharirfan / index.js
Created September 21, 2020 16:49
Testing Gists
console.log( 'Ashar Irfan' );
@asharirfan
asharirfan / webpack.config.js
Last active April 1, 2020 16:31
Webpack config to extend the default configurations of wp-scripts
/**
* Webpack Custom Config.
*/
const path = require("path");
const postcssPresetEnv = require("postcss-preset-env");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");
const defaultConfig = require("@wordpress/scripts/config/webpack.config");
const { mode, entry, output, resolve, plugins, stats } = defaultConfig;
@asharirfan
asharirfan / guq-cirs-meta-data-youtube-video.php
Created February 11, 2020 10:04
GUQ CIRS Drupal View Export Source YouTube Video Meta Data
$view = new view();
$view->name = 'meta_data_youtube_video';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Meta Data YouTube Video';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@asharirfan
asharirfan / guq-cirs-meta-data-research-project.php
Last active February 11, 2020 10:03
GUQ CIRS Drupal View Export Source Research Project Meta Data
$view = new view();
$view->name = 'meta_data_research_project';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Meta Data Research Project';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@asharirfan
asharirfan / guq-cirs-meta-data-publication.php
Created February 11, 2020 09:20
GUQ CIRS Drupal View Export Source Publication Meta Data
$view = new view();
$view->name = 'meta_data_publication';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Meta Data Publication';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@asharirfan
asharirfan / guq-cirs-meta-data-news-item.php
Created February 11, 2020 08:59
GUQ CIRS Drupal View Export Source News Item Meta Data
$view = new view();
$view->name = 'meta_data_news_item';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Meta Data News Item';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */