Skip to content

Instantly share code, notes, and snippets.

View emailjohnthomascaballero's full-sized avatar
H̵͌̅́̆̎̄͑͘EL̴̚O̷ ̸̢̃͛̃͑̋̐̔̕W̸̗͆̀̂͋̍͘Ơ̵̞̼͋̃̏͌͝R̷̫̯̦̻͍̈̀͛̏̃́̏͜͝L̵̊͊͐̀̔̐̌͘D̵

JOHN THOMAS F. CABALLERO emailjohnthomascaballero

H̵͌̅́̆̎̄͑͘EL̴̚O̷ ̸̢̃͛̃͑̋̐̔̕W̸̗͆̀̂͋̍͘Ơ̵̞̼͋̃̏͌͝R̷̫̯̦̻͍̈̀͛̏̃́̏͜͝L̵̊͊͐̀̔̐̌͘D̵
View GitHub Profile
// Remove Duplicate in Array:
[...new Set(arr)];
// Ascending Order Numbers in Array:
arr.sort((a, b) => b - a)
// Extracts or Slice the array (starts index 0 then stop in index 2)
arr.slice(0, 2)
@emailjohnthomascaballero
emailjohnthomascaballero / disableRightClickButton.tsx
Created February 20, 2024 15:14
use prevenDefault to prevent right-click event in your mouse to hide possible bugs
<Link
onClick={}
onContextMenu={(e) => e.preventDefault()}
>
<Image
src={`image.png`}
alt={}
width={80}
height={80}
className=""
@emailjohnthomascaballero
emailjohnthomascaballero / nextjsbackbutton.tsx
Last active February 6, 2024 16:51
Next.js back button
{/* SOURCE LINK: https://stackoverflow.com/questions/51843119/next-js-react-go-back-to-the-previous-page */}
import { useRouter } from "next/navigation";
const Header = () => {
const router = useRouter();
return (
<div>
<button onClick={() => router.back()}>
BACK
@emailjohnthomascaballero
emailjohnthomascaballero / form.php
Last active January 19, 2024 01:52
PHP FORM: Prevent Cross-site scripting (XSS)
<!-- SOURCE: https://www.w3schools.com/php/php_form_validation.asp -->
<!--
LOGIC:
htmlspecialchars() - prevent Cross-Site Scripting (XSS) attacks.
trim() - Strip unnecessary characters (extra space, tab, newline).
stripslashes() - Remove backslashes (\).
-->
<!-- SCRIPT -->
@emailjohnthomascaballero
emailjohnthomascaballero / mobile-responsive.css
Last active January 18, 2024 09:43
Responsive Design Cheat Sheet
/* SOURCE LINK: https://www.codeply.com/responsive-design-cheatsheet.html */
/* Bootstrap /*
/* Extra small devices (phones, less than 768px) */
/* No media query since this is the default in Bootstrap */
/* Small devices (tablets, 768px and up) */