Skip to content

Instantly share code, notes, and snippets.

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

Mahesh mahesh247

🏠
Working from home
View GitHub Profile
@mahesh247
mahesh247 / api.js
Last active April 19, 2023 07:33
Meroshare
const users = [
{ username: 'user1', password: 'password1' },
{ username: 'user2', password: 'password2' },
{ username: 'user3', password: 'password3' },
{ username: 'user4', password: 'password4' },
{ username: 'user5', password: 'password5' }
];
async function login(user) {
// Hit the login API and return a Promise with the token
@mahesh247
mahesh247 / Slider.js
Last active April 5, 2022 02:11
WP Block Gists
console.log('HELLO SCRIPT SLIDER');
/**
* Registers a new block provided a unique name and an object defining its behavior.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
import { registerBlockType } from '@wordpress/blocks';
import { __ } from "@wordpress/i18n";
@mahesh247
mahesh247 / admin.jsx
Last active March 28, 2022 02:33
Scroll DEV
import React, { useState, useEffect } from "react";
import reactCSS from 'reactcss';
import { HexColorPicker } from "react-colorful";
import { SketchPicker } from 'react-color';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Shortcode from "./Shortcode.jsx";

Use port in host file

https://stackoverflow.com/questions/8652948/using-port-number-in-windows-host-file

netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.65.43.80 connectport=8080 connectaddress=127.0.0.1

I managed to achieve this by using Windows included Networking tool netsh.

As Mat points out : The hosts file is for host name resolution only, so a combination of the two did the trick for me.

Example

@mahesh247
mahesh247 / GruntFile-Theme.js
Last active March 25, 2022 10:00
WordPress Devs
/**
*
* HOW TO USE GRUNT
*
* FOR SINGLE THEME: grunt --theme=THEME_NAME (ct/adonis) use relative path
* FOR ALL CT THEMES: grunt uglify:ct
* FOR ALL WEN THEMES: grunt uglify:wen
*/
module.exports = function(grunt) {
@mahesh247
mahesh247 / Patterns.php
Last active March 25, 2022 09:54
Composer for autoload php classes
<?php
/* Register Patterns */
namespace FSE;
use WP_Block_Pattern_Categories_Registry;
class Patterns {
/**
@mahesh247
mahesh247 / wp-config.php
Last active March 25, 2022 14:17
wp-config for wordpress development
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the web site, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
@mahesh247
mahesh247 / cert.conf
Last active March 19, 2020 08:31
Xampp Certificate for SSL
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
/*
Theme Name: Catch Responsive Child Theme
Theme URI: http://catchthemes.com/themes/catch-responsive
Author: Catch Themes Team
Author URI: http://catchthemes.com
Description: Catch Responsive is an extremely flexible and customizable WordPress theme suitable for almost any kind of professional website. It is based on responsive design where each element has been carefully configured for perfect display on all devices and platforms. It is built in HTML5, CSS3 and WordPress Theme Customizer for real time customization. It comes with a wide variety of options so you can modify layout, styling, featured content, promotion headline, featured slider, pagination, icons, menus, breadcrumb, widgets and much more, directly from theme customizer. This theme is translation ready and also currently translated in Swedish. Check out Theme Instructions at http://catchthemes.com/theme-instructions/catch-responsive/, Support at http://catchthemes.com/support/ and Demo at http://catchthemes.com/demo/catch-responsive/
Version:
<?php
function theme_enqueue_styles() {
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
);
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );