Skip to content

Instantly share code, notes, and snippets.

View YasirGaji's full-sized avatar
◼️
Unconfused Focus

Yasir Gaji YasirGaji

◼️
Unconfused Focus
View GitHub Profile
@YasirGaji
YasirGaji / NUl.jsx
Last active November 14, 2023 00:51
New way to render lists by using the declared static constants
import { leftsidebarLinks } from '@/constants';
type INavLink = {
imgURL: string;
route: string;
label: string;
};
const LeftSidebar = () => {
@YasirGaji
YasirGaji / index.js
Created November 13, 2023 19:49
A constatnt file representation of static code to be declared
export const leftsidebarLinks = [
{
route: "/",
label: "Home",
},
{
route: "/settings",
label: "Settings",
},
{
@YasirGaji
YasirGaji / ul.jsx
Last active November 13, 2023 20:00
Unordered List in JSX
const LeftSidebar = () => {
return (
<nav className='leftsidebar'>
<ul className='flex flex-col gap-6'>
<li>
<NavLink to="/">Home</NavLink>
</li>
<li>
<NavLink to="/settings">Settings</NavLink>
</li>
@YasirGaji
YasirGaji / tw.sh
Last active March 21, 2023 11:43
Twin Macro 'fs' module error code rep | 1
npm i -D babel-plugin-twin
@YasirGaji
YasirGaji / regex10.js
Created February 23, 2022 10:39
This script shows how the wild skip "*" flag functions on a regular expression for the "Regular Expressions in Javascript" article by Yasir Gaji
// THE WILD SKIP FLAG DEMONSTRATION
const wildSkipFlagStatement = /G*i/; // declaring the regular expression
const thePassingStatement = 'G33167893hfaskj$&.i'; // passing multiple characters inplace of the flag
const theResult = thePassingStatement.match(wildSkipFlagStatement); //valuating...
console.log(theResult); //logging result.
@YasirGaji
YasirGaji / regex9.js
Created February 23, 2022 09:48
This script shows how the skip "." and global "g" flag functions on a regular expression for the "Regular Expressions in Javascript" article by Yasir Gaji
// THE SKIP FLAG DEMONSTRATION
const skipFlagStatement = /Y.sir/g; //declaring a regular expression with the skip and global flag
const thePassingStatement = 'Yasir, Yusir, and Ynsir is allowed thanks to the skip flag which permits any letter inplace of the flag character';
const theResult = thePassingStatement.match(skipFlagStatement); // valuating...
console.log(theResult); // returning the result
@YasirGaji
YasirGaji / regex8.js
Created February 22, 2022 17:47
This script shows how to valuate a regular expression using the "replace()" function for the "Regular Expressions in Javascript" article by Yasir Gaji
// VALUATING THE REGULAR EXPRESSION USING THE "replace()" FUNCTION
const stillTheFirstWay = /words between slahses/; //declared regular expression
const anExpression = 'The words between slahses has been replaced thanks to the ".replace()" function'; //declared statement
const thereplacedExpression = anExpression.replace(stillTheFirstWay, 'statements'); //valuating
console.log(thereplacedExpression);
@YasirGaji
YasirGaji / regex7.js
Created February 22, 2022 16:56
This script shows how to valuate a regular expression using the "search()" function for the "Regular Expressions in Javascript" article by Yasir Gaji
// VALUATING THE REGULAR EXPRESSION USING THE "search()" FUNCTION
const stillTheFirstWay = /words between slahses/; //declared regular expression
const thePassingStatement = 'this is a sentence with words between slahses being evaluated with the search() function';
const theResult = thePassingStatement.search(stillTheFirstWay);
console.log(theResult);
@YasirGaji
YasirGaji / regex6.js
Created February 22, 2022 16:38
This script shows how to valuate a regular expression using the "match()" function for the "Regular Expressions in Javascript" article by Yasir Gaji
// VALUATING THE REGULAR EXPRESSION USING THE "match()" FUNCTION
const stillTheFirstWay = /words between slahses/; //declared regular expression
const thePassingStatement = 'this is a sentence with words between slahses being evaluated with the match() function';
const theResult = thePassingStatement.match(stillTheFirstWay);
console.log(theResult);
@YasirGaji
YasirGaji / regex5.js
Last active February 22, 2022 16:39
This script shows how to valuate a regular expression using the "test()" function for the "Regular Expressions in Javascript" article by Yasir Gaji
// VALUATING THE REGULAR EXPRESSION USING THE "test()" FUNCTION
const stillTheFirstWay = /words between slahses/; //declaring the regular expression
const theResult = stillTheFirstWay.test('this is a sentence between slahses being evaluated with the test() function');
console.log(theResult); //valuating the expression