Skip to content

Instantly share code, notes, and snippets.

View Ebrahim-Ramadan's full-sized avatar

Ebrahim Ramadan Ebrahim-Ramadan

View GitHub Profile
@Ebrahim-Ramadan
Ebrahim-Ramadan / ThreeDPhotoCarousel.jsx
Created June 19, 2024 19:17
3d carousel (local pics) react component
'use client'
import React, { useState, useEffect } from "react";
import { motion, useAnimation, useMotionValue, useTransform } from "framer-motion";
import Image from "next/image";
import { RightArrow } from "../globals/Icons";
const images = [];
for (let i = 1; i <= 14; i++) {
images.push(import(`@/assets/quick-carousel/${i}.webp`).then(module => module.default));
}
@Ebrahim-Ramadan
Ebrahim-Ramadan / Header.jsx
Created June 19, 2024 19:16
floating header react component
'use client';
import Image from 'next/image';
import React, { useEffect, useState } from 'react';
import { HomeIcon , ProjectsIcon, ExperienceIcon, BehanceIcon, Behance} from './Icons';
import { MagneticBackgroundTab } from './MagneticBackgroundTab';
export const Header = () => {
const [isSticky, setIsSticky] = useState(false);
useEffect(() => {
'use client';
import { useRotateYValues } from "@/utils/customHooks";
import { motion, useMotionValue } from "framer-motion";
import { useState } from "react";
import { AI, Motion, Gears, Code, Cube } from "../globals/Icons";
const ITEMS = [
{
@Ebrahim-Ramadan
Ebrahim-Ramadan / Fixed Drawer.jsx
Created June 19, 2024 19:14
drawer fixed as menu react component
'use client'
import { AnimatePresence, motion } from "framer-motion";
import Image from "next/image";
import React, { useState, useEffect, useRef } from "react";
import { copyToClipboard } from "@/utils/Copy";
import { DockDemo } from "../ContactMe/DockDemo";
export default function FixedDrawer() {
const refMenu = useRef(null);
const [openMenu, setOpenMenu] = useState(false);
const [Copied, setCopied] = useState(false);
'use client';
import Image from 'next/image';
import { Drawer } from 'vaul';
import { RightArrow } from '../Icons';
export function DrawerComponent() {
return (
<Drawer.Root shouldScaleBackground>
@Ebrahim-Ramadan
Ebrahim-Ramadan / index.htm
Created June 19, 2024 16:22
blur bg animating
<body>
<div style="filter: blur(1px);pointer-events:none;position:fixed;min-width:100%;margin-top:0;height:180%;top:50%;left:50%;transform:translateX(-50%) translateY(-50%);z-index:0;opacity:0.3">
<div style="border-radius:99999px;position:absolute;top:50%;left:50%;width:100vw;min-width:1000px;height:100vh;transform:translate(-50%, -50%) scale(0.6);overflow:hidden">
<div class="ColorBlobs_SpinningGradient__DpGtx" style="position:absolute;top:50%;left:50%;width:100vw;height:100vw;transform:translate(-50%, -50%)"
animation: ColorBlobs_spin__CbrXa 8s linear infinite;
background: conic-gradient(from 0deg, #08f, #f60, #bbffa1, #4c00ff, #ab2666, #09f);
></div>
</div></div>
@Ebrahim-Ramadan
Ebrahim-Ramadan / LazyLoad.jsx
Created June 12, 2024 11:50
Nextjs component handling the visibility detection using the Intersection Observer js web standard API. This cuold help reduce the initial amount of bytes sent thru the first glance to the browser.
'use client';
import { useEffect, useRef, useState } from 'react';
export const LazyLoad = ({ children }) => {
const [isVisible, setIsVisible] = useState(false);
const ref = useRef();
useEffect(() => {
const observer = new IntersectionObserver(
([entry]) => {
@Ebrahim-Ramadan
Ebrahim-Ramadan / ass.py
Last active December 21, 2023 07:32
paper-citation-project
import time
from collections import defaultdict
# readign nodes data from nodes.csv
def read_nodes(file):
with open(file, 'r', encoding='utf-8') as f:
lines = f.readlines()[1:] # Skip header
nodes = {}
@Ebrahim-Ramadan
Ebrahim-Ramadan / script.js
Created December 11, 2023 02:00
matlap script to solve first-order ODEs
function solveFirstOrderODE()
function dydx = myODE(x, y)
dydx = -2 * x * y; %lets say dy/dx​=−2xy
end
% Define the range of x values
xspan = [0 5]; % Define the start and end values of x
% Define the initial condition y(x0) = y0
@Ebrahim-Ramadan
Ebrahim-Ramadan / index.js
Created October 9, 2023 09:16
send 20 emails in one command - nodejs
const nodemailer = require('nodemailer');
const fs = require('fs');
// Create a transporter using Gmail SMTP
const transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: 'ramadanebrahim791@gmail.com', // Your Gmail address
pass: 'your Application-specific password here', // Your Application-specific password
},