Skip to content

Instantly share code, notes, and snippets.

Avatar
🦜
Talk is cheap. Check My Code, Blog and Portfolio.

Shameem Reza shameemreza

🦜
Talk is cheap. Check My Code, Blog and Portfolio.
View GitHub Profile
@shameemreza
shameemreza / removing-options-from-the-product-data-panel-in-woocommerce.php
Created April 5, 2023 07:15
Add or remove the PHP comment (//) before a tab that you need to remove or show. Detailed guide: https://shameem.me/removing-options-from-the-product-data-panel-in-woocommerce
View removing-options-from-the-product-data-panel-in-woocommerce.php
// Remove options from the Product Data Panel in WooCommerce
function remove_product_data_tabs( $tabs ) {
//unset( $tabs['general'] );
unset( $tabs['inventory'] );
unset( $tabs['shipping'] );
unset( $tabs['linked_product'] );
//unset( $tabs['attribute'] );
//unset( $tabs['variations'] );
//unset( $tabs['advanced'] );
return $tabs;
@shameemreza
shameemreza / forwardRef-anduseRef-2.jsx
Created April 2, 2023 13:42
Code for "Exposing React Component functions with fowardRef and useRef" Article
View forwardRef-anduseRef-2.jsx
import { useRef } from 'react';
import { Input } from './Input';
const App = () => {
const inputRef = useRef(null);
const handleSubmit = (event) => {
event.preventDefault();
const value = inputRef.current.getValue();
@shameemreza
shameemreza / forwardRef-anduseRef.jsx
Created April 2, 2023 13:41
Code for "Exposing React Component functions with fowardRef and useRef" Article
View forwardRef-anduseRef.jsx
import { forwardRef, useRef } from 'react';
const Input = forwardRef((props, ref) => {
const inputRef = useRef(null);
const getValue = () => {
return inputRef.current.value;
}
const isValid = () => {
@shameemreza
shameemreza / rendering-array-map.js
Created March 31, 2023 17:19
Code for the "How to Render an Array of Objects in React?" Article.
View rendering-array-map.js
import React from "react";
function EmployeeList(props) {
const employees = props.employees;
const employeeList = employees.map((employee) => (
<div key={employee.id}>
<h2>{employee.name}</h2>
<p>Age: {employee.age}</p>
<p>Position: {employee.position}</p>
@shameemreza
shameemreza / passing-array-as-prop.js
Created March 31, 2023 17:14
Code for the "How to Render an Array of Objects in React?" Article.
View passing-array-as-prop.js
import React from "react";
import EmployeeList from "./EmployeeList";
function App() {
const employees = [
{ name: "John Doe", age: 25, position: "Software Engineer" },
{ name: "Jane Smith", age: 32, position: "Product Manager" },
{ name: "Mike Johnson", age: 27, position: "UI/UX Designer" },
{ name: "Sarah Lee", age: 30, position: "Marketing Manager" },
];
@shameemreza
shameemreza / passing-props.js
Created March 31, 2023 17:13
Code for the "How to Render an Array of Objects in React?" Article.
View passing-props.js
import React from "react";
function EmployeeList(props) {
const employees = props.employees;
const employeeList = employees.map((employee) => (
<tr key={employee.name}>
<td>{employee.name}</td>
<td>{employee.age}</td>
<td>{employee.position}</td>
@shameemreza
shameemreza / styling-array-list.css
Created March 31, 2023 17:12
Code for the "How to Render an Array of Objects in React?" Article.
View styling-array-list.css
table {
border-collapse: collapse;
width: 100%;
margin: 0 auto;
font-family: Arial, sans-serif;
}
thead th {
background-color: #5f9ea0;
color: white;
@shameemreza
shameemreza / render-employees-list.js
Created March 31, 2023 17:10
Code for the "How to Render an Array of Objects in React?" Article.
View render-employees-list.js
import React from "react";
import EmployeeList from "./EmployeeList";
function App() {
const employees = [
{ name: "John Doe", age: 25, position: "Software Engineer" },
{ name: "Jane Smith", age: 32, position: "Product Manager" },
{ name: "Mike Johnson", age: 27, position: "UI/UX Designer" },
{ name: "Sarah Lee", age: 30, position: "Marketing Manager" },
];
@shameemreza
shameemreza / mp-through-array-of-objects.js
Created March 31, 2023 17:08
Code for the "How to Render an Array of Objects in React?" Article.
View mp-through-array-of-objects.js
import React from "react";
function EmployeeList() {
const employees = [
{ name: "John Doe", age: 25, position: "Software Engineer" },
{ name: "Jane Smith", age: 32, position: "Product Manager" },
{ name: "Mike Johnson", age: 27, position: "UI/UX Designer" },
{ name: "Sarah Lee", age: 30, position: "Marketing Manager" },
];