Skip to content

Instantly share code, notes, and snippets.

View asharirfan's full-sized avatar

Ashar Irfan asharirfan

View GitHub Profile
@asharirfan
asharirfan / wpc-tell-my-role-file-headers.php
Last active November 13, 2017 15:07
WPC — Tell My Role plugin headers.
<?php
/**
* Plugin Name: Tell My Role
* Plugin URI: https://WPCouple.com
* Description: A plugin to display user roles in WordPress dashboard.
* Version: 1.0.0
* Author: WPCouple
* Author URI: https://WPCouple.com
* Contributors: WPCouple, mrasharirfan
* License: GPL-2.0+
@asharirfan
asharirfan / wpc-print-user-roles.php
Last active November 15, 2017 15:32
WPC — Print current user roles in WP admin dashboard 💯
<?php
/**
* Tell My Role.
*
* Get the roles of current user and display it.
*
* @since 1.0.0
*/
function tmr_display_current_user_role() {
// Get current user.
<?php
/**
* Style the Display.
*
* This method styles the user roles.
*
* @since 1.0.0
*/
function tmr_style_display() {
?>
@asharirfan
asharirfan / tmr-settings.php
Last active November 24, 2017 13:35
WPC — Settings for Tell My Role plugin.
<?php
/**
* Settings Init.
*
* Initialize settings for the plugin.
*
* @since 1.0.0
*/
function tmr_settings_init() {
// Register a new setting for `general` page.
@asharirfan
asharirfan / tmr-print-user-roles-with-setting.php
Created November 27, 2017 14:23
WPC — Print current user roles in WP admin dashboard with Custom Setting 💯
<?php
/**
* Tell My Role.
*
* Get the roles of current user and display it.
*
* @since 1.0.0
*/
function tmr_display_current_user_role() {
// Get current user.
@asharirfan
asharirfan / tmr-custom-page-settings.php
Created November 27, 2017 15:58
WPC — Settings on a Custom Settings page for Tell My Role plugin 💯
<?php
/**
* Settings Init.
*
* Initialize settings for the plugin.
*
* @since 1.0.0
*/
function tmr_settings_init() {
// Register a new section in the "tmr-options-page" page.
@asharirfan
asharirfan / git-commit-emojis.md
Created February 5, 2018 15:51 — forked from jhermann/git-commit-emojis.md
Useful emoji for git commit messages

Useful emoji for git commit messages

If you add emoji to your commit messages for a GitHub repo, they become less boring, and you can convey the kind of change you're adding. See the full set of GitHub supported emoji here (also useful for easy copy&paste via a simple click).

Example commit message

The following is a possible scheme to use:

@asharirfan
asharirfan / eslint.js.md
Last active September 20, 2024 15:50
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 / reset-post-time.php
Created February 11, 2018 17:14
WordPress Plugin — Reset Post Time
<?php
/**
* Plugin Name: Reset Post Time
* Plugin URI: https://github.com/asharirfan/reset-post-time
* Description: WordPress plugin to set the seconds of publish/schedule time of post types to zero.
* Author: mrasharirfan
* Author URI: https://AsharIrfan.com/
* Version: 1.0.0
* License: GPL2+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@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