Skip to content

Instantly share code, notes, and snippets.

View jatinkumar725's full-sized avatar

Jatin Kumar jatinkumar725

View GitHub Profile
@jatinkumar725
jatinkumar725 / SideBar.jsx
Created February 12, 2023 08:38
Build First React App ( Updated SideBar.jsx )
import React from 'react'
import { Link } from 'react-router-dom';
const SideBar = () => {
return (
<div className="col-2 px-0 bg-dark border-right text-center position-fixed">
<nav style={{ height: '100vh' }}>
<h3 className="pt-4 pl-3 text-light">React App</h3>
<hr className='bg-white' style={{ height: "3px" }}/>
@jatinkumar725
jatinkumar725 / App.js
Created February 12, 2023 08:36
Build First React App ( Updated App.js )
import About from './Pages/About';
import Home from './Pages/Home';
import Contact from './Pages/Contact';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import SideBar from './Components/SideBar';
const App = () => {
return (
<div className="container-fluid">
@jatinkumar725
jatinkumar725 / App.js
Created February 12, 2023 08:33
Build First React App
import Home from './Pages/Home';
import SideBar from './Components/SideBar';
const App = () => {
return (
<div className="container-fluid">
<div className="row">
<SideBar />
<div className="col-10 mt-4" style={{ marginLeft: "210px" }}>
@jatinkumar725
jatinkumar725 / SideBar.jsx
Created February 12, 2023 08:32
Build First React App
import React from 'react'
const SideBar = () => {
return (
<div className="col-2 ps-0">
<nav className="bg-dark border-right text-center" style={{ height: '100vh' }}>
<h3 className="pt-4 pl-3 text-light">React App</h3>
<hr className='bg-white' style={{ height: "3px" }}/>
<p className="pt-3">
@jatinkumar725
jatinkumar725 / Contact.jsx
Last active February 12, 2023 08:42
Build First React App
import React from "react";
const Contact = () => {
return (
<>
<h2 className="text-center mb-4">
Contact us
</h2>
<form
id="contact-form"
@jatinkumar725
jatinkumar725 / About.jsx
Created February 12, 2023 08:30
Build First React App
import React from 'react'
import AboutImage from './../Public/img/photo.jpg';
const About = () => {
return (
<>
<h2 className="text-center">
ABOUT US
</h2>
@jatinkumar725
jatinkumar725 / Home.jsx
Created February 12, 2023 08:29
Build First React App
import React from 'react'
import HomeImage from './../Public/img/bandmember.jpg';
const Home = () => {
return (
<>
<h2>THE BAND</h2>
<p className="text-secondary">
<i>We love music</i>
@jatinkumar725
jatinkumar725 / server.js
Created February 5, 2023 13:06
Utilize Browser Caching in NodeJS
var express = require('express');
var app = express();
app.use(express.static('public', { maxAge: '1y' }));
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
@jatinkumar725
jatinkumar725 / .htaccess
Created February 5, 2023 13:05
Utilize Browser Caching with htaccess
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
@jatinkumar725
jatinkumar725 / index.js
Created February 5, 2023 13:03
Solution: Event Handler
const input = document.getElementById("myInput");
let timeoutId;
input.addEventListener("input", function() {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
console.log("input changed");
}, 500);
});