├── .gitignore ├── .gitmodules ├── BATCH_10 ├── css_1.html ├── deepak │ └── flex.html ├── inputs.html └── styles.css ├── BATCH_11 ├── README.md ├── demo_app │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── robots.txt │ └── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── components │ │ ├── Button.jsx │ │ ├── Footer.jsx │ │ └── Header.jsx │ │ ├── index.css │ │ ├── index.js │ │ ├── logo.svg │ │ ├── reportWebVitals.js │ │ └── setupTests.js ├── index.html └── microservices │ ├── carts │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ └── package.json │ ├── products │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ └── package.json │ └── users │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ └── package.json ├── BATCH_12 ├── README.md └── backend │ ├── api_1 │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── passing_params.js │ ├── api_2 │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── passing_params_query.js │ ├── ecommerce │ ├── .eslintrc.json │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── eslint.config.js │ ├── loader.mjs │ ├── nodemon.json │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── config │ │ │ └── db.ts │ │ ├── controllers │ │ │ └── products.controllers.ts │ │ ├── index.ts │ │ ├── middlewares │ │ │ └── sample.ts │ │ ├── models │ │ │ └── sample.ts │ │ ├── routes │ │ │ └── products.routes.ts │ │ └── utils │ │ │ └── JsonResponse.ts │ └── tsconfig.json │ ├── hashing │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ └── package.json │ └── mongo_db_1 │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── src │ └── config │ └── db.js ├── BATCH_13 ├── Css │ ├── position_p1 copy.html │ └── position_p1.html └── README.md ├── BATCH_14 ├── README.md ├── backend │ ├── ecommerce │ │ ├── .gitignore │ │ ├── index.js │ │ ├── package-lock.json │ │ ├── package.json │ │ └── src │ │ │ ├── config │ │ │ └── connectDB.js │ │ │ ├── controllers │ │ │ └── auth.controller.js │ │ │ ├── models │ │ │ └── auth.model.js │ │ │ ├── routes │ │ │ ├── auth.routes.js │ │ │ └── products.routes.js │ │ │ └── services │ │ │ └── auth.services.js │ ├── ecommerce_modern │ │ ├── .gitignore │ │ ├── index.js │ │ ├── package-lock.json │ │ ├── package.json │ │ └── src │ │ │ ├── config │ │ │ └── connectDB.js │ │ │ ├── features │ │ │ └── auth │ │ │ │ ├── auth.controller.js │ │ │ │ ├── auth.model.js │ │ │ │ ├── auth.routes.js │ │ │ │ └── auth.services.js │ │ │ └── shared │ │ │ └── utils │ │ │ ├── hashing.js │ │ │ └── jwt.js │ ├── modules │ │ ├── asset │ │ │ └── hello2.txt │ │ ├── functions.js │ │ ├── hello2.txt │ │ ├── hello3.txt │ │ ├── hello_shortcut.txt │ │ ├── index.js │ │ ├── package.json │ │ ├── path.js │ │ └── question1.js │ ├── mongodb │ │ ├── .gitignore │ │ ├── connectDB.js │ │ ├── connectDB_local.js │ │ ├── index.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ └── src │ │ │ └── models │ │ │ └── movies.model.js │ └── server │ │ ├── .gitignore │ │ ├── index.js │ │ ├── package.json │ │ └── src │ │ └── offline │ │ └── products.json ├── flex.html ├── index2.html └── inputs.html ├── BATCH_16 ├── README.md ├── __pycache__ │ └── math.cpython-312.pyc ├── classes.py ├── conditions.py ├── date_time.py ├── dicta.py ├── file.py ├── functions.py ├── list.py ├── loops.py ├── loops2.py ├── math_methods.py ├── module │ ├── folder_module_import │ │ ├── __pycache__ │ │ │ └── string_utils.cpython-312.pyc │ │ ├── assets │ │ │ └── module │ │ │ │ ├── add.py │ │ │ │ └── string_utils.py │ │ └── main.py │ ├── simple_module_import with alias │ │ ├── __pycache__ │ │ │ └── string_utils.cpython-312.pyc │ │ ├── main.py │ │ └── string_utils.py │ └── simple_module_import │ │ ├── __pycache__ │ │ └── string_utils.cpython-312.pyc │ │ ├── main.py │ │ └── string_utils.py ├── operators.py ├── questions │ ├── 1_table.py │ └── 2_prime.py ├── set.py ├── strings.py ├── tupple.py └── upperc │ ├── .gitignore │ └── name.py ├── BATCH_17 ├── README.md ├── backend │ ├── api │ │ ├── .gitignore │ │ ├── http.js │ │ ├── index.js │ │ └── package.json │ ├── demo │ │ ├── assets │ │ │ ├── assets copy │ │ │ │ ├── hello copy.txt │ │ │ │ └── hello.txt │ │ │ ├── hello copy.txt │ │ │ └── hello.txt │ │ ├── assets2.js │ │ ├── assets2 │ │ │ └── directory.js │ │ ├── dir │ │ ├── directory.js │ │ ├── hello.txt │ │ ├── index.js │ │ ├── package.json │ │ ├── path_module.js │ │ └── timers.js │ ├── mongoose │ │ ├── .gitignore │ │ ├── index.js │ │ ├── mongodb_cli.js │ │ ├── package.json │ │ └── src │ │ │ ├── config │ │ │ ├── db.js │ │ │ └── swagger.js │ │ │ ├── controllers │ │ │ ├── productController.js │ │ │ └── users.controller.js │ │ │ ├── models │ │ │ ├── index.js │ │ │ ├── productModel.js │ │ │ └── users.models.js │ │ │ ├── routes │ │ │ ├── productRoutes.js │ │ │ └── users.route.js │ │ │ └── utils │ │ │ ├── hashing.js │ │ │ ├── jwt.js │ │ │ └── mongooseToSwagger.js │ └── nodemon │ │ ├── index.js │ │ └── package.json └── frontend │ ├── firecommerce │ ├── .gitignore │ ├── README.md │ ├── eslint.config.mjs │ ├── next.config.ts │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── public │ │ ├── file.svg │ │ ├── globe.svg │ │ ├── images │ │ │ ├── flower.webp │ │ │ └── logo.jpg │ │ ├── next.svg │ │ ├── vercel.svg │ │ └── window.svg │ ├── src │ │ ├── app │ │ │ ├── favicon.ico │ │ │ ├── globals.css │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ │ ├── components │ │ │ ├── Header │ │ │ │ ├── Header.module.css │ │ │ │ └── index.tsx │ │ │ ├── Hero │ │ │ │ └── index.tsx │ │ │ └── Product │ │ │ │ ├── Card.tsx │ │ │ │ └── index.tsx │ │ └── constants │ │ │ └── Menus.tsx │ ├── tailwind.config.ts │ └── tsconfig.json │ ├── next-sample │ ├── .gitignore │ ├── README.md │ ├── eslint.config.mjs │ ├── next.config.ts │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── public │ │ ├── file.svg │ │ ├── globe.svg │ │ ├── next.svg │ │ ├── todo.png │ │ ├── vercel.svg │ │ └── window.svg │ ├── src │ │ ├── app │ │ │ ├── api │ │ │ │ └── page.tsx │ │ │ ├── counter │ │ │ │ └── page.tsx │ │ │ ├── effect │ │ │ │ └── page.tsx │ │ │ ├── favicon.ico │ │ │ ├── globals.css │ │ │ ├── layout.tsx │ │ │ ├── memo │ │ │ │ ├── Heavy.jsx │ │ │ │ └── page.tsx │ │ │ ├── page.tsx │ │ │ ├── query │ │ │ │ └── page.tsx │ │ │ ├── reducer │ │ │ │ └── page.tsx │ │ │ ├── ref │ │ │ │ └── page.tsx │ │ │ └── todo │ │ │ │ ├── Todo.tsx │ │ │ │ └── page.tsx │ │ ├── components │ │ │ └── ContextWrapper.tsx │ │ └── services │ │ │ ├── counter.context.tsx │ │ │ └── counter.service.tsx │ ├── tailwind.config.ts │ └── tsconfig.json │ ├── react-router-v7 │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── app │ │ ├── app.css │ │ ├── root.tsx │ │ ├── routes.ts │ │ ├── routes │ │ │ ├── About.tsx │ │ │ ├── Contact.tsx │ │ │ └── home.tsx │ │ └── welcome │ │ │ ├── logo-dark.svg │ │ │ ├── logo-light.svg │ │ │ └── welcome.tsx │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── react-router.config.ts │ ├── tailwind.config.ts │ ├── tsconfig.json │ └── vite.config.ts │ └── sample_001 │ ├── .gitignore │ ├── README.md │ ├── eslint.config.js │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── public │ └── vite.svg │ ├── src │ ├── App.css │ ├── App.jsx │ ├── app │ │ ├── Counter.jsx │ │ └── ListPages.jsx │ ├── assets │ │ └── react.svg │ ├── components │ │ ├── Card.jsx │ │ └── Counter.jsx │ ├── index.css │ └── main.jsx │ └── vite.config.js ├── BATCH_18 ├── README.md ├── css │ ├── animation.html │ ├── asset.svg │ ├── attribute_selector.html │ ├── background.html │ ├── combination-selectors.html │ ├── container.html │ ├── display.html │ ├── flex.html │ ├── flex_2.html │ ├── margin-padding.html │ ├── parent_grouping.html │ ├── position-absolute.html │ ├── position-sticky-fixed.html │ ├── position.html │ ├── pseudo_classes.html │ ├── pseudo_classes_siblings_selectors.html │ ├── pseudo_elements.html │ ├── pseudo_elements_2.html │ ├── responsive.html │ ├── text.css │ ├── text.html │ ├── transform.html │ └── transition.html ├── html.html ├── html │ ├── images │ │ └── Rainforest_Fatu_Hiva.jpg │ ├── inputs.html │ ├── list.html │ ├── media.html │ ├── table.html │ └── videos │ │ └── sample.mp4 ├── js │ ├── dom.html │ └── html.html └── react │ ├── NOTES.md │ ├── classes │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── app │ │ ├── app.css │ │ ├── components │ │ │ └── Navbar.jsx │ │ ├── root.tsx │ │ ├── routes.ts │ │ └── routes │ │ │ ├── api.jsx │ │ │ ├── form.jsx │ │ │ ├── form_2.jsx │ │ │ └── home.jsx │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── public │ │ └── favicon.ico │ ├── react-router.config.ts │ ├── tsconfig.json │ └── vite.config.ts │ ├── multi_page │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── app │ │ ├── app.css │ │ ├── components │ │ │ └── Navbar.tsx │ │ ├── root.tsx │ │ ├── routes.ts │ │ └── routes │ │ │ ├── about.tsx │ │ │ ├── contact.tsx │ │ │ └── home.tsx │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── react-router.config.ts │ ├── tsconfig.json │ └── vite.config.ts │ └── vite-app │ ├── .gitignore │ ├── README.md │ ├── eslint.config.js │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── public │ └── vite.svg │ ├── src │ ├── App.css │ ├── App.tsx │ ├── assets │ │ └── react.svg │ ├── components │ │ ├── Box.tsx │ │ ├── SideEffect.tsx │ │ ├── counter.tsx │ │ └── todo.tsx │ ├── index.css │ ├── main.tsx │ └── vite-env.d.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.node.json │ └── vite.config.ts ├── BATCH_19 ├── CSS │ ├── 11428909.png │ ├── index.html │ ├── oncscreen_animation.html │ ├── selectors_combination.html │ ├── selectors_pseudo_classes.html │ └── transitions.html ├── README.md └── react │ ├── classes │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── app │ │ ├── app.css │ │ ├── root.tsx │ │ ├── routes.ts │ │ ├── routes │ │ │ ├── comp_counter.tsx │ │ │ ├── forms_advance.tsx │ │ │ ├── forms_basic.tsx │ │ │ ├── home.tsx │ │ │ ├── reducer_hook.tsx │ │ │ └── reference_hook.tsx │ │ └── welcome │ │ │ ├── logo-dark.svg │ │ │ └── logo-light.svg │ ├── package.json │ ├── pnpm-lock.yaml │ ├── public │ │ └── favicon.ico │ ├── react-router.config.ts │ ├── tsconfig.json │ └── vite.config.ts │ ├── components_props │ ├── .gitignore │ ├── README.md │ ├── eslint.config.js │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── public │ │ └── vite.svg │ ├── src │ │ ├── App.css │ │ ├── App.jsx │ │ ├── assets │ │ │ └── react.svg │ │ ├── components │ │ │ ├── Box.jsx │ │ │ ├── ChildCounter1.jsx │ │ │ ├── ChildCounter2.jsx │ │ │ └── CounterAdvanced.jsx │ │ ├── index.css │ │ ├── main.jsx │ │ └── pages │ │ │ └── PropsBox.jsx │ └── vite.config.js │ └── multi_page │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── app │ ├── app.css │ ├── components │ │ ├── Header.tsx │ │ └── Slider.tsx │ ├── root.tsx │ ├── routes.ts │ └── routes │ │ ├── about.tsx │ │ ├── contact.tsx │ │ └── home.tsx │ ├── package-lock.json │ ├── package.json │ ├── public │ └── favicon.ico │ ├── react-router.config.ts │ ├── tsconfig.json │ └── vite.config.ts ├── BATCH_20 ├── CSS │ ├── class1.html │ ├── class2.html │ ├── class3.html │ ├── class3_background.html │ ├── class4_flex_1.html │ ├── class5_flex_2.html │ ├── class5_flex_3+flex-grow.html │ ├── class6_flex_4_flex_basis.html │ └── class6_flex_4_flex_shrink.html ├── README.md ├── html │ ├── 1_basic.html │ ├── 2_media.html │ ├── Quesitons │ │ └── question_1.html │ ├── anchor.html │ ├── audio │ │ └── sample.mp3 │ ├── images │ │ └── seat-squatting.jpg │ ├── inputs.html │ ├── inputs_2.html │ ├── multi_page_website │ │ ├── about.html │ │ ├── contact.html │ │ └── index.html │ ├── sun_set.webp │ └── videos │ │ └── sample_1.mp4 └── projects │ └── project3.html ├── BATCH_21 ├── css │ ├── class_5_div.html │ ├── class_5_text.html │ ├── class_6_diff_css.html │ ├── class_6_simple_selector2_class.html │ ├── class_6_simple_selector_id.html │ └── style.css └── html │ ├── assets │ └── img.jpg │ ├── class1.html │ ├── class2.html │ ├── class3.html │ ├── class4_forms.html │ └── landsc_noun_002_20631.jpg ├── BATCH_8 ├── README.md ├── fastapi │ ├── server │ │ ├── .gitignore │ │ └── main.py │ └── todo_simple │ │ ├── __pycache__ │ │ └── main.cpython-313.pyc │ │ └── main.py ├── reactjs │ └── demo-app │ │ ├── .dockerignore │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── app │ │ ├── app.css │ │ ├── root.tsx │ │ ├── routes.ts │ │ └── routes │ │ │ ├── HomePage.jsx │ │ │ └── UseState.jsx │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ └── favicon.ico │ │ ├── react-router.config.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts └── sql │ ├── Visual_SQL_JOINS_V2.png │ ├── alter.sql │ ├── basic.sql │ ├── data_types.sql │ ├── ecommerce.sql │ ├── join.sql │ └── select_sql.sql ├── BATCH_9 ├── Basic │ ├── .gitignore │ ├── file.txt │ ├── package-lock.json │ ├── package.json │ ├── path.js │ └── server.js ├── Mongoose │ ├── .gitignore │ ├── index.js │ ├── models │ │ └── userModel.js │ ├── package-lock.json │ ├── package.json │ └── routes │ │ └── userRoutes.js ├── README.md └── express │ ├── .gitignore │ ├── build │ ├── asset-manifest.json │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ ├── robots.txt │ └── static │ │ ├── css │ │ ├── main.65af164c.css │ │ └── main.65af164c.css.map │ │ └── js │ │ ├── main.e8c10626.js │ │ ├── main.e8c10626.js.LICENSE.txt │ │ └── main.e8c10626.js.map │ ├── index.js │ ├── package-lock.json │ └── package.json ├── FastApi ├── todo_1 │ └── main.py └── todo_2 │ ├── __pycache__ │ ├── db.cpython-311.pyc │ ├── db.cpython-313.pyc │ ├── main.cpython-311.pyc │ ├── main.cpython-313.pyc │ ├── model.cpython-311.pyc │ ├── model.cpython-313.pyc │ ├── schemas.cpython-311.pyc │ ├── schemas.cpython-313.pyc │ ├── service.cpython-311.pyc │ └── service.cpython-313.pyc │ ├── db.py │ ├── environment.yml │ ├── main.py │ ├── model.py │ ├── schemas.py │ └── service.py ├── README.md ├── Training ├── mongodb │ ├── .gitignore │ ├── index.js │ ├── package-lock.json │ └── package.json └── node │ ├── .gitignore │ ├── callbacks.js │ ├── child_process.js │ ├── clustering.js │ ├── events.js │ ├── fs.js │ ├── package-lock.json │ ├── package.json │ └── utils.js ├── advanced └── how_js_runs.md ├── notes └── mongodb.md ├── sample_questions └── timeout_in_loop.js └── test_sets └── js └── set1 ├── q1.js ├── q2.js ├── q3.js ├── q4.js ├── q5.js ├── q8.js └── questions.md /.gitignore: -------------------------------------------------------------------------------- 1 | .git_linux 2 | Node_JS/packages/Sessions/s1_fs/passwords.txt 3 | simple-ecommerce 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "simple-ecommerce"] 2 | path = simple-ecommerce 3 | url = https://github.com/Be1newinner/simple_ecommerce_for_students 4 | -------------------------------------------------------------------------------- /BATCH_10/css_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CSS Day 1 4 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | 28 | 29 | 30 | 31 | 32 | 33 | Vijay 34 | 35 | 36 |

37 | Vijay Kumardsa das dsa 38 | dassa 39 | dsa 40 | dassa dassa 41 | das sa dasas dasas dasd sd as das das das das das das das dasd 42 |

43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /BATCH_10/styles.css: -------------------------------------------------------------------------------- 1 | p { 2 | color:red; 3 | background-color: blue; 4 | } -------------------------------------------------------------------------------- /BATCH_11/README.md: -------------------------------------------------------------------------------- 1 | Students: Ankit Vishal 2 | Start: 2024 -------------------------------------------------------------------------------- /BATCH_11/demo_app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/README.md: -------------------------------------------------------------------------------- 1 | THis is demo Website -------------------------------------------------------------------------------- /BATCH_11/demo_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo_app", 3 | "version": "11.5.4", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.17.0", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "react": "^18.3.1", 10 | "react-dom": "^18.3.1", 11 | "react-scripts": "5.0.1", 12 | "web-vitals": "^2.1.4" 13 | }, 14 | "scripts": { 15 | "start": "react-scripts start", 16 | "build": "react-scripts build", 17 | "test": "react-scripts test", 18 | "eject": "react-scripts eject" 19 | }, 20 | "eslintConfig": { 21 | "extends": [ 22 | "react-app", 23 | "react-app/jest" 24 | ] 25 | }, 26 | "browserslist": { 27 | "production": [ 28 | ">0.2%", 29 | "not dead", 30 | "not op_mini all" 31 | ], 32 | "development": [ 33 | "last 1 chrome version", 34 | "last 1 firefox version", 35 | "last 1 safari version" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_11/demo_app/public/favicon.ico -------------------------------------------------------------------------------- /BATCH_11/demo_app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_11/demo_app/public/logo192.png -------------------------------------------------------------------------------- /BATCH_11/demo_app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_11/demo_app/public/logo512.png -------------------------------------------------------------------------------- /BATCH_11/demo_app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/App.css: -------------------------------------------------------------------------------- 1 | .container { 2 | background-color: red; 3 | } 4 | 5 | header { 6 | height: 50px; 7 | background-color: black; 8 | display: flex; 9 | gap: 10px; 10 | } 11 | 12 | .header_menu { 13 | background-color: grey; 14 | padding: 15px 30px; 15 | } 16 | 17 | .header_menu span { 18 | color: white; 19 | } 20 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/App.js: -------------------------------------------------------------------------------- 1 | import "./App.css"; 2 | import Header from "./components/Header" 3 | import Footer from "./components/Footer" 4 | import Button from "./components/Button"; 5 | import { useState } from "react"; 6 | export default function App() { 7 | 8 | // let count = 0; 9 | const [count, setCount] = useState(0); 10 | 11 | function increaseCount() { 12 | let temp = count; 13 | temp++; 14 | setCount(temp); 15 | } 16 | 17 | return ( 18 |
19 |
20 |
21 |

{count}

22 | 27 | 28 |
29 |
31 | ); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/components/Button.jsx: -------------------------------------------------------------------------------- 1 | export default function Button({ title = "Click me " }) { 2 | return ( 3 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/components/Footer.jsx: -------------------------------------------------------------------------------- 1 | export default function Footer() { 2 | return ; 3 | } 4 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/components/Header.jsx: -------------------------------------------------------------------------------- 1 | export default function Header() { 2 | return ( 3 |
4 |
5 | Home2 6 |
7 |
8 | About 9 |
10 |
11 | contact 12 |
13 |
14 | support 15 |
16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /BATCH_11/demo_app/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /BATCH_11/index.html: -------------------------------------------------------------------------------- 1 | 31 | -------------------------------------------------------------------------------- /BATCH_11/microservices/carts/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /BATCH_11/microservices/carts/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const app = express() 3 | const port = 3000 4 | 5 | app.get('/', (req, res) => { 6 | res.send('Hello Carts!') 7 | }) 8 | 9 | app.listen(port, () => { 10 | console.log(`Example app listening on port ${port}`) 11 | }) -------------------------------------------------------------------------------- /BATCH_11/microservices/carts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "products", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_11/microservices/products/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /BATCH_11/microservices/products/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const app = express() 3 | const port = 3001 4 | 5 | app.get('/', (req, res) => { 6 | res.send('Hello Products!') 7 | }) 8 | 9 | app.listen(port, () => { 10 | console.log(`Example app listening on port ${port}`) 11 | }) -------------------------------------------------------------------------------- /BATCH_11/microservices/products/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "products", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_11/microservices/users/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /BATCH_11/microservices/users/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const app = express() 3 | const port = 3002 4 | 5 | app.get('/', (req, res) => { 6 | res.send('Hello Users!') 7 | }) 8 | 9 | app.listen(port, () => { 10 | console.log(`Example app listening on port ${port}`) 11 | }) -------------------------------------------------------------------------------- /BATCH_11/microservices/users/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "products", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_12/README.md: -------------------------------------------------------------------------------- 1 | Students: Aman, Tahir, Deepak, Tanya 2 | Course: MERN Stack 3 | Start: 2024 -------------------------------------------------------------------------------- /BATCH_12/backend/api_1/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dist 3 | .vscode -------------------------------------------------------------------------------- /BATCH_12/backend/api_1/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | 3 | const app = express() 4 | 5 | app.get("/", (req, res) => { 6 | return res.send({ 7 | message: "Hello how are you" 8 | }) 9 | }) 10 | 11 | app.get("/users", (req, res) => { 12 | return res.send({ 13 | message: "Hello you are at users page" 14 | }) 15 | }) 16 | 17 | app.get("/products", (req, res) => { 18 | return res.send({ 19 | message: "Hello you are at products page" 20 | }) 21 | }) 22 | 23 | app.listen(8000, () => { 24 | console.log("YOU ARE CONNECTED") 25 | }) 26 | -------------------------------------------------------------------------------- /BATCH_12/backend/api_1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api_1", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_12/backend/api_1/passing_params.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | 3 | const app = express() 4 | 5 | app.get("/", (req, res) => { 6 | return res.send({ 7 | message: "Hello how are you" 8 | }) 9 | }) 10 | 11 | app.get("/users", (req, res) => { 12 | return res.send({ 13 | message: "Hello you are at users page" 14 | }) 15 | }) 16 | 17 | app.get("/users/:name", (req, res) => { 18 | 19 | const params = req.params; 20 | 21 | // console.log(params.name) 22 | 23 | // return res.send({ 24 | // message: `Hello ${params.name} !, you are at users page` 25 | // }) 26 | return res.send({ 27 | message: "Hello " + params.name + "!, you are at users page" 28 | }) 29 | }) 30 | 31 | app.get("/products", (req, res) => { 32 | return res.send({ 33 | message: "Hello you are at products page" 34 | }) 35 | }) 36 | 37 | app.listen(8000, () => { 38 | console.log("YOU ARE CONNECTED") 39 | }) -------------------------------------------------------------------------------- /BATCH_12/backend/api_2/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dist 3 | .vscode -------------------------------------------------------------------------------- /BATCH_12/backend/api_2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api_2", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_12/backend/api_2/passing_params_query.js: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const app = express(); 3 | 4 | // Passing details in url as params 5 | 6 | app.post("/login/:user/:pwrd", (req, res) => { 7 | // const data = req.params; 8 | // const user = data.user; 9 | // const pwrd = data.pwrd; 10 | 11 | // const user = req.params.user; 12 | // const pwrd = req.params.pwrd; 13 | 14 | const { user, pwrd } = req.params; 15 | console.log({ user, pwrd }) 16 | 17 | res.send({ 18 | message: "Logged in" 19 | }) 20 | }) 21 | 22 | // Passing details in url as query 23 | 24 | app.post("/login", (req, res) => { 25 | 26 | // // const data = req.query; 27 | const { name, age } = req.query; 28 | console.log({ name, age }) 29 | 30 | res.send({ 31 | message: "Logged in" 32 | }) 33 | 34 | }) 35 | 36 | app.listen(4001, () => { 37 | console.log("Server is started!") 38 | }) 39 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "extends": [ 4 | "eslint:recommended", 5 | "plugin:@typescript-eslint/recommended", 6 | "prettier" 7 | ], 8 | "plugins": ["@typescript-eslint", "prettier"], 9 | "rules": { 10 | "prettier/prettier": "error" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | .env.local 4 | .env.production 5 | .env.development 6 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/loader.mjs: -------------------------------------------------------------------------------- 1 | import { register } from "node:module"; 2 | import { pathToFileURL } from "node:url"; 3 | 4 | register("ts-node/esm", pathToFileURL("./")); 5 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts", 4 | "exec": "node --import ./loader.mjs src/index.ts" 5 | } -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-ts-app", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "nodemon", 8 | "build": "tsc", 9 | "lint": "npx eslint src", 10 | "lint:fix": "npx eslint src --fix" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "description": "", 16 | "dependencies": { 17 | "express": "^4.21.2", 18 | "mongoose": "^8.9.5" 19 | }, 20 | "devDependencies": { 21 | "@eslint/js": "^9.17.0", 22 | "@types/express": "^5.0.0", 23 | "@types/node": "^22.10.5", 24 | "@typescript-eslint/eslint-plugin": "^8.19.0", 25 | "@typescript-eslint/parser": "^8.19.0", 26 | "eslint": "^9.17.0", 27 | "eslint-config-prettier": "^10.0.1", 28 | "eslint-plugin-prettier": "^5.2.1", 29 | "globals": "^15.14.0", 30 | "nodemon": "^3.1.9", 31 | "prettier": "^3.4.2", 32 | "ts-node": "^10.9.2", 33 | "typescript": "^5.7.2", 34 | "typescript-eslint": "^8.19.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/src/config/db.ts: -------------------------------------------------------------------------------- 1 | import mongoose from "mongoose"; 2 | 3 | export default async function connectDB() { 4 | try { 5 | await mongoose.connect("mongodb://127.0.0.1:27017/ecommerce"); 6 | } catch (error) { 7 | console.error(error); 8 | process.exit(1); //optional 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/src/controllers/products.controllers.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | import JSONResponse from "../utils/JsonResponse.ts"; 3 | 4 | export const ProductsListController = (req: Request, res: Response) => { 5 | try { 6 | const response = JSONResponse({ 7 | status_code: 200, 8 | message: "Products fetched successfully!", 9 | }); 10 | 11 | res.json(response); 12 | return; 13 | } catch (error: unknown) { 14 | console.error(error); 15 | 16 | const errMessage = 17 | error instanceof Error ? error.message : "Unknown Error!"; 18 | 19 | const response = JSONResponse({ 20 | status_code: 500, 21 | message: errMessage, 22 | }); 23 | 24 | res.status(500).json(response); 25 | return; 26 | } 27 | }; 28 | 29 | export const AddNewProductController = (req: Request, res: Response) => { 30 | const response = JSONResponse({ 31 | status_code: 200, 32 | }); 33 | 34 | res.json(response); 35 | return; 36 | }; 37 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/src/index.ts: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import connectDB from "./config/db.ts"; 3 | import productRouter from "./routes/products.routes.ts"; 4 | 5 | const app = express(); 6 | const PORT = process.env.PORT || 8000; 7 | 8 | app.use(express.json()); 9 | 10 | app.get("/", function (req: express.Request, res: express.Response) { 11 | res.send("Welcome to TypedHome!"); 12 | return; 13 | }); 14 | 15 | app.use("/products", productRouter); 16 | 17 | async function startServer() { 18 | await connectDB(); 19 | app.listen(PORT, () => { 20 | console.log(`Server is running on port ${PORT}`); 21 | }); 22 | } 23 | 24 | startServer(); 25 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/src/middlewares/sample.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_12/backend/ecommerce/src/middlewares/sample.ts -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/src/models/sample.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_12/backend/ecommerce/src/models/sample.ts -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/src/routes/products.routes.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { 3 | AddNewProductController, 4 | ProductsListController, 5 | } from "../controllers/products.controllers.ts"; 6 | 7 | const productRouter = Router(); 8 | 9 | productRouter 10 | .route("/") 11 | .get(ProductsListController) 12 | .post(AddNewProductController); 13 | 14 | export default productRouter; 15 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/src/utils/JsonResponse.ts: -------------------------------------------------------------------------------- 1 | type JSONResponseType = { 2 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 3 | data?: any; 4 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 5 | meta?: any; 6 | status_code: number; 7 | application_code?: number; 8 | message?: string; 9 | }; 10 | 11 | export default function JSONResponse({ 12 | data, 13 | meta, 14 | status_code, 15 | application_code, 16 | message, 17 | }: JSONResponseType) { 18 | return { 19 | data: data || null, 20 | meta: meta || {}, 21 | status_code: status_code || 200, // HTTP STATUS CODES https://developer.mozilla.org/en-US/docs/Web/HTTP/Status 22 | application_code: application_code || status_code, 23 | message: message || "", 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /BATCH_12/backend/ecommerce/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES6", 4 | "module": "NodeNext", 5 | "rootDir": "./src", 6 | "outDir": "./dist", 7 | "strict": true, 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "moduleResolution": "nodenext", 11 | "allowImportingTsExtensions": true 12 | }, 13 | "include": ["src/**/*", "src/index.ts"], 14 | "exclude": ["node_modules"] 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_12/backend/hashing/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /BATCH_12/backend/hashing/index.js: -------------------------------------------------------------------------------- 1 | const argon2 = require('argon2'); 2 | 3 | // We are using Argon2 4 | // Argon 2 documentations: - 5 | // https://www.npmjs.com/package/argon2 6 | // https://github.com/ranisalt/node-argon2/wiki/Options 7 | async function Hashing(password) { 8 | try { 9 | const hash = await argon2.hash(password); 10 | console.log("HASHING => ", hash); 11 | } catch (err) { 12 | console.log(err) 13 | } 14 | } 15 | 16 | async function Verify(hashed, password) { 17 | try { 18 | if (await argon2.verify(hashed, password)) { 19 | console.log("Password Matched") 20 | } else { 21 | console.log("Password invalid") 22 | } 23 | } catch (err) { 24 | console.log(err) 25 | } 26 | } 27 | 28 | Hashing("Vijay123") 29 | Verify(hash2, "Vijay123") -------------------------------------------------------------------------------- /BATCH_12/backend/hashing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hashing", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "argon2": "^0.41.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_12/backend/mongo_db_1/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /BATCH_12/backend/mongo_db_1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongo_db_1", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2", 14 | "mongodb": "^6.12.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BATCH_13/README.md: -------------------------------------------------------------------------------- 1 | Students: Lalit 2 | Start: 2024 -------------------------------------------------------------------------------- /BATCH_14/README.md: -------------------------------------------------------------------------------- 1 | Students: Shaurya, Lalit 2 | Course: MERN 3 | Start: 2024 4 | -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const connectDB = require("./src/config/connectDB.js"); 3 | const AuthRouter = require("./src/routes/auth.routes.js"); 4 | const ProductsRouter = require("./src/routes/products.routes.js"); 5 | 6 | const app = express(); 7 | const PORT = 8004; 8 | 9 | app.use(express.json()) 10 | 11 | app.use("/auth", AuthRouter) 12 | app.use("/products", ProductsRouter) 13 | 14 | connectDB().then(() => { 15 | app.listen(PORT, () => { 16 | console.log("SERVER HAS STARTED AT PORT ", PORT); 17 | }) 18 | }).catch(error => { 19 | console.log(error) 20 | }) 21 | -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ecommerce", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "dev": "nodemon" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "description": "", 13 | "dependencies": { 14 | "express": "^5.1.0", 15 | "mongoose": "^8.13.2", 16 | "nodemon": "^3.1.9" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/src/config/connectDB.js: -------------------------------------------------------------------------------- 1 | const { connect } = require("mongoose"); 2 | 3 | async function connectDB() { 4 | await connect("mongodb://localhost:27017/test2"); 5 | } 6 | 7 | module.exports = connectDB -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/src/models/auth.model.js: -------------------------------------------------------------------------------- 1 | const { Schema, model } = require("mongoose"); 2 | 3 | const authSchema = new Schema({ 4 | "name": String, 5 | "email": String, 6 | "password": String, 7 | "age": Number, 8 | }) 9 | 10 | const AuthModel = model("User", authSchema) 11 | 12 | module.exports = AuthModel; -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/src/routes/auth.routes.js: -------------------------------------------------------------------------------- 1 | const { Router } = require("express"); 2 | const { loginController, registerController, logoutController } = require("../controllers/auth.controller"); 3 | 4 | const AuthRouter = Router(); 5 | 6 | AuthRouter.post("/login", loginController) 7 | AuthRouter.post("/register", registerController) 8 | AuthRouter.delete("/logout", logoutController) 9 | 10 | module.exports = AuthRouter; -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/src/routes/products.routes.js: -------------------------------------------------------------------------------- 1 | const { Router } = require("express") 2 | 3 | const ProductsRouter = Router(); 4 | 5 | ProductsRouter.get("/", (req, res) => { 6 | res.send({ data: "get products" }) 7 | }) 8 | 9 | ProductsRouter.post("/", (req, res) => { 10 | res.send({ data: "add prdoucts" }) 11 | }) 12 | 13 | ProductsRouter.delete("/", (req, res) => { 14 | res.send({ data: "delete" }) 15 | }) 16 | 17 | module.exports = ProductsRouter; -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce/src/services/auth.services.js: -------------------------------------------------------------------------------- 1 | import AuthModel from "../models/auth.model"; 2 | 3 | export async function loginService({ email, password }) { 4 | const user = await AuthModel.findOne({ 5 | email: email, 6 | password: password 7 | }).select({ 8 | password: false, 9 | __v: false 10 | }).lean() 11 | 12 | if (!user) { 13 | return res.status(401).send({ message: "User not found!" }) 14 | } 15 | 16 | return user; 17 | } -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce_modern/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce_modern/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ecommerce", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "dev": "nodemon" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "description": "", 13 | "dependencies": { 14 | "bcrypt": "^5.1.1", 15 | "express": "^5.1.0", 16 | "jsonwebtoken": "^9.0.2", 17 | "mongoose": "^8.13.2", 18 | "nodemon": "^3.1.9" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce_modern/src/config/connectDB.js: -------------------------------------------------------------------------------- 1 | const { connect } = require("mongoose"); 2 | 3 | async function connectDB() { 4 | await connect("mongodb://localhost:27017/test2"); 5 | } 6 | 7 | module.exports = connectDB -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce_modern/src/features/auth/auth.model.js: -------------------------------------------------------------------------------- 1 | const { Schema, model } = require("mongoose"); 2 | const { hashPassword } = require("../../shared/utils/hashing"); 3 | 4 | const authSchema = new Schema({ 5 | "name": String, 6 | "email": String, 7 | "password": String, 8 | "age": Number, 9 | }) 10 | 11 | // update 12 | // create 13 | // authSchema.pre("save", async function (next) { 14 | // try { 15 | 16 | // if (!this.isModified("password")) { 17 | // return next() 18 | // } 19 | 20 | // this.password = await hashPassword(this.password); 21 | // // password hashed 1 22 | // console.log("MIDDLEWARE RAN!", this.password) 23 | // next() 24 | // } catch (error) { 25 | // console.log(error) 26 | // next(error); 27 | // } 28 | // }) 29 | 30 | 31 | const AuthModel = model("User", authSchema) 32 | 33 | module.exports = AuthModel; -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce_modern/src/features/auth/auth.routes.js: -------------------------------------------------------------------------------- 1 | const { Router } = require("express"); 2 | const { loginController, registerController, logoutController } = require("./auth.controller"); 3 | 4 | const AuthRouter = Router(); 5 | 6 | AuthRouter.post("/login", loginController) 7 | AuthRouter.post("/register", registerController) 8 | AuthRouter.delete("/logout", logoutController) 9 | 10 | module.exports = AuthRouter; -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce_modern/src/features/auth/auth.services.js: -------------------------------------------------------------------------------- 1 | import { verifyPassword } from "../../shared/utils/hashing.js"; 2 | import AuthModel from "../auth/auth.model.js"; 3 | 4 | export async function loginService({ email, password }) { 5 | const user = await AuthModel.findOne({ 6 | email: email, 7 | }).select({ 8 | password: true, 9 | _id: false 10 | }).lean() 11 | 12 | console.log({ user }) 13 | 14 | if (!user) throw new Error("USER DOESN'T EXIST") 15 | 16 | const isValiPassword = await verifyPassword(password, user.password) 17 | 18 | console.log(isValiPassword) 19 | 20 | return isValiPassword; 21 | } -------------------------------------------------------------------------------- /BATCH_14/backend/ecommerce_modern/src/shared/utils/hashing.js: -------------------------------------------------------------------------------- 1 | const bcrypt = require('bcrypt'); 2 | 3 | async function hashPassword(plainPassword) { 4 | const hash = await bcrypt.hash(plainPassword, 10); 5 | return hash; 6 | } 7 | 8 | async function verifyPassword(plainPassword, hashedPassword) { 9 | const hash = await bcrypt.compare(plainPassword, hashedPassword); 10 | return hash; 11 | } 12 | 13 | module.exports = { hashPassword, verifyPassword } -------------------------------------------------------------------------------- /BATCH_14/backend/modules/asset/hello2.txt: -------------------------------------------------------------------------------- 1 | Hello, i am Vijay. 2 | I am a Boy. 3 | d 4 | as 5 | das 6 | d 7 | as 8 | dsa 9 | d -------------------------------------------------------------------------------- /BATCH_14/backend/modules/functions.js: -------------------------------------------------------------------------------- 1 | // Type 1. simple function 2 | 3 | // function sum(a, b) { 4 | // return a + b 5 | // } 6 | 7 | // const result = sum(5, 7) 8 | 9 | // console.log(result); 10 | 11 | // console.log(sum(5, 7)); 12 | 13 | const sum = (a, b) => { 14 | return a + b 15 | } 16 | 17 | const result = sum(5, 7) 18 | 19 | console.log(result); -------------------------------------------------------------------------------- /BATCH_14/backend/modules/hello2.txt: -------------------------------------------------------------------------------- 1 | Hello, i am Vijay. 2 | I am a Boy. -------------------------------------------------------------------------------- /BATCH_14/backend/modules/hello3.txt: -------------------------------------------------------------------------------- 1 | Hello, i am Vijay. 2 | I am a Boy. 3 | 4 | 5 | dasdasd 6 | asd 7 | as 8 | d 9 | asd 10 | as 11 | das 12 | d -------------------------------------------------------------------------------- /BATCH_14/backend/modules/hello_shortcut.txt: -------------------------------------------------------------------------------- 1 | Hello, i am Vijay. 2 | I am a Boy. 3 | 4 | 5 | dasdasd 6 | asd 7 | as 8 | d 9 | asd 10 | as 11 | das 12 | d -------------------------------------------------------------------------------- /BATCH_14/backend/modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "vijay", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /BATCH_14/backend/modules/path.js: -------------------------------------------------------------------------------- 1 | // PATH MODULE 2 | // DOCS: https://nodejs.org/api/path.html 3 | 4 | // ============================== 1. CREATING A PATH 5 | const path = require("path"); 6 | // const result = path.join("assets", "copy", "text.js"); 7 | 8 | // console.log(result) 9 | 10 | // ============================= 2. Types of Path 11 | 12 | // 1. Absolute Path 13 | // 2. Relative Path 14 | 15 | const abs_path = "/mnt/Work/Codes/programming_classes/BATCH_14/backend/asset/hello2.txt"; 16 | 17 | const rel_path = "./asset/hello2.txt" 18 | 19 | // console.log(path.isAbsolute(rel_path)) 20 | 21 | // =============================== 3. Converting relative path to absolute path 22 | 23 | // console.log(path.resolve(rel_path)) 24 | 25 | // =============================== 4. Fetching Directory from a path 26 | 27 | // console.log(path.dirname(abs_path)) 28 | 29 | // =============================== 5. Fetching File name from a path 30 | 31 | console.log(path.basename(abs_path)) 32 | console.log(path.extname(abs_path)) 33 | // console.log(path.basename(abs_path, path.extname(abs_path))) 34 | // console.log(path.basename(abs_path, ".txt")) 35 | -------------------------------------------------------------------------------- /BATCH_14/backend/modules/question1.js: -------------------------------------------------------------------------------- 1 | fs.readFile('root.txt', "utf-8", (value) => { 2 | if (value) { 3 | fs.appendFile("root.txt", "even") 4 | } 5 | }) 6 | const data = fs.readFileSync('root.txt', 'utf-8', () => { }) 7 | 8 | const arrOfLines = data.replaceAll("\r", "").split("\n").map(e => { 9 | 10 | if (e % 2 == 0) { 11 | return e + " even" 12 | } else { 13 | return e + " odd" 14 | } 15 | 16 | }); 17 | 18 | console.log(arrOfLines.join("\n")) 19 | 20 | fs.writeFileSync('root.txt', arrOfLines.join("\n")); -------------------------------------------------------------------------------- /BATCH_14/backend/mongodb/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /BATCH_14/backend/mongodb/connectDB.js: -------------------------------------------------------------------------------- 1 | const { connect } = require("mongoose"); 2 | 3 | async function connectDB() { 4 | await connect("mongo_uri") 5 | } 6 | 7 | module.exports = connectDB; -------------------------------------------------------------------------------- /BATCH_14/backend/mongodb/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const connectDB = require('./connectDB') 3 | const { MoviesModel } = require('./src/models/movies.model') 4 | const app = express() 5 | const port = 3002 6 | 7 | app.get('/', async (req, res) => { 8 | const data = await MoviesModel.create({ 9 | title: "Bat Man", 10 | duration: 200, 11 | rating: 8.9, 12 | isWatched: true, 13 | genres: ["action", "thriller"] 14 | }) 15 | res.send({ data }) 16 | }) 17 | 18 | connectDB().then(() => { 19 | app.listen(port, () => { 20 | console.log(`Example app listening on port ${port}`) 21 | }) 22 | }).catch((error) => { 23 | console.log(error); 24 | }) 25 | 26 | -------------------------------------------------------------------------------- /BATCH_14/backend/mongodb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongodb", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^5.1.0", 14 | "mongodb": "^6.15.0", 15 | "mongoose": "^8.13.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BATCH_14/backend/mongodb/src/models/movies.model.js: -------------------------------------------------------------------------------- 1 | const { Schema, model } = require("mongoose"); 2 | 3 | const moviesSchema = new Schema({ 4 | title: String, 5 | duration: Number, 6 | rating: Number, 7 | isWatched: Boolean, 8 | genres: [String] 9 | }) 10 | 11 | exports.MoviesModel = model("movie", moviesSchema); 12 | -------------------------------------------------------------------------------- /BATCH_14/backend/server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json -------------------------------------------------------------------------------- /BATCH_14/backend/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "dev": "nodemon" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2", 14 | "nodemon": "^3.1.9" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BATCH_16/README.md: -------------------------------------------------------------------------------- 1 | Students: Devyanshu, Abhishek 2 | Course: Python 3 | Start: 2024 -------------------------------------------------------------------------------- /BATCH_16/__pycache__/math.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_16/__pycache__/math.cpython-312.pyc -------------------------------------------------------------------------------- /BATCH_16/file.py: -------------------------------------------------------------------------------- 1 | # f = open("dicta.py", "a") # r, w, a, x 2 | import os 3 | 4 | # ================== Read Operations 5 | 6 | # dat = f.read(100) 7 | # dat = f.readline(100) 8 | # dat = f.readline() 9 | # data = f.readlines() 10 | # print(data[2]) 11 | # print(data) 12 | 13 | # ================== Write Operations 14 | 15 | # f.write("print('helloaaaaa')") 16 | # f.write("\nprint('helloaaaaa')") 17 | 18 | # ================= os Module 19 | 20 | # os.remove("dicta.py") 21 | 22 | # os.mkdir("something") 23 | 24 | # os.rmdir("something") # remove a folder 25 | 26 | # os.rename("dict.py", "dicta.py") 27 | 28 | # print(os.listdir("./")) 29 | 30 | # print(os.path.exists("dict.py")) -------------------------------------------------------------------------------- /BATCH_16/loops.py: -------------------------------------------------------------------------------- 1 | # Range 0 to 9 2 | """ 3 | for i in range(10): 4 | print(i) 5 | 6 | # Range 2 to 9 7 | for i in range(2,10): 8 | print(i) 9 | 10 | # Range 2 to 30 with step 3 11 | for i in range(2,30,3): 12 | print(i) 13 | 14 | #while loop 15 | isRun = False 16 | i = 0 17 | 18 | while isRun == False: 19 | print("Vijay") 20 | i += 1 21 | if(i > 5): 22 | isRun = True 23 | 24 | # nested for loop 25 | 26 | for i in range(10): 27 | for j in range(5): 28 | print(i,j) 29 | 30 | outer loop => 0 => 5 inner loop 31 | outer loop => 1 => 5 inner loop 32 | outer loop => 2 => 5 inner loop 33 | 34 | 35 | * 36 | ** 37 | *** 38 | **** 39 | ***** 40 | """ 41 | 42 | # for i in range(1,6): 43 | # for j in range(i): 44 | # print("*", end="") 45 | # print("") 46 | 47 | # print("Hello", end="") 48 | # print("Hello") 49 | # print("Hello") 50 | # print("Hello") 51 | # print("Hello") 52 | # print("Hello") 53 | 54 | -------------------------------------------------------------------------------- /BATCH_16/loops2.py: -------------------------------------------------------------------------------- 1 | # for i in range(1,50): 2 | # pass 3 | 4 | # print("Vijay") 5 | 6 | #jis condition me conitune rahega us confition ko chodh ke next condition pe loop aa jaega 7 | 8 | # for i in range(1,10): 9 | # if(i == 4): 10 | # continue 11 | # print(i) 12 | 13 | 14 | for i in range(1,10): 15 | if(i == 4): 16 | break 17 | print(i) 18 | 19 | 20 | -------------------------------------------------------------------------------- /BATCH_16/module/folder_module_import/__pycache__/string_utils.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_16/module/folder_module_import/__pycache__/string_utils.cpython-312.pyc -------------------------------------------------------------------------------- /BATCH_16/module/folder_module_import/assets/module/add.py: -------------------------------------------------------------------------------- 1 | def add(num1, num2): 2 | print(num1 + num2) 3 | 4 | -------------------------------------------------------------------------------- /BATCH_16/module/folder_module_import/assets/module/string_utils.py: -------------------------------------------------------------------------------- 1 | name="Vijay" 2 | 3 | def something(name, age): 4 | print(name) 5 | print(age) 6 | 7 | def add(num1, num2): 8 | print(num1 + num2) 9 | 10 | -------------------------------------------------------------------------------- /BATCH_16/module/folder_module_import/main.py: -------------------------------------------------------------------------------- 1 | 2 | # 1st method 3 | 4 | # import assets.string_utils 5 | 6 | # assets.string_utils.add(2,15) 7 | 8 | # 2nd method 9 | 10 | # import assets.module.string_utils as su 11 | 12 | # su.add(2,15) 13 | 14 | # 3rd method => from 15 | 16 | # from assets.module import string_utils, add 17 | 18 | # string_utils.add(15,12) 19 | # add.add(14,2) 20 | 21 | 22 | # 4th method => from 23 | 24 | from assets.module.string_utils import add, name 25 | add(12,1) -------------------------------------------------------------------------------- /BATCH_16/module/simple_module_import with alias/__pycache__/string_utils.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_16/module/simple_module_import with alias/__pycache__/string_utils.cpython-312.pyc -------------------------------------------------------------------------------- /BATCH_16/module/simple_module_import with alias/main.py: -------------------------------------------------------------------------------- 1 | import string_utils as su # this as is short for alias 2 | 3 | print(su.name) 4 | 5 | su.something("Vijay", 26) 6 | 7 | su.add(2, 26) -------------------------------------------------------------------------------- /BATCH_16/module/simple_module_import with alias/string_utils.py: -------------------------------------------------------------------------------- 1 | name="Vijay" 2 | 3 | def something(name, age): 4 | print(name) 5 | print(age) 6 | 7 | def add(num1, num2): 8 | print(num1 + num2) 9 | 10 | -------------------------------------------------------------------------------- /BATCH_16/module/simple_module_import/__pycache__/string_utils.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_16/module/simple_module_import/__pycache__/string_utils.cpython-312.pyc -------------------------------------------------------------------------------- /BATCH_16/module/simple_module_import/main.py: -------------------------------------------------------------------------------- 1 | import string_utils 2 | 3 | print(string_utils.name) 4 | 5 | string_utils.something("Vijay", 26) 6 | 7 | string_utils.add(2, 26) -------------------------------------------------------------------------------- /BATCH_16/module/simple_module_import/string_utils.py: -------------------------------------------------------------------------------- 1 | name="Vijay" 2 | 3 | def something(name, age): 4 | print(name) 5 | print(age) 6 | 7 | def add(num1, num2): 8 | print(num1 + num2) 9 | 10 | -------------------------------------------------------------------------------- /BATCH_16/questions/1_table.py: -------------------------------------------------------------------------------- 1 | """ 2 | Q.1 3 | Table print krni hai! 4 | output: 5 | 2 x 1 = 2 6 | 2 x 2 = 4 7 | 2 x 3 = 6 8 | 2 x 4 = 8 9 | 2 x 5 = 10 10 | 2 x 6 = 12 11 | 2 x 7 = 14 12 | 2 x 8 = 16 13 | 2 x 9 = 18 14 | 2 x 10 = 20 15 | """ 16 | 17 | # Simple method using for loop 18 | """ 19 | for i in range(1,11): 20 | print("2 x " + str(i) + " = " + str(2 * i)) 21 | 22 | """ 23 | 24 | # Simple method using for loop and format string method 25 | 26 | # 2 x 2 = 4 27 | 28 | for i in range(1,11): 29 | print(f"2 x {i} = {i * 2}") 30 | 31 | -------------------------------------------------------------------------------- /BATCH_16/questions/2_prime.py: -------------------------------------------------------------------------------- 1 | is_prime = True 2 | to_find = int(input("enter a number to check!")) 3 | 4 | for i in range(2,to_find): 5 | if(to_find % i == 0): 6 | is_prime = False 7 | break; 8 | 9 | print(is_prime) 10 | -------------------------------------------------------------------------------- /BATCH_16/upperc/.gitignore: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /BATCH_16/upperc/name.py: -------------------------------------------------------------------------------- 1 | from camelcase import CamelCase 2 | 3 | c = CamelCase() 4 | 5 | txt = "hello world" 6 | 7 | print(c.hump(txt)) 8 | -------------------------------------------------------------------------------- /BATCH_17/README.md: -------------------------------------------------------------------------------- 1 | Students: Noor, Khushboo 2 | Course: Backend Development 3 | Time: 4 PM MTWT 4 | -------------------------------------------------------------------------------- /BATCH_17/backend/api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json -------------------------------------------------------------------------------- /BATCH_17/backend/api/http.js: -------------------------------------------------------------------------------- 1 | // DOcs = https://nodejs.org/api/http.html 2 | const http = require('node:http'); 3 | 4 | const server = http.createServer((req, res) => { 5 | res.end(JSON.stringify({ 6 | data: 'Hello World!', 7 | })); 8 | }); 9 | 10 | server.listen(8000); 11 | -------------------------------------------------------------------------------- /BATCH_17/backend/api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "express": "^4.21.2", 14 | "multer": "^1.4.5-lts.2", 15 | "nodemon": "^3.1.9" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BATCH_17/backend/demo/assets/assets copy/hello copy.txt: -------------------------------------------------------------------------------- 1 | 2x1=2 2 | 2x2=4 3 | 2x3=6 4 | 2x4=8 5 | 2x5=10 6 | 2x6=12 7 | 2x7=14 8 | 2x8=16 9 | 2x9=18 10 | 2x10=20 11 | -------------------------------------------------------------------------------- /BATCH_17/backend/demo/assets/assets copy/hello.txt: -------------------------------------------------------------------------------- 1 | 2x1=2 2 | 2x2=4 3 | 2x3=6 4 | 2x4=8 5 | 2x5=10 6 | 2x6=12 7 | 2x7=14 8 | 2x8=16 9 | 2x9=18 10 | 2x10=20 11 | -------------------------------------------------------------------------------- /BATCH_17/backend/demo/assets/hello copy.txt: -------------------------------------------------------------------------------- 1 | 2x1=2 2 | 2x2=4 3 | 2x3=6 4 | 2x4=8 5 | 2x5=10 6 | 2x6=12 7 | 2x7=14 8 | 2x8=16 9 | 2x9=18 10 | 2x10=20 11 | -------------------------------------------------------------------------------- /BATCH_17/backend/demo/assets/hello.txt: -------------------------------------------------------------------------------- 1 | 2x1=2 2 | 2x2=4 3 | 2x3=6 4 | 2x4=8 5 | 2x5=10 6 | 2x6=12 7 | 2x7=14 8 | 2x8=16 9 | 2x9=18 10 | 2x10=20 11 | -------------------------------------------------------------------------------- /BATCH_17/backend/demo/assets2.js: -------------------------------------------------------------------------------- 1 | import fs from "fs" 2 | 3 | // const data = fs.readdirSync("assets", { 4 | // recursive: true, 5 | // withFileTypes: true 6 | // }) 7 | 8 | // fs.mkdirSync("assets2") 9 | // fs.rmdir("assets2", (err)=>console.log(err)) 10 | fs.copyFile("directory.js", "assets2", (err)=>console.log(err)) -------------------------------------------------------------------------------- /BATCH_17/backend/demo/assets2/directory.js: -------------------------------------------------------------------------------- 1 | import fs from "fs" 2 | 3 | // const data = fs.readdirSync("assets", { 4 | // recursive: true, 5 | // withFileTypes: true 6 | // }) 7 | 8 | // fs.mkdirSync("assets2") 9 | // fs.rmdir("assets2", (err)=>console.log(err)) 10 | // fs.copyFile("directory.js", "assets2/directory.js", (err)=>console.log(err)) 11 | 12 | fs.copyFile("directory.js", "assets2/directory.js", 2, (err)=>console.log(err)) -------------------------------------------------------------------------------- /BATCH_17/backend/demo/dir: -------------------------------------------------------------------------------- 1 | IntxLNKdirectory.js -------------------------------------------------------------------------------- /BATCH_17/backend/demo/directory.js: -------------------------------------------------------------------------------- 1 | import fs from "fs" 2 | 3 | // const data = fs.readdirSync("assets", { 4 | // recursive: true, 5 | // withFileTypes: true 6 | // }) 7 | dd 8 | // fs.mkdirSync("assets2") 9 | // fs.rmdir("assets2", (err)=>console.log(err)) 10 | // fs.copyFile("directory.js", "assets2/directory.js", (err)=>console.log(err)) 11 | 12 | // fs.copyFile("directory.js", "assets2/directory.js", 2, (err)=>console.log(err)) 13 | 14 | fs.symlink("directory.js", "dir", (err)=>console.log(err)) -------------------------------------------------------------------------------- /BATCH_17/backend/demo/hello.txt: -------------------------------------------------------------------------------- 1 | 2x1=2 2 | 2x2=4 3 | 2x3=6 4 | 2x4=8 5 | 2x5=10 6 | 2x6=12 7 | 2x7=14 8 | 2x8=16 9 | 2x9=18 10 | 2x10=20 11 | -------------------------------------------------------------------------------- /BATCH_17/backend/demo/index.js: -------------------------------------------------------------------------------- 1 | // console.log("hello") 2 | 3 | // const fs = require("fs"); 4 | import fs from "fs" 5 | 6 | // let table = "" 7 | 8 | // for (let i = 1; i < 11; i++) { 9 | // table += `2x${i}=${2 * i} \n` 10 | // } 11 | 12 | // fs.writeFileSync("hello.txt", table, { 13 | // flag: "w" 14 | // }) 15 | 16 | // console.log("File writing complete!") 17 | 18 | // const data = fs.readFileSync("hello.txt", { 19 | // encoding: "utf-8" 20 | // }) 21 | 22 | // console.log(data) 23 | 24 | // const data = fs.readFileSync("hello.txt") 25 | 26 | // console.log(data.toString()) 27 | 28 | // fs.unlink("hello2.txt", (error) => { 29 | // console.log(error.message) 30 | // }) 31 | 32 | (async function () { 33 | fs.readFile("hello.txt", { 34 | encoding: "utf-8" 35 | }, async (err, data) => { 36 | if (err) console.log(err.message) 37 | else console.log(data) 38 | }) 39 | })() 40 | 41 | 42 | // try { 43 | 44 | // fs.unlink("hello2.txt", () => { 45 | 46 | // }) 47 | 48 | // } catch (error) { 49 | // console.log(error.message) 50 | // } -------------------------------------------------------------------------------- /BATCH_17/backend/demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo2", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "dev": "node index.js" 9 | }, 10 | "author": "vijay kumar", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /BATCH_17/backend/demo/timers.js: -------------------------------------------------------------------------------- 1 | console.log("simple console") 2 | 3 | process.nextTick(() => { 4 | console.log("NEXT TICK") 5 | }); 6 | 7 | setImmediate(() => { 8 | console.log("Immediate") 9 | }) 10 | 11 | setTimeout(() => { 12 | console.log("TIMEOUT") 13 | }, 2000) 14 | 15 | setInterval(() => { 16 | console.log("INTEVAL") 17 | }, 2000) 18 | 19 | -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *-lock.json 3 | .env -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/index.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | 3 | const express = require("express"); 4 | const connectDB = require("./src/config/db"); 5 | const UserRouter = require("./src/routes/users.route.js"); 6 | const ProductRouter = require("./src/routes/productRoutes.js"); 7 | const swaggerDocs = require("./src/config/swagger.js"); 8 | const cookieParser = require("cookie-parser"); 9 | 10 | const app = express(); 11 | const PORT = 8001; 12 | 13 | swaggerDocs(app) 14 | 15 | app.use(express.json()) 16 | app.use(cookieParser()) 17 | 18 | app.get("/", (_, res) => { 19 | res.send({ 20 | message: "THIS IS HOME ROUTE!" 21 | }) 22 | }) 23 | 24 | app.use("/users", UserRouter); 25 | app.use("/products", ProductRouter); 26 | // app.use("/products", ProductRouter); 27 | 28 | connectDB().then(() => { 29 | app.listen(PORT, () => { 30 | console.log("YOUR BACKEND IS RUNNING AT PORT ", PORT); 31 | }) 32 | }).catch((error) => { 33 | console.error(error.message); 34 | }) -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongoose", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "argon2": "^0.41.1", 14 | "cookie-parser": "^1.4.7", 15 | "dotenv": "^16.4.7", 16 | "express": "^4.21.2", 17 | "jsonwebtoken": "^9.0.2", 18 | "mongoose": "^8.12.2", 19 | "swagger-jsdoc": "^6.2.8", 20 | "swagger-ui-express": "^5.0.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/src/config/db.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | 3 | async function connectDB() { 4 | await mongoose.connect("mongodb://localhost:27017/test2") 5 | console.log("MONGOOSE IS CONNECTED!") 6 | } 7 | 8 | module.exports = connectDB; 9 | -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/src/config/swagger.js: -------------------------------------------------------------------------------- 1 | const swaggerJsDoc = require("swagger-jsdoc"); 2 | const swaggerUi = require("swagger-ui-express"); 3 | 4 | const options = { 5 | definition: { 6 | openapi: "3.0.0", 7 | info: { 8 | title: "User API", 9 | version: "1.0.0", 10 | description: "API documentation for user management", 11 | }, 12 | servers: [ 13 | { 14 | url: "http://localhost:8001", // Change this based on your deployment 15 | }, 16 | ], 17 | }, 18 | apis: ["./src/routes/*.js"], // Path to your route file 19 | }; 20 | 21 | const swaggerSpec = swaggerJsDoc(options); 22 | 23 | const swaggerDocs = (app) => { 24 | app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec)); 25 | }; 26 | 27 | module.exports = swaggerDocs; -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/src/models/index.js: -------------------------------------------------------------------------------- 1 | const ProductModel = require("./productModel"); 2 | const { UserModel } = require("./users.models.js"); 3 | 4 | module.exports = { 5 | ProductModel, 6 | UserModel 7 | } -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/src/models/productModel.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | 3 | const ProductSchema = new mongoose.Schema({ 4 | name: { type: String, required: true }, 5 | image: String, 6 | price: { type: Number, required: true }, 7 | mrp: { type: Number, required: true }, 8 | desc: String, 9 | faqs: [ 10 | { 11 | question: String, 12 | answer: String, 13 | }, 14 | ], 15 | sku: { type: String, unique: true, required: true }, 16 | stock: { type: Number, required: true, default: 0 }, 17 | }, { 18 | autoIndex: true 19 | }); 20 | 21 | const ProductModel = mongoose.model("Product", ProductSchema); 22 | 23 | module.exports = ProductModel; 24 | -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/src/models/users.models.js: -------------------------------------------------------------------------------- 1 | const { Schema, model } = require("mongoose"); 2 | const { TextJoiner, hashPassword } = require("../utils/hashing"); 3 | 4 | const userSchema = new Schema({ 5 | name: String, 6 | email: String, 7 | password: String, 8 | age: Number 9 | } 10 | // , { 11 | // collection: "some_user" 12 | // } 13 | ) 14 | 15 | userSchema.pre("save", async function (next) { 16 | console.log("DATA => ", this.password, this.isModified("password")) 17 | this.password = await hashPassword(this.password, 6) 18 | console.log("DATA 2 => ", this.password, this.isModified("password")) 19 | next(); 20 | }) 21 | 22 | userSchema.post("findOne", function (data, next) { 23 | console.log("DATA RETRIEVED"); 24 | next(); 25 | }) 26 | 27 | exports.UserModel = model("User", userSchema); -------------------------------------------------------------------------------- /BATCH_17/backend/mongoose/src/routes/productRoutes.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const { 3 | getAllProducts, 4 | addProduct, 5 | updateProduct, 6 | deleteProduct, 7 | getSingleProductByID, 8 | } = require("../controllers/productController"); 9 | 10 | const ProductRouter = express.Router(); 11 | 12 | // Define Routes 13 | ProductRouter.get("/", getAllProducts); 14 | ProductRouter.get("/:sku", getSingleProductByID); 15 | ProductRouter.post("/", addProduct); 16 | ProductRouter.put("/:id", updateProduct); 17 | ProductRouter.delete("/:id", deleteProduct); 18 | 19 | module.exports = ProductRouter; 20 | -------------------------------------------------------------------------------- /BATCH_17/backend/nodemon/index.js: -------------------------------------------------------------------------------- 1 | console.log("hi"); 2 | -------------------------------------------------------------------------------- /BATCH_17/backend/nodemon/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodemon", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "" 12 | } 13 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript"), 14 | ]; 15 | 16 | export default eslintConfig; 17 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | /* config options here */ 5 | }; 6 | 7 | export default nextConfig; 8 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firecommerce", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "next": "15.1.6", 13 | "react": "^19.0.0", 14 | "react-dom": "^19.0.0", 15 | "react-icons": "^5.4.0" 16 | }, 17 | "devDependencies": { 18 | "@eslint/eslintrc": "^3", 19 | "@types/node": "^20", 20 | "@types/react": "^19", 21 | "@types/react-dom": "^19", 22 | "eslint": "^9", 23 | "eslint-config-next": "15.1.6", 24 | "postcss": "^8", 25 | "tailwindcss": "^3.4.1", 26 | "typescript": "^5" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/public/globe.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/public/images/flower.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/firecommerce/public/images/flower.webp -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/public/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/firecommerce/public/images/logo.jpg -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/firecommerce/src/app/favicon.ico -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Geist, Geist_Mono } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const geistSans = Geist({ 6 | variable: "--font-geist-sans", 7 | subsets: ["latin"], 8 | }); 9 | 10 | const geistMono = Geist_Mono({ 11 | variable: "--font-geist-mono", 12 | subsets: ["latin"], 13 | }); 14 | 15 | export const metadata: Metadata = { 16 | title: "Create Next App", 17 | description: "Generated by create next app", 18 | }; 19 | 20 | export default function RootLayout({ 21 | children, 22 | }: Readonly<{ 23 | children: React.ReactNode; 24 | }>) { 25 | return ( 26 | 27 | 30 | {children} 31 | 32 | 33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import Header from "@/components/Header"; 2 | import HeroSection from "@/components/Hero"; 3 | import ProductSection from "@/components/Product"; 4 | 5 | export default function Home() { 6 | return ( 7 |
8 |
9 | 10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/components/Header/Header.module.css: -------------------------------------------------------------------------------- 1 | .container { 2 | background-color: red; 3 | } 4 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/components/Header/index.tsx: -------------------------------------------------------------------------------- 1 | import MENU, { MenuItem } from "@/constants/Menus"; 2 | import Image from "next/image"; 3 | import Link from "next/link"; 4 | import { FiShoppingCart } from "react-icons/fi"; 5 | import styles from "./Header.module.css"; 6 | 7 | export default function Header() { 8 | return ( 9 |
15 | Logo 16 | 17 | 26 | 27 |
28 | 29 | 30 | 31 | 32 |
33 |
34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/components/Hero/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function HeroSection() { 4 | return
HeroSection
; 5 | } 6 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/components/Product/Card.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Image from "next/image"; 3 | import Link from "next/link"; 4 | export default function Card() { 5 | return ( 6 |
7 | flower 14 |
15 |

Electronics

16 | View Products 17 |
18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/components/Product/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Card from "./Card"; 3 | 4 | export default function ProductSection() { 5 | // const cards = []; 6 | 7 | return ( 8 |
9 |

Our Categories

10 |
11 | {Array.from({ length: 50 }, (_, index) => ({ id: index })).map( 12 | (item) => ( 13 | 14 | ) 15 | )} 16 |
17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/src/constants/Menus.tsx: -------------------------------------------------------------------------------- 1 | export type MenuItem = { 2 | title: string; 3 | id: number; 4 | path: string; 5 | }; 6 | 7 | const MENU: MenuItem[] = [ 8 | { 9 | title: "Home", 10 | id: 0, 11 | path: "/home", 12 | }, 13 | { 14 | title: "Products", 15 | id: 1, 16 | path: "/products", 17 | }, 18 | { 19 | title: "Categories", 20 | id: 2, 21 | path: "/categories", 22 | }, 23 | { 24 | title: "About", 25 | id: 3, 26 | path: "/about", 27 | }, 28 | { 29 | title: "Contact", 30 | id: 4, 31 | path: "/contact", 32 | }, 33 | ]; 34 | 35 | export default MENU; 36 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | export default { 4 | content: [ 5 | "./src/pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./src/components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./src/app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: { 11 | colors: { 12 | background: "var(--background)", 13 | foreground: "var(--foreground)", 14 | }, 15 | }, 16 | }, 17 | plugins: [], 18 | } satisfies Config; 19 | -------------------------------------------------------------------------------- /BATCH_17/frontend/firecommerce/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript"), 14 | ]; 15 | 16 | export default eslintConfig; 17 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | /* config options here */ 5 | }; 6 | 7 | export default nextConfig; 8 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "next-sample", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "react": "^19.0.0", 13 | "react-dom": "^19.0.0", 14 | "next": "15.1.6" 15 | }, 16 | "devDependencies": { 17 | "typescript": "^5", 18 | "@types/node": "^20", 19 | "@types/react": "^19", 20 | "@types/react-dom": "^19", 21 | "postcss": "^8", 22 | "tailwindcss": "^3.4.1", 23 | "eslint": "^9", 24 | "eslint-config-next": "15.1.6", 25 | "@eslint/eslintrc": "^3" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/public/globe.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/public/todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/next-sample/public/todo.png -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/counter/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { CounterContext } from "@/services/counter.context"; 3 | import React, { useContext } from "react"; 4 | 5 | export default function Counter() { 6 | const { increaseCounter, counterValue } = useContext(CounterContext); 7 | 8 | return ( 9 |
10 |

{counterValue}

11 | 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/effect/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useEffect, useState } from "react"; 3 | 4 | export default function Effect() { 5 | const [count, setCount] = useState(0); 6 | const [count1, setCount1] = useState(0); 7 | 8 | useEffect(() => { 9 | alert("Hello => "); 10 | }, []); 11 | 12 | // useEffect(() => { 13 | // alert("Hello => " + count); 14 | // }, [count]); 15 | 16 | // useEffect(() => { 17 | // alert("Hello => " + count); 18 | // }, [count, count1]); 19 | 20 | // alert("Hello"); 21 | 22 | return ( 23 |
24 |

{count}

25 |

{count1}

26 | 27 | 28 |

Use Effect Demo

29 |
30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/next-sample/src/app/favicon.ico -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | h1 { 6 | font-weight: 600; 7 | font-size: 32px; 8 | } 9 | 10 | button { 11 | border: 1px solid gray; 12 | padding: 10px 20px; 13 | border-radius: 5px; 14 | margin: 0 5px; 15 | 16 | &:hover { 17 | box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.15); 18 | } 19 | 20 | &:active { 21 | transform: translateX(2px) translateY(2px); 22 | } 23 | } 24 | 25 | input { 26 | border: 1px solid gray; 27 | padding: 5px 10px; 28 | } 29 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Geist, Geist_Mono } from "next/font/google"; 3 | import "./globals.css"; 4 | import ContextWrapper from "@/components/ContextWrapper"; 5 | 6 | const geistSans = Geist({ 7 | variable: "--font-geist-sans", 8 | subsets: ["latin"], 9 | }); 10 | 11 | const geistMono = Geist_Mono({ 12 | variable: "--font-geist-mono", 13 | subsets: ["latin"], 14 | }); 15 | 16 | export const metadata: Metadata = { 17 | title: "Create Next App", 18 | description: "Generated by create next app", 19 | }; 20 | 21 | export default function RootLayout({ 22 | children, 23 | }: Readonly<{ 24 | children: React.ReactNode; 25 | }>) { 26 | return ( 27 | 28 | 31 | {children} 32 | 33 | 34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/memo/Heavy.jsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React, { memo, useEffect, useState } from "react"; 3 | 4 | function Heavy() { 5 | const [count, setCount] = useState(true); 6 | 7 | return count ?
Hello
: null; 8 | } 9 | 10 | export default memo(Heavy); 11 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/memo/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useCallback } from "react"; 4 | 5 | // import Heavy from "./Heavy"; 6 | export default function MemoUsage() { 7 | function expensive() { 8 | let result = 0; 9 | for (let i = 0; i < 2000000000; i++) { 10 | result += i; 11 | } 12 | return result; 13 | } 14 | 15 | const memoized = useCallback(() => expensive(), []); 16 | 17 | return ( 18 |
19 | 20 | 21 | {/* {Array.from({ length: 100 }).map((item, index) => { 22 | return ; 23 | })} */} 24 |
25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/query/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useSearchParams } from "next/navigation"; 4 | import React, { useEffect } from "react"; 5 | 6 | export default function Query() { 7 | const queryParams = useSearchParams(); 8 | 9 | useEffect(() => { 10 | // Get only values 11 | // queryParams.forEach((item) => { 12 | // console.log(item); 13 | // }); 14 | // 15 | // Get params with key, value pair 16 | // const data = queryParams.entries(); 17 | // data.forEach((item) => { 18 | // console.log(item); 19 | // }); 20 | // 21 | // queryParams.keys().forEach((item) => { 22 | // console.log(item); 23 | // }); 24 | queryParams.values().forEach((item) => { 25 | console.log(item); 26 | }); 27 | }, [queryParams]); 28 | 29 | return
Query Params
; 30 | } 31 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/reducer/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { 4 | counterReducer, 5 | decreaseAction, 6 | increaseAction, 7 | resetAction, 8 | valueSelector, 9 | } from "@/services/counter.service"; 10 | import { useReducer } from "react"; 11 | 12 | export default function Something() { 13 | const [counter, dispatch] = useReducer(counterReducer, { 14 | value: 0, 15 | }); 16 | 17 | return ( 18 |
19 |

useReducer Hook

20 |

Value: {valueSelector(counter)}

21 | 22 | 29 | 36 | 43 |
44 | ); 45 | } 46 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/ref/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React, { useRef } from "react"; 3 | 4 | export default function UseRef() { 5 | const counter = useRef(null); 6 | // const [inputValue, updateInputValue] = useState(""); 7 | console.log("RE RUNNING"); 8 | return ( 9 |
10 | {/*

Counter Value {counter.current}

*/} 11 | Ref 12 | 13 | {/* updateInputValue(e.currentTarget.value)} 17 | /> */} 18 | 29 |
30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/app/todo/page.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ToDo from "./Todo"; 3 | 4 | export default function ToDoPage() { 5 | return ( 6 |
7 | 8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/components/ContextWrapper.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { CounterContextProvider } from "@/services/counter.context"; 4 | import { ReactNode } from "react"; 5 | 6 | export default function ContextWrapper({ children }: { children: ReactNode }) { 7 | return {children}; 8 | } 9 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/src/services/counter.context.tsx: -------------------------------------------------------------------------------- 1 | // import React from "react"; 2 | import React, { createContext, useState } from "react"; 3 | 4 | export const CounterContext = createContext({ 5 | counterValue: 0, 6 | increaseCounter: () => {}, 7 | }); 8 | 9 | export const CounterContextProvider = ({ 10 | children, 11 | }: { 12 | children: React.ReactNode; 13 | }) => { 14 | const [counterValue, setCounterValue] = useState(0); 15 | 16 | function increaseCounter() { 17 | setCounterValue((e) => e + 1); 18 | } 19 | 20 | return ( 21 | 27 | {children} 28 | 29 | ); 30 | }; 31 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | export default { 4 | content: [ 5 | "./src/pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./src/components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./src/app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: { 11 | colors: { 12 | background: "var(--background)", 13 | foreground: "var(--foreground)", 14 | }, 15 | }, 16 | }, 17 | plugins: [], 18 | } satisfies Config; 19 | -------------------------------------------------------------------------------- /BATCH_17/frontend/next-sample/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/.dockerignore: -------------------------------------------------------------------------------- 1 | .react-router 2 | build 3 | node_modules 4 | README.md -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /node_modules/ 3 | 4 | # React Router 5 | /.react-router/ 6 | /build/ 7 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-alpine AS development-dependencies-env 2 | COPY . /app 3 | WORKDIR /app 4 | RUN npm ci 5 | 6 | FROM node:20-alpine AS production-dependencies-env 7 | COPY ./package.json package-lock.json /app/ 8 | WORKDIR /app 9 | RUN npm ci --omit=dev 10 | 11 | FROM node:20-alpine AS build-env 12 | COPY . /app/ 13 | COPY --from=development-dependencies-env /app/node_modules /app/node_modules 14 | WORKDIR /app 15 | RUN npm run build 16 | 17 | FROM node:20-alpine 18 | COPY ./package.json package-lock.json /app/ 19 | COPY --from=production-dependencies-env /app/node_modules /app/node_modules 20 | COPY --from=build-env /app/build /app/build 21 | WORKDIR /app 22 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/app/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | html, 6 | body { 7 | @apply bg-white dark:bg-gray-950; 8 | 9 | @media (prefers-color-scheme: dark) { 10 | color-scheme: dark; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { type RouteConfig, index, route } from "@react-router/dev/routes"; 2 | // import Contact from "./routes/contact"; 3 | 4 | export default [ 5 | index("routes/home.tsx"), 6 | route("/contact", "./routes/Contact.tsx"), 7 | route("/about", "./routes/About.tsx"), 8 | ] satisfies RouteConfig; 9 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/app/routes/About.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function About() { 4 | return
About
; 5 | } 6 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/app/routes/Contact.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function contact() { 4 | return
contact
; 5 | } 6 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/app/routes/home.tsx: -------------------------------------------------------------------------------- 1 | import type { Route } from "./+types/home"; 2 | import { Welcome } from "../welcome/welcome"; 3 | 4 | export function meta({}: Route.MetaArgs) { 5 | return [ 6 | { title: "New React Router App" }, 7 | { name: "description", content: "Welcome to React Router!" }, 8 | ]; 9 | } 10 | 11 | export default function Home() { 12 | return ; 13 | } 14 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/app/welcome/welcome.tsx: -------------------------------------------------------------------------------- 1 | import { Link } from "react-router"; 2 | 3 | export function Welcome() { 4 | return ( 5 |
6 | {/*

7 | Contact 8 |

9 | 10 | About */} 11 | 12 |

13 | Contact 14 |

15 | 16 |

17 | About 18 |

19 |
20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "router2", 3 | "private": true, 4 | "type": "module", 5 | "scripts": { 6 | "build": "react-router build", 7 | "dev": "react-router dev", 8 | "start": "react-router-serve ./build/server/index.js", 9 | "typecheck": "react-router typegen && tsc" 10 | }, 11 | "dependencies": { 12 | "@react-router/node": "^7.1.3", 13 | "@react-router/serve": "^7.1.3", 14 | "isbot": "^5.1.17", 15 | "react": "^19.0.0", 16 | "react-dom": "^19.0.0", 17 | "react-router": "^7.1.3" 18 | }, 19 | "devDependencies": { 20 | "@react-router/dev": "^7.1.3", 21 | "@types/node": "^20", 22 | "@types/react": "^19.0.1", 23 | "@types/react-dom": "^19.0.1", 24 | "autoprefixer": "^10.4.20", 25 | "postcss": "^8.4.49", 26 | "tailwindcss": "^3.4.16", 27 | "typescript": "^5.7.2", 28 | "vite": "^5.4.11", 29 | "vite-tsconfig-paths": "^5.1.4" 30 | } 31 | } -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/react-router-v7/public/favicon.ico -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/react-router.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "@react-router/dev/config"; 2 | 3 | export default { 4 | // Config options... 5 | // Server-side render by default, to enable SPA mode set this to `false` 6 | ssr: true, 7 | } satisfies Config; 8 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | export default { 4 | content: ["./app/**/{**,.client,.server}/**/*.{js,jsx,ts,tsx}"], 5 | theme: { 6 | extend: { 7 | fontFamily: { 8 | sans: [ 9 | '"Inter"', 10 | "ui-sans-serif", 11 | "system-ui", 12 | "sans-serif", 13 | '"Apple Color Emoji"', 14 | '"Segoe UI Emoji"', 15 | '"Segoe UI Symbol"', 16 | '"Noto Color Emoji"', 17 | ], 18 | }, 19 | }, 20 | }, 21 | plugins: [], 22 | } satisfies Config; 23 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "**/*", 4 | "**/.server/**/*", 5 | "**/.client/**/*", 6 | ".react-router/types/**/*" 7 | ], 8 | "compilerOptions": { 9 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 10 | "types": ["node", "vite/client"], 11 | "target": "ES2022", 12 | "module": "ES2022", 13 | "moduleResolution": "bundler", 14 | "jsx": "react-jsx", 15 | "rootDirs": [".", "./.react-router/types"], 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./app/*"] 19 | }, 20 | "esModuleInterop": true, 21 | "verbatimModuleSyntax": true, 22 | "noEmit": true, 23 | "resolveJsonModule": true, 24 | "skipLibCheck": true, 25 | "strict": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_17/frontend/react-router-v7/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { reactRouter } from "@react-router/dev/vite"; 2 | import autoprefixer from "autoprefixer"; 3 | import tailwindcss from "tailwindcss"; 4 | import { defineConfig } from "vite"; 5 | import tsconfigPaths from "vite-tsconfig-paths"; 6 | 7 | export default defineConfig({ 8 | css: { 9 | postcss: { 10 | plugins: [tailwindcss, autoprefixer], 11 | }, 12 | }, 13 | plugins: [reactRouter(), tsconfigPaths()], 14 | }); 15 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/README.md: -------------------------------------------------------------------------------- 1 | # React + Vite 2 | 3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. 4 | 5 | Currently, two official plugins are available: 6 | 7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh 8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh 9 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample_001", 3 | "private": true, 4 | "version": "0.0.1", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "vite build", 9 | "lint": "eslint .", 10 | "preview": "vite preview" 11 | }, 12 | "dependencies": { 13 | "prop-types": "^15.8.1", 14 | "react": "^18.3.1", 15 | "react-dom": "^18.3.1" 16 | }, 17 | "devDependencies": { 18 | "@eslint/js": "^9.17.0", 19 | "@types/react": "^18.3.18", 20 | "@types/react-dom": "^18.3.5", 21 | "@vitejs/plugin-react": "^4.3.4", 22 | "eslint": "^9.17.0", 23 | "eslint-plugin-react": "^7.37.2", 24 | "eslint-plugin-react-hooks": "^5.0.0", 25 | "eslint-plugin-react-refresh": "^0.4.16", 26 | "globals": "^15.14.0", 27 | "vite": "^6.0.5" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/App.css: -------------------------------------------------------------------------------- 1 | .card_container { 2 | background-color: pink; 3 | width: 200px; 4 | padding: 10px; 5 | border: 2px solid gray; 6 | box-shadow: 5px 5px 10px 0 grey; 7 | border-radius: 10px; 8 | } 9 | 10 | .parent { 11 | display: flex; 12 | gap: 10px; 13 | flex-wrap: wrap; 14 | } 15 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/App.jsx: -------------------------------------------------------------------------------- 1 | // 2 | 3 | import "./App.css"; 4 | import CounterPage from "./app/Counter"; 5 | 6 | function App() { 7 | return ; 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/app/Counter.jsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | 3 | function CounterPage() { 4 | const [count, setCount] = useState(0); 5 | 6 | // let count = 0; 7 | 8 | function increaseNumber() { 9 | // count++; 10 | setCount(count + 1); 11 | console.log(count); 12 | } 13 | 14 | function decreaseNumber() { 15 | // count--; 16 | setCount(count - 1); 17 | console.log(count); 18 | } 19 | 20 | function resetNumber() { 21 | // count = 0; 22 | setCount(0); 23 | console.log(count); 24 | } 25 | 26 | return ( 27 |
28 |

Number: {count}

29 | 30 | 31 | 32 |
33 | ); 34 | } 35 | 36 | export default CounterPage; 37 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/app/ListPages.jsx: -------------------------------------------------------------------------------- 1 | import Card from "../components/Card"; 2 | 3 | function ListPages() { 4 | const data = Array.from({ 5 | length: 5000, 6 | }); 7 | 8 | return ( 9 |
10 | {data.map((_, index) => ( 11 | 17 | ))} 18 |
19 | ); 20 | } 21 | 22 | export default ListPages; 23 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/components/Card.jsx: -------------------------------------------------------------------------------- 1 | import { string } from "prop-types"; 2 | 3 | function Card({ title, price, description }) { 4 | return ( 5 |
6 |

{title}

7 |

Rs. {price}/-

8 |

{description}

9 |
10 | ); 11 | } 12 | 13 | Card.propTypes = { 14 | title: string.isRequired, 15 | price: string.isRequired, 16 | description: string.isRequired, 17 | }; 18 | 19 | export default Card; 20 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/components/Counter.jsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/sample_001/src/components/Counter.jsx -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/index.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_17/frontend/sample_001/src/index.css -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/src/main.jsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from 'react' 2 | import { createRoot } from 'react-dom/client' 3 | import './index.css' 4 | import App from './App.jsx' 5 | 6 | createRoot(document.getElementById('root')).render( 7 | 8 | 9 | , 10 | ) 11 | -------------------------------------------------------------------------------- /BATCH_17/frontend/sample_001/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vite.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /BATCH_18/README.md: -------------------------------------------------------------------------------- 1 | Students: Aysuh, radhika, pooja 2 | Start: Jan 2025 3 | Course: MERN STACK 4 | -------------------------------------------------------------------------------- /BATCH_18/css/asset.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BATCH_18/css/attribute_selector.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 5 | 31 | 32 | 33 | 34 | 35 | Google 36 | shipsar 37 | shipsar 38 | shipsar web 39 | shipsar blogs 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /BATCH_18/css/background.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |

Hello I am Vijay

24 |
25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /BATCH_18/css/combination-selectors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Selectors 4 | 5 | 37 | 38 | 39 | 40 | 41 |
42 | Direct Child das 43 |

Hello Spdas das

44 |

Hello

45 | Direct Child das 46 |

Hello Spdas das

47 |

Hello

48 | Direct Child das 49 | Direct Child das 50 | 51 |
52 | 53 |

Hello

54 |

Hello

55 |

Hello

56 | Spdas das 57 | 58 | 59 | -------------------------------------------------------------------------------- /BATCH_18/css/display.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 29 | 30 | 31 | 32 | 33 |

hello

34 | Bye 35 |

Bye

36 | 37 | some 38 | 39 |
sds
40 | 41 | ds d 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
CompanyContactCountry
Alfreds FutterkisteMaria AndersGermany
Centro comercial MoctezumaFrancisco ChangMexico
60 | ds d 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /BATCH_18/css/flex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | THE FLEX 4 | 30 | 31 | 32 | 33 | 34 |
35 | 36 |
1
37 |
2
38 |
3
39 |
4
40 |
5
41 |
6
42 |
7
43 |
8
44 | 45 |
46 |

hello

47 | 48 | 49 | -------------------------------------------------------------------------------- /BATCH_18/css/margin-padding.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Margin Padding 4 | 37 | 38 | 39 | 40 | 41 |
42 | 43 |
44 | 45 |
46 |
47 | 48 |
49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /BATCH_18/css/position-absolute.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Position 4 | 38 | 39 | 40 | 41 |
42 |
43 |
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /BATCH_18/css/position.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Position 4 | 38 | 39 | 40 | 41 |
42 |
43 |
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /BATCH_18/css/pseudo_elements.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 5 | 42 | 43 | 44 | 45 | 46 |

Pseudo Elements

47 | 48 |
    49 |
  • Cow
  • 50 |
  • Dog
  • 51 |
  • Cat
  • 52 |
  • Cow
  • 53 |
  • Dog
  • 54 |
  • Cat
  • 55 |
  • Cow
  • 56 |
  • Dog
  • 57 |
  • Cat
  • 58 | 59 |
60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /BATCH_18/css/text.css: -------------------------------------------------------------------------------- 1 | span { 2 | color: purple; 3 | font-size: 45px; 4 | background-color: red; 5 | } 6 | -------------------------------------------------------------------------------- /BATCH_18/css/transform.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 31 | 32 | 33 |
34 | Vijay 35 |
36 | 37 |
38 | 39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /BATCH_18/css/transition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 28 | 29 | 30 |
31 | Vijay 32 |
33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /BATCH_18/html/images/Rainforest_Fatu_Hiva.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_18/html/images/Rainforest_Fatu_Hiva.jpg -------------------------------------------------------------------------------- /BATCH_18/html/list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | List 4 | 5 | 6 | 7 | 13 | 14 |
    15 |
  • Cow
  • 16 |
  • Dog
  • 17 |
  • Cat
  • 18 |
  • Rat
  • 19 |
20 | 21 | 26 | 27 |
    28 |
  1. Cow
  2. 29 |
  3. Dog
  4. 30 |
  5. Cat
  6. 31 |
  7. Rat
  8. 32 |
33 | 34 | 41 | 42 |
43 |
Animals
44 |
Cow
45 |
Dog
46 |
Cat
47 | 48 |
Birds
49 |
parrot
50 |
sparrow
51 |
pigeon
52 | 53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /BATCH_18/html/media.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BATCH_18/html/table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Table in HTML 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
SerialNameAge
1.Vijay25
2.Ajay30
3.Ajay30
43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /BATCH_18/html/videos/sample.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_18/html/videos/sample.mp4 -------------------------------------------------------------------------------- /BATCH_18/js/html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Javascript Operators 4 | 5 | 6 | 7 | 8 | 9 | 10 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /BATCH_18/react/NOTES.md: -------------------------------------------------------------------------------- 1 | ### Node js version: 2 | 3 | $ node -v 4 | 5 | ### Create react project through vite: 6 | 7 | $ npm create vite@latest 8 | 9 | ### command for installing node_modules folder: 10 | 11 | $ npm i 12 | $ npm install 13 | 14 | ### command to start project : 15 | 16 | $ npm run dev 17 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/.dockerignore: -------------------------------------------------------------------------------- 1 | .react-router 2 | build 3 | node_modules 4 | README.md -------------------------------------------------------------------------------- /BATCH_18/react/classes/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # React Router 5 | /.react-router/ 6 | /build/ 7 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-alpine AS development-dependencies-env 2 | COPY . /app 3 | WORKDIR /app 4 | RUN npm ci 5 | 6 | FROM node:20-alpine AS production-dependencies-env 7 | COPY ./package.json package-lock.json /app/ 8 | WORKDIR /app 9 | RUN npm ci --omit=dev 10 | 11 | FROM node:20-alpine AS build-env 12 | COPY . /app/ 13 | COPY --from=development-dependencies-env /app/node_modules /app/node_modules 14 | WORKDIR /app 15 | RUN npm run build 16 | 17 | FROM node:20-alpine 18 | COPY ./package.json package-lock.json /app/ 19 | COPY --from=production-dependencies-env /app/node_modules /app/node_modules 20 | COPY --from=build-env /app/build /app/build 21 | WORKDIR /app 22 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /BATCH_18/react/classes/app/app.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | @theme { 4 | --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif, 5 | "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 6 | } 7 | 8 | html, 9 | body { 10 | @apply bg-white dark:bg-gray-950; 11 | 12 | @media (prefers-color-scheme: dark) { 13 | color-scheme: dark; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/app/components/Navbar.jsx: -------------------------------------------------------------------------------- 1 | import { Link, useLocation } from "react-router"; 2 | 3 | export default function Navbar() { 4 | const location = useLocation(); 5 | // console.log(location.pathname); 6 | 7 | const pages = [ 8 | { 9 | id: 1, 10 | title: "Home Page", 11 | path: "/", 12 | }, 13 | { 14 | id: 2, 15 | title: "Form Page", 16 | path: "/form", 17 | }, 18 | ]; 19 | return ( 20 |
21 |
    26 | {pages.map((item) => { 27 | return ( 28 |
  • 34 | {item.title} 35 |
  • 36 | ); 37 | })} 38 |
39 |
40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { type RouteConfig, index, route } from "@react-router/dev/routes"; 2 | 3 | export default [ 4 | index("routes/home.jsx"), 5 | route("form", "routes/form.jsx"), 6 | route("api", "routes/api.jsx"), 7 | ] satisfies RouteConfig; 8 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/app/routes/home.jsx: -------------------------------------------------------------------------------- 1 | import Navbar from "../components/Navbar"; 2 | 3 | export function meta() { 4 | return [ 5 | { title: "New React Router App" }, 6 | { name: "description", content: "Welcome to React Router!" }, 7 | ]; 8 | } 9 | 10 | export default function Home() { 11 | return ( 12 |
13 | 14 | 15 |

Hello, Home Page

16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi_page", 3 | "private": true, 4 | "type": "module", 5 | "scripts": { 6 | "build": "react-router build", 7 | "dev": "react-router dev", 8 | "start": "react-router-serve ./build/server/index.js", 9 | "typecheck": "react-router typegen && tsc" 10 | }, 11 | "dependencies": { 12 | "@react-router/node": "^7.5.3", 13 | "@react-router/serve": "^7.5.3", 14 | "isbot": "^5.1.27", 15 | "react": "^19.1.0", 16 | "react-dom": "^19.1.0", 17 | "react-router": "^7.5.3" 18 | }, 19 | "devDependencies": { 20 | "@react-router/dev": "^7.5.3", 21 | "@tailwindcss/vite": "^4.1.4", 22 | "@types/node": "^20", 23 | "@types/react": "^19.1.2", 24 | "@types/react-dom": "^19.1.2", 25 | "tailwindcss": "^4.1.4", 26 | "typescript": "^5.8.3", 27 | "vite": "^6.3.3", 28 | "vite-tsconfig-paths": "^5.1.4" 29 | } 30 | } -------------------------------------------------------------------------------- /BATCH_18/react/classes/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_18/react/classes/public/favicon.ico -------------------------------------------------------------------------------- /BATCH_18/react/classes/react-router.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "@react-router/dev/config"; 2 | 3 | export default { 4 | // Config options... 5 | // Server-side render by default, to enable SPA mode set this to `false` 6 | ssr: true, 7 | } satisfies Config; 8 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "**/*", 4 | "**/.server/**/*", 5 | "**/.client/**/*", 6 | ".react-router/types/**/*" 7 | ], 8 | "compilerOptions": { 9 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 10 | "types": ["node", "vite/client"], 11 | "target": "ES2022", 12 | "module": "ES2022", 13 | "moduleResolution": "bundler", 14 | "jsx": "react-jsx", 15 | "rootDirs": [".", "./.react-router/types"], 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./app/*"] 19 | }, 20 | "esModuleInterop": true, 21 | "verbatimModuleSyntax": true, 22 | "noEmit": true, 23 | "resolveJsonModule": true, 24 | "skipLibCheck": true, 25 | "strict": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_18/react/classes/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { reactRouter } from "@react-router/dev/vite"; 2 | import tailwindcss from "@tailwindcss/vite"; 3 | import { defineConfig } from "vite"; 4 | import tsconfigPaths from "vite-tsconfig-paths"; 5 | 6 | export default defineConfig({ 7 | plugins: [tailwindcss(), reactRouter(), tsconfigPaths()], 8 | }); 9 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/.dockerignore: -------------------------------------------------------------------------------- 1 | .react-router 2 | build 3 | node_modules 4 | README.md -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /node_modules/ 3 | 4 | # React Router 5 | /.react-router/ 6 | /build/ 7 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-alpine AS development-dependencies-env 2 | COPY . /app 3 | WORKDIR /app 4 | RUN npm ci 5 | 6 | FROM node:20-alpine AS production-dependencies-env 7 | COPY ./package.json package-lock.json /app/ 8 | WORKDIR /app 9 | RUN npm ci --omit=dev 10 | 11 | FROM node:20-alpine AS build-env 12 | COPY . /app/ 13 | COPY --from=development-dependencies-env /app/node_modules /app/node_modules 14 | WORKDIR /app 15 | RUN npm run build 16 | 17 | FROM node:20-alpine 18 | COPY ./package.json package-lock.json /app/ 19 | COPY --from=production-dependencies-env /app/node_modules /app/node_modules 20 | COPY --from=build-env /app/build /app/build 21 | WORKDIR /app 22 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/app/app.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | @theme { 4 | --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif, 5 | "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 6 | } 7 | 8 | html, 9 | body { 10 | @apply bg-white dark:bg-gray-950; 11 | 12 | @media (prefers-color-scheme: dark) { 13 | color-scheme: dark; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/app/components/Navbar.tsx: -------------------------------------------------------------------------------- 1 | import { Link, useLocation } from "react-router"; 2 | 3 | export default function Navbar() { 4 | const location = useLocation(); 5 | console.log(location.pathname); 6 | return ( 7 |
8 |
    13 |
  • 14 | Home Page 15 |
  • 16 |
  • 17 | About Page 18 |
  • 19 |
  • 20 | Contact Page 21 |
  • 22 |
23 |
24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { type RouteConfig, index, route } from "@react-router/dev/routes"; 2 | 3 | export default [ 4 | index("routes/home.tsx"), 5 | route("about", "routes/about.tsx"), 6 | route("contact", "routes/contact.tsx"), 7 | ] satisfies RouteConfig; 8 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/app/routes/about.tsx: -------------------------------------------------------------------------------- 1 | import Navbar from "~/components/Navbar"; 2 | import type { Route } from "./+types/home"; 3 | 4 | export function meta({}: Route.MetaArgs) { 5 | return [ 6 | { title: "About Page" }, 7 | { name: "description", content: "Welcome to React Router!" }, 8 | ]; 9 | } 10 | 11 | export default function About() { 12 | return ( 13 |
14 | 15 |

Hello, About Page

16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/app/routes/contact.tsx: -------------------------------------------------------------------------------- 1 | import Navbar from "~/components/Navbar"; 2 | import type { Route } from "./+types/home"; 3 | 4 | export function meta({}: Route.MetaArgs) { 5 | return [ 6 | { title: "Contact Page" }, 7 | { name: "description", content: "Welcome to React Router!" }, 8 | ]; 9 | } 10 | 11 | export default function Contact() { 12 | return ( 13 |
14 | 15 | 16 |

Hello, Contact Page

17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/app/routes/home.tsx: -------------------------------------------------------------------------------- 1 | import Navbar from "~/components/Navbar"; 2 | import type { Route } from "./+types/home"; 3 | 4 | export function meta({}: Route.MetaArgs) { 5 | return [ 6 | { title: "New React Router App" }, 7 | { name: "description", content: "Welcome to React Router!" }, 8 | ]; 9 | } 10 | 11 | export default function Home() { 12 | return ( 13 |
14 | 15 | 16 |

Hello, Home Page

17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi_page", 3 | "private": true, 4 | "type": "module", 5 | "scripts": { 6 | "build": "react-router build", 7 | "dev": "react-router dev", 8 | "start": "react-router-serve ./build/server/index.js", 9 | "typecheck": "react-router typegen && tsc" 10 | }, 11 | "dependencies": { 12 | "@react-router/node": "^7.5.3", 13 | "@react-router/serve": "^7.5.3", 14 | "isbot": "^5.1.27", 15 | "react": "^19.1.0", 16 | "react-dom": "^19.1.0", 17 | "react-router": "^7.5.3" 18 | }, 19 | "devDependencies": { 20 | "@react-router/dev": "^7.5.3", 21 | "@tailwindcss/vite": "^4.1.4", 22 | "@types/node": "^20", 23 | "@types/react": "^19.1.2", 24 | "@types/react-dom": "^19.1.2", 25 | "tailwindcss": "^4.1.4", 26 | "typescript": "^5.8.3", 27 | "vite": "^6.3.3", 28 | "vite-tsconfig-paths": "^5.1.4" 29 | } 30 | } -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_18/react/multi_page/public/favicon.ico -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/react-router.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "@react-router/dev/config"; 2 | 3 | export default { 4 | // Config options... 5 | // Server-side render by default, to enable SPA mode set this to `false` 6 | ssr: true, 7 | } satisfies Config; 8 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "**/*", 4 | "**/.server/**/*", 5 | "**/.client/**/*", 6 | ".react-router/types/**/*" 7 | ], 8 | "compilerOptions": { 9 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 10 | "types": ["node", "vite/client"], 11 | "target": "ES2022", 12 | "module": "ES2022", 13 | "moduleResolution": "bundler", 14 | "jsx": "react-jsx", 15 | "rootDirs": [".", "./.react-router/types"], 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./app/*"] 19 | }, 20 | "esModuleInterop": true, 21 | "verbatimModuleSyntax": true, 22 | "noEmit": true, 23 | "resolveJsonModule": true, 24 | "skipLibCheck": true, 25 | "strict": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_18/react/multi_page/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { reactRouter } from "@react-router/dev/vite"; 2 | import tailwindcss from "@tailwindcss/vite"; 3 | import { defineConfig } from "vite"; 4 | import tsconfigPaths from "vite-tsconfig-paths"; 5 | 6 | export default defineConfig({ 7 | plugins: [tailwindcss(), reactRouter(), tsconfigPaths()], 8 | }); 9 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/README.md: -------------------------------------------------------------------------------- 1 | # Notes -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/eslint.config.js: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js' 2 | import globals from 'globals' 3 | import reactHooks from 'eslint-plugin-react-hooks' 4 | import reactRefresh from 'eslint-plugin-react-refresh' 5 | import tseslint from 'typescript-eslint' 6 | 7 | export default tseslint.config( 8 | { ignores: ['dist'] }, 9 | { 10 | extends: [js.configs.recommended, ...tseslint.configs.recommended], 11 | files: ['**/*.{ts,tsx}'], 12 | languageOptions: { 13 | ecmaVersion: 2020, 14 | globals: globals.browser, 15 | }, 16 | plugins: { 17 | 'react-hooks': reactHooks, 18 | 'react-refresh': reactRefresh, 19 | }, 20 | rules: { 21 | ...reactHooks.configs.recommended.rules, 22 | 'react-refresh/only-export-components': [ 23 | 'warn', 24 | { allowConstantExport: true }, 25 | ], 26 | }, 27 | }, 28 | ) 29 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Basic VIte app 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-app", 3 | "private": true, 4 | "version": "0.0.1", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc -b && vite build", 9 | "lint": "eslint .", 10 | "preview": "vite preview" 11 | }, 12 | "dependencies": { 13 | "@tailwindcss/vite": "^4.1.4", 14 | "lucide-react": "^0.503.0", 15 | "react": "^19.0.0", 16 | "react-dom": "^19.0.0", 17 | "tailwindcss": "^4.1.4" 18 | }, 19 | "devDependencies": { 20 | "@eslint/js": "^9.22.0", 21 | "@types/react": "^19.0.10", 22 | "@types/react-dom": "^19.0.4", 23 | "@vitejs/plugin-react": "^4.3.4", 24 | "eslint": "^9.22.0", 25 | "eslint-plugin-react-hooks": "^5.2.0", 26 | "eslint-plugin-react-refresh": "^0.4.19", 27 | "globals": "^16.0.0", 28 | "typescript": "~5.7.2", 29 | "typescript-eslint": "^8.26.1", 30 | "vite": "^6.3.1" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/src/App.tsx: -------------------------------------------------------------------------------- 1 | // Default Import 2 | import Box3 from "./components/Box"; 3 | import { Box4, Box5 } from "./components/Box"; 4 | 5 | export default function App() { 6 | return ( 7 |
8 |

Hello

9 | 10 | 11 | 12 | 13 |
14 | ); 15 | } 16 | 17 | // Compoenent 18 | // function Box() { 19 | // return ( 20 | //
21 | //

HEllo

22 | //

Bye

23 | //
24 | // ); 25 | // } 26 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/src/components/Box.tsx: -------------------------------------------------------------------------------- 1 | // Compoenent 2 | 3 | // Default export 4 | export default function Box3({ name }) { 5 | return ( 6 |
7 |

HEllo, {name}

8 |

Bye

9 |
10 | ); 11 | } 12 | 13 | // Named export 14 | export function Box4() { 15 | return ( 16 |
17 |

HEllo

18 |

Bye

19 |
20 | ); 21 | } 22 | 23 | export function Box5() { 24 | return ( 25 |
26 |

HEllo

27 |

Bye

28 |
29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/src/components/counter.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import { House } from "lucide-react"; 3 | 4 | export default function Counter() { 5 | // let count = 5; 6 | 7 | const [count, setCount] = useState(5) 8 | 9 | function increase() { 10 | // alert(count) 11 | // setCount(8) 12 | setCount(count + 1) 13 | } 14 | 15 | console.log("Hello in Counter") 16 | 17 | return ( 18 |
19 | 20 |

hello

21 |

{count}

22 |
23 | 24 | 25 | 26 |
27 |
28 | ) 29 | } -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/src/index.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/src/main.tsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from 'react' 2 | import { createRoot } from 'react-dom/client' 3 | import './index.css' 4 | import App from './App.tsx' 5 | 6 | createRoot(document.getElementById('root')!).render( 7 | 8 | 9 | , 10 | ) 11 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", 4 | "target": "ES2020", 5 | "useDefineForClassFields": true, 6 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 7 | "module": "ESNext", 8 | "skipLibCheck": true, 9 | 10 | /* Bundler mode */ 11 | "moduleResolution": "bundler", 12 | "allowImportingTsExtensions": true, 13 | "isolatedModules": true, 14 | "moduleDetection": "force", 15 | "noEmit": true, 16 | "jsx": "react-jsx", 17 | 18 | /* Linting */ 19 | "strict": true, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "noFallthroughCasesInSwitch": true, 23 | "noUncheckedSideEffectImports": true 24 | }, 25 | "include": ["src"] 26 | } 27 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", 4 | "target": "ES2022", 5 | "lib": ["ES2023"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "isolatedModules": true, 13 | "moduleDetection": "force", 14 | "noEmit": true, 15 | 16 | /* Linting */ 17 | "strict": true, 18 | "noUnusedLocals": true, 19 | "noUnusedParameters": true, 20 | "noFallthroughCasesInSwitch": true, 21 | "noUncheckedSideEffectImports": true 22 | }, 23 | "include": ["vite.config.ts"] 24 | } 25 | -------------------------------------------------------------------------------- /BATCH_18/react/vite-app/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import react from "@vitejs/plugin-react"; 3 | import tailwindcss from '@tailwindcss/vite' 4 | 5 | // https://vite.dev/config/ 6 | export default defineConfig({ 7 | plugins: [tailwindcss(), react()], 8 | }); 9 | -------------------------------------------------------------------------------- /BATCH_19/CSS/11428909.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_19/CSS/11428909.png -------------------------------------------------------------------------------- /BATCH_19/README.md: -------------------------------------------------------------------------------- 1 | Prashant 2 | Rohit 3 | -------------------------------------------------------------------------------- /BATCH_19/react/classes/.dockerignore: -------------------------------------------------------------------------------- 1 | .react-router 2 | build 3 | node_modules 4 | README.md -------------------------------------------------------------------------------- /BATCH_19/react/classes/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /node_modules/ 3 | 4 | # React Router 5 | /.react-router/ 6 | /build/ 7 | -------------------------------------------------------------------------------- /BATCH_19/react/classes/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-alpine AS development-dependencies-env 2 | COPY . /app 3 | WORKDIR /app 4 | RUN npm ci 5 | 6 | FROM node:20-alpine AS production-dependencies-env 7 | COPY ./package.json package-lock.json /app/ 8 | WORKDIR /app 9 | RUN npm ci --omit=dev 10 | 11 | FROM node:20-alpine AS build-env 12 | COPY . /app/ 13 | COPY --from=development-dependencies-env /app/node_modules /app/node_modules 14 | WORKDIR /app 15 | RUN npm run build 16 | 17 | FROM node:20-alpine 18 | COPY ./package.json package-lock.json /app/ 19 | COPY --from=production-dependencies-env /app/node_modules /app/node_modules 20 | COPY --from=build-env /app/build /app/build 21 | WORKDIR /app 22 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /BATCH_19/react/classes/app/app.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | @theme { 4 | --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif, 5 | "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 6 | } 7 | 8 | /* html, 9 | body { 10 | @apply bg-white dark:bg-gray-950; 11 | 12 | @media (prefers-color-scheme: light) { 13 | color-scheme: light; 14 | } 15 | } */ 16 | 17 | input { 18 | padding: 8px 15px; 19 | margin-bottom: 1rem; 20 | border: 1px solid #ccc; 21 | border-radius: 4px; 22 | font-size: 16px; 23 | transition: border-color 0.1s ease; 24 | 25 | &:focus { 26 | border-color: #007bff; 27 | outline: none; 28 | } 29 | } 30 | 31 | button { 32 | padding: 8px 15px; 33 | background-color: #007bff; 34 | color: #ffffff; 35 | border: none; 36 | font-size: 16px; 37 | border-radius: 4px; 38 | cursor: pointer; 39 | transition: background-color 0.3s ease; 40 | 41 | &:hover { 42 | background-color: #0056b3; 43 | } 44 | 45 | &:active { 46 | transform: scale(0.95); 47 | } 48 | } 49 | 50 | h1 { 51 | @apply text-2xl font-semibold 52 | } -------------------------------------------------------------------------------- /BATCH_19/react/classes/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { type RouteConfig, index, route } from "@react-router/dev/routes"; 2 | 3 | export const routesList = [ 4 | { 5 | id: 0, 6 | title: "Components and Counter", 7 | route: "/comp_counter", 8 | path: "routes/comp_counter.tsx", 9 | }, 10 | { 11 | id: 1, 12 | title: "Basic Forms", 13 | route: "/forms", 14 | path: "routes/forms_basic.tsx", 15 | }, 16 | { 17 | id: 2, 18 | title: "Advance Forms", 19 | route: "/forms_advanced", 20 | path: "routes/forms_advance.tsx", 21 | }, 22 | { 23 | id: 3, 24 | title: "Use Ref Hook", 25 | route: "/reference", 26 | path: "routes/reference_hook.tsx", 27 | }, 28 | { 29 | id: 4, 30 | title: "Reducer Hook", 31 | route: "/reducer", 32 | path: "routes/reducer_hook.tsx", 33 | }, 34 | ]; 35 | 36 | export default [ 37 | index("routes/home.tsx"), 38 | ...routesList.map((e) => route(e.route, e.path)), 39 | ] satisfies RouteConfig; 40 | -------------------------------------------------------------------------------- /BATCH_19/react/classes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "classes", 3 | "private": true, 4 | "type": "module", 5 | "scripts": { 6 | "build": "react-router build", 7 | "dev": "react-router dev", 8 | "start": "react-router-serve ./build/server/index.js", 9 | "typecheck": "react-router typegen && tsc" 10 | }, 11 | "dependencies": { 12 | "@react-router/node": "^7.5.3", 13 | "@react-router/serve": "^7.5.3", 14 | "isbot": "^5.1.27", 15 | "react": "^19.1.0", 16 | "react-dom": "^19.1.0", 17 | "react-router": "^7.5.3" 18 | }, 19 | "devDependencies": { 20 | "@react-router/dev": "^7.5.3", 21 | "@tailwindcss/vite": "^4.1.4", 22 | "@types/node": "^20", 23 | "@types/react": "^19.1.2", 24 | "@types/react-dom": "^19.1.2", 25 | "tailwindcss": "^4.1.4", 26 | "typescript": "^5.8.3", 27 | "vite": "^6.3.3", 28 | "vite-tsconfig-paths": "^5.1.4" 29 | } 30 | } -------------------------------------------------------------------------------- /BATCH_19/react/classes/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_19/react/classes/public/favicon.ico -------------------------------------------------------------------------------- /BATCH_19/react/classes/react-router.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "@react-router/dev/config"; 2 | 3 | export default { 4 | // Config options... 5 | // Server-side render by default, to enable SPA mode set this to `false` 6 | ssr: true, 7 | } satisfies Config; 8 | -------------------------------------------------------------------------------- /BATCH_19/react/classes/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "**/*", 4 | "**/.server/**/*", 5 | "**/.client/**/*", 6 | ".react-router/types/**/*" 7 | ], 8 | "compilerOptions": { 9 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 10 | "types": ["node", "vite/client"], 11 | "target": "ES2022", 12 | "module": "ES2022", 13 | "moduleResolution": "bundler", 14 | "jsx": "react-jsx", 15 | "rootDirs": [".", "./.react-router/types"], 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./app/*"] 19 | }, 20 | "esModuleInterop": true, 21 | "verbatimModuleSyntax": true, 22 | "noEmit": true, 23 | "resolveJsonModule": true, 24 | "skipLibCheck": true, 25 | "strict": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_19/react/classes/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { reactRouter } from "@react-router/dev/vite"; 2 | import tailwindcss from "@tailwindcss/vite"; 3 | import { defineConfig } from "vite"; 4 | import tsconfigPaths from "vite-tsconfig-paths"; 5 | 6 | export default defineConfig({ 7 | plugins: [tailwindcss(), reactRouter(), tsconfigPaths()], 8 | }); 9 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/README.md: -------------------------------------------------------------------------------- 1 | V1.0.1 -------------------------------------------------------------------------------- /BATCH_19/react/components_props/eslint.config.js: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js' 2 | import globals from 'globals' 3 | import reactHooks from 'eslint-plugin-react-hooks' 4 | import reactRefresh from 'eslint-plugin-react-refresh' 5 | 6 | export default [ 7 | { ignores: ['dist'] }, 8 | { 9 | files: ['**/*.{js,jsx}'], 10 | languageOptions: { 11 | ecmaVersion: 2020, 12 | globals: globals.browser, 13 | parserOptions: { 14 | ecmaVersion: 'latest', 15 | ecmaFeatures: { jsx: true }, 16 | sourceType: 'module', 17 | }, 18 | }, 19 | plugins: { 20 | 'react-hooks': reactHooks, 21 | 'react-refresh': reactRefresh, 22 | }, 23 | rules: { 24 | ...js.configs.recommended.rules, 25 | ...reactHooks.configs.recommended.rules, 26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }], 27 | 'react-refresh/only-export-components': [ 28 | 'warn', 29 | { allowConstantExport: true }, 30 | ], 31 | }, 32 | }, 33 | ] 34 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "classes", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "vite build", 9 | "lint": "eslint .", 10 | "preview": "vite preview" 11 | }, 12 | "dependencies": { 13 | "react": "^19.1.0", 14 | "react-dom": "^19.1.0" 15 | }, 16 | "devDependencies": { 17 | "@eslint/js": "^9.25.0", 18 | "@types/react": "^19.1.2", 19 | "@types/react-dom": "^19.1.2", 20 | "@vitejs/plugin-react": "^4.4.1", 21 | "eslint": "^9.25.0", 22 | "eslint-plugin-react-hooks": "^5.2.0", 23 | "eslint-plugin-react-refresh": "^0.4.19", 24 | "globals": "^16.0.0", 25 | "vite": "^6.3.5" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/src/App.css: -------------------------------------------------------------------------------- 1 | #root { 2 | max-width: 1280px; 3 | margin: 0 auto; 4 | padding: 2rem; 5 | text-align: center; 6 | } 7 | 8 | .logo { 9 | height: 6em; 10 | padding: 1.5em; 11 | will-change: filter; 12 | transition: filter 300ms; 13 | } 14 | .logo:hover { 15 | filter: drop-shadow(0 0 2em #646cffaa); 16 | } 17 | .logo.react:hover { 18 | filter: drop-shadow(0 0 2em #61dafbaa); 19 | } 20 | 21 | @keyframes logo-spin { 22 | from { 23 | transform: rotate(0deg); 24 | } 25 | to { 26 | transform: rotate(360deg); 27 | } 28 | } 29 | 30 | @media (prefers-reduced-motion: no-preference) { 31 | a:nth-of-type(2) .logo { 32 | animation: logo-spin infinite 20s linear; 33 | } 34 | } 35 | 36 | .card { 37 | padding: 2em; 38 | } 39 | 40 | .read-the-docs { 41 | color: #888; 42 | } 43 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/src/App.jsx: -------------------------------------------------------------------------------- 1 | // import PropsBox from "./pages/PropsBox"; 2 | // export default PropsBox; 3 | 4 | // export default function App() { 5 | // return ; 6 | // } 7 | 8 | export { default } from "./components/CounterAdvanced"; 9 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/src/components/Box.jsx: -------------------------------------------------------------------------------- 1 | // export function Box() { 2 | // return ( 3 | //
10 | // Vijay 11 | //
12 | // ); 13 | // } 14 | 15 | // export default function Box2() { 16 | // return ( 17 | //
24 | // Vijay 25 | //
26 | // ); 27 | // } 28 | 29 | function Box1({ name, bg }) { 30 | // const name = "Vijay"; 31 | return ( 32 |
39 | {name} 40 |
41 | ); 42 | } 43 | 44 | export const name = "dasda"; 45 | 46 | export { Box1 }; 47 | 48 | export default Box1; 49 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/src/components/ChildCounter1.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function ChildCounter1({ count, increase, decrease, reset }) { 4 | return ( 5 |
6 |

ChildCounter 1

7 |

{count}

8 | 9 | 10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/src/components/ChildCounter2.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function ChildCounter2({ count, increase, decrease, reset }) { 4 | return ( 5 |
6 |

ChildCounter 2

7 |

{count}

8 | 9 | 10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/src/main.jsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from 'react' 2 | import { createRoot } from 'react-dom/client' 3 | import './index.css' 4 | import App from './App.jsx' 5 | 6 | createRoot(document.getElementById('root')).render( 7 | 8 | 9 | , 10 | ) 11 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/src/pages/PropsBox.jsx: -------------------------------------------------------------------------------- 1 | // import SomeBox from "./components/Box"; 2 | // import { Box, Box1 } from "./components/Box"; 3 | 4 | // import SomeBox, { Box, Box1 } from "./components/Box"; 5 | 6 | import * as BoxContainer from "../components/Box"; 7 | import { name } from "../components/Box"; 8 | 9 | function PropsBox() { 10 | return ( 11 | <> 12 | {/* 13 | 14 | 15 | 16 | 17 | 18 | 19 | */} 20 | {/* */} 21 | 22 | 23 | 24 | {name} 25 | 26 | ); 27 | } 28 | 29 | export default PropsBox; 30 | -------------------------------------------------------------------------------- /BATCH_19/react/components_props/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vite.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/.dockerignore: -------------------------------------------------------------------------------- 1 | .react-router 2 | build 3 | node_modules 4 | README.md -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /node_modules/ 3 | 4 | # React Router 5 | /.react-router/ 6 | /build/ 7 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-alpine AS development-dependencies-env 2 | COPY . /app 3 | WORKDIR /app 4 | RUN npm ci 5 | 6 | FROM node:20-alpine AS production-dependencies-env 7 | COPY ./package.json package-lock.json /app/ 8 | WORKDIR /app 9 | RUN npm ci --omit=dev 10 | 11 | FROM node:20-alpine AS build-env 12 | COPY . /app/ 13 | COPY --from=development-dependencies-env /app/node_modules /app/node_modules 14 | WORKDIR /app 15 | RUN npm run build 16 | 17 | FROM node:20-alpine 18 | COPY ./package.json package-lock.json /app/ 19 | COPY --from=production-dependencies-env /app/node_modules /app/node_modules 20 | COPY --from=build-env /app/build /app/build 21 | WORKDIR /app 22 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/app/app.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | @theme { 4 | --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif, 5 | "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 6 | } 7 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { type RouteConfig, index, route } from "@react-router/dev/routes"; 2 | 3 | export default [ 4 | index("routes/home.tsx"), 5 | route("/contact", "routes/contact.tsx"), 6 | route("/about", "routes/about.tsx"), 7 | ] satisfies RouteConfig; 8 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/app/routes/about.tsx: -------------------------------------------------------------------------------- 1 | import Header from "~/components/Header"; 2 | 3 | export default function About() { 4 | return ( 5 |
6 |
7 | 8 |

About Page

9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/app/routes/contact.tsx: -------------------------------------------------------------------------------- 1 | import Header from "~/components/Header"; 2 | 3 | export default function Contact() { 4 | return ( 5 |
6 |
7 | 8 |

Contact Page

9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/app/routes/home.tsx: -------------------------------------------------------------------------------- 1 | import { Link, Links } from "react-router"; 2 | import type { Route } from "./+types/home"; 3 | import Header from "~/components/Header"; 4 | 5 | export function meta({}: Route.MetaArgs) { 6 | return [ 7 | { title: "Some title" }, 8 | { name: "description", content: "Welcome to React Router!" }, 9 | ]; 10 | } 11 | 12 | export default function Home() { 13 | return ( 14 |
15 |
16 | 17 |

Hello

18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi_page", 3 | "private": true, 4 | "type": "module", 5 | "scripts": { 6 | "build": "react-router build", 7 | "dev": "react-router dev", 8 | "start": "react-router-serve ./build/server/index.js", 9 | "typecheck": "react-router typegen && tsc" 10 | }, 11 | "dependencies": { 12 | "@react-router/node": "^7.5.3", 13 | "@react-router/serve": "^7.5.3", 14 | "isbot": "^5.1.27", 15 | "react": "^19.1.0", 16 | "react-dom": "^19.1.0", 17 | "react-router": "^7.5.3" 18 | }, 19 | "devDependencies": { 20 | "@react-router/dev": "^7.5.3", 21 | "@tailwindcss/vite": "^4.1.4", 22 | "@types/node": "^20", 23 | "@types/react": "^19.1.2", 24 | "@types/react-dom": "^19.1.2", 25 | "tailwindcss": "^4.1.4", 26 | "typescript": "^5.8.3", 27 | "vite": "^6.3.3", 28 | "vite-tsconfig-paths": "^5.1.4" 29 | } 30 | } -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_19/react/multi_page/public/favicon.ico -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/react-router.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "@react-router/dev/config"; 2 | 3 | export default { 4 | // Config options... 5 | // Server-side render by default, to enable SPA mode set this to `false` 6 | ssr: true, 7 | } satisfies Config; 8 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "**/*", 4 | "**/.server/**/*", 5 | "**/.client/**/*", 6 | ".react-router/types/**/*" 7 | ], 8 | "compilerOptions": { 9 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 10 | "types": ["node", "vite/client"], 11 | "target": "ES2022", 12 | "module": "ES2022", 13 | "moduleResolution": "bundler", 14 | "jsx": "react-jsx", 15 | "rootDirs": [".", "./.react-router/types"], 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./app/*"] 19 | }, 20 | "esModuleInterop": true, 21 | "verbatimModuleSyntax": true, 22 | "noEmit": true, 23 | "resolveJsonModule": true, 24 | "skipLibCheck": true, 25 | "strict": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_19/react/multi_page/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { reactRouter } from "@react-router/dev/vite"; 2 | import tailwindcss from "@tailwindcss/vite"; 3 | import { defineConfig } from "vite"; 4 | import tsconfigPaths from "vite-tsconfig-paths"; 5 | 6 | export default defineConfig({ 7 | plugins: [tailwindcss(), reactRouter(), tsconfigPaths()], 8 | }); 9 | -------------------------------------------------------------------------------- /BATCH_20/CSS/class5_flex_3+flex-grow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Class 4 - Positioning (flex) 4 | 44 | 45 | 46 | 47 |

48 | The Flex 49 |

50 | 51 |
52 | 53 |
1
54 |
2
55 |
3
56 | 57 |
58 | 59 | 60 | -------------------------------------------------------------------------------- /BATCH_20/CSS/class6_flex_4_flex_basis.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Class 6 - flex Basis 4 | 45 | 46 | 47 | 48 |

49 | The Flex Basis 50 |

51 | 52 |
53 | 54 |
1
55 |
2
56 |
3
57 |
4
58 |
5
59 |
6
60 |
7
61 |
8
62 |
9
63 | 64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /BATCH_20/CSS/class6_flex_4_flex_shrink.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Class 4 - Positioning (flex) 4 | 27 | 28 | 29 | 30 |

31 | The Flex 32 |

33 | 34 |
35 | 36 |
1
37 |
2
38 |
3
39 | 40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /BATCH_20/README.md: -------------------------------------------------------------------------------- 1 | Rohit, Rajat 2 | Course: Full Stack Advanced 3 | -------------------------------------------------------------------------------- /BATCH_20/html/2_media.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2nd class Media 4 | 5 | 6 | 7 |

1. Images

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BATCH_20/html/anchor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 5 | 6 |

The Anchors

7 | 8 | 9 | Google 10 | Facebook 11 | 12 |

Image Directory

13 | 14 |

Cartoons

15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /BATCH_20/html/audio/sample.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_20/html/audio/sample.mp3 -------------------------------------------------------------------------------- /BATCH_20/html/images/seat-squatting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_20/html/images/seat-squatting.jpg -------------------------------------------------------------------------------- /BATCH_20/html/inputs_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sample 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BATCH_20/html/multi_page_website/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | About Page 4 | 5 | 6 | 7 | 8 |

About Page

9 | 10 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /BATCH_20/html/multi_page_website/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contact Page 4 | 5 | 6 | 7 | 8 |

Contact Page

9 | 10 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /BATCH_20/html/multi_page_website/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Home Page 4 | 5 | 6 | 7 | 8 |

Home Page

9 | 10 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /BATCH_20/html/sun_set.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_20/html/sun_set.webp -------------------------------------------------------------------------------- /BATCH_20/html/videos/sample_1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_20/html/videos/sample_1.mp4 -------------------------------------------------------------------------------- /BATCH_21/css/class_5_div.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Clas_5: Css 4 | 41 | 42 | 43 | 44 | 45 |
46 | 1 47 |
48 | 49 | 50 | -------------------------------------------------------------------------------- /BATCH_21/css/class_6_diff_css.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Clas_6: padding margin 4 | 5 | 8 | 9 | 26 | 27 | 28 | 29 | 30 | 31 |
32 | 1 33 |
34 | 35 |
36 | 2 37 |
38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /BATCH_21/css/class_6_simple_selector2_class.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Clas_6: Simple Selector 4 | 5 | 27 | 28 | 29 | 30 |
31 | 1 32 |
33 | 34 |
35 | 111 36 |
37 | 38 | 39 |
40 | 2 41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /BATCH_21/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: green; 3 | } 4 | 5 | div { 6 | background: blue !important; 7 | } -------------------------------------------------------------------------------- /BATCH_21/html/assets/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_21/html/assets/img.jpg -------------------------------------------------------------------------------- /BATCH_21/html/class1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Our First Website! 4 | 5 | 6 | 7 | 8 |

Hello Vijay!

9 |

Hello Vijay 2!

Hello Vijay 3!

Hello22 10 | 11 |

Hello

12 |

Hello

13 |

Hello

Vijay

14 |
Vijay
15 |
Vijay
16 | 17 |

Hello Vijay.

18 | 19 | 20 | Hello 21 | VijayKumar 22 | 23 | 24 | -------------------------------------------------------------------------------- /BATCH_21/html/landsc_noun_002_20631.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_21/html/landsc_noun_002_20631.jpg -------------------------------------------------------------------------------- /BATCH_8/README.md: -------------------------------------------------------------------------------- 1 | Students: Zaif, Ali 2 | -------------------------------------------------------------------------------- /BATCH_8/fastapi/server/.gitignore: -------------------------------------------------------------------------------- 1 | .venv -------------------------------------------------------------------------------- /BATCH_8/fastapi/server/main.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_8/fastapi/server/main.py -------------------------------------------------------------------------------- /BATCH_8/fastapi/todo_simple/__pycache__/main.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_8/fastapi/todo_simple/__pycache__/main.cpython-313.pyc -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/.dockerignore: -------------------------------------------------------------------------------- 1 | .react-router 2 | build 3 | node_modules 4 | README.md -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /node_modules/ 3 | 4 | # React Router 5 | /.react-router/ 6 | /build/ 7 | -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-alpine AS development-dependencies-env 2 | COPY . /app 3 | WORKDIR /app 4 | RUN npm ci 5 | 6 | FROM node:20-alpine AS production-dependencies-env 7 | COPY ./package.json package-lock.json /app/ 8 | WORKDIR /app 9 | RUN npm ci --omit=dev 10 | 11 | FROM node:20-alpine AS build-env 12 | COPY . /app/ 13 | COPY --from=development-dependencies-env /app/node_modules /app/node_modules 14 | WORKDIR /app 15 | RUN npm run build 16 | 17 | FROM node:20-alpine 18 | COPY ./package.json package-lock.json /app/ 19 | COPY --from=production-dependencies-env /app/node_modules /app/node_modules 20 | COPY --from=build-env /app/build /app/build 21 | WORKDIR /app 22 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/app/app.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | /* 3 | @theme { 4 | --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif, 5 | "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 6 | } 7 | 8 | html, 9 | body { 10 | @apply bg-white dark:bg-gray-950; 11 | 12 | @media (prefers-color-scheme: dark) { 13 | color-scheme: dark; 14 | } 15 | } */ 16 | 17 | body { 18 | /* background: linear-gradient(135deg, purple, green); */ 19 | /* background-size: cover; */ 20 | height: 100vh; 21 | } 22 | 23 | h1 { 24 | @apply font-bold text-xl; 25 | } 26 | 27 | button { 28 | @apply cursor-pointer; 29 | border: 1px solid gray; 30 | padding: 10px 20px; 31 | border-radius: 5px; 32 | margin: 0 5px; 33 | 34 | &:hover { 35 | box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.15); 36 | } 37 | 38 | &:active { 39 | transform: translateX(2px) translateY(2px); 40 | } 41 | } 42 | 43 | input { 44 | border: 1px solid gray; 45 | padding: 5px 10px; 46 | } 47 | -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/app/routes.ts: -------------------------------------------------------------------------------- 1 | import { type RouteConfig, index, route } from "@react-router/dev/routes"; 2 | 3 | export default [ 4 | index("routes/HomePage.jsx"), 5 | route("state", "routes/UseState.jsx"), 6 | ] satisfies RouteConfig; 7 | -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/app/routes/HomePage.jsx: -------------------------------------------------------------------------------- 1 | export default function HomePage() { 2 | const name = "Vijay Kumar"; 3 | 4 | return ( 5 |
6 |
7 |

3 Videos

8 | {Array.from({ length: 3 }, (item, index) => ({ 9 | id: index, 10 | })).map((item) => { 11 | return ( 12 |
13 |
14 |
15 |

First Video

16 |

Video Description

17 |
18 |
a
19 |
20 | ); 21 | })} 22 |
23 |
24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/app/routes/UseState.jsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | 3 | export default function UseState() { 4 | // let counter = 15; 5 | 6 | const [counter, setCounter] = useState(0); 7 | 8 | // Real Dom in Chrome 9 | // But, React uses Virtual Dom that is built using Javascript 10 | 11 | // We will declare variables using let or const if we do not want to show the updated value in real dom. 12 | 13 | // else, useState => Hook 14 | 15 | function increaseCounter() { 16 | // counter++; 17 | // counter = counter + 1 18 | setCounter(counter + 1); 19 | } 20 | 21 | return ( 22 |
23 |

Counter

24 |

Counter: {counter}

25 | 26 | 27 | 28 | 29 |
30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app", 3 | "private": true, 4 | "type": "module", 5 | "scripts": { 6 | "build": "react-router build", 7 | "dev": "react-router dev", 8 | "start": "react-router-serve ./build/server/index.js", 9 | "typecheck": "react-router typegen && tsc" 10 | }, 11 | "dependencies": { 12 | "@react-router/node": "^7.2.0", 13 | "@react-router/serve": "^7.2.0", 14 | "isbot": "^5.1.17", 15 | "react": "^19.0.0", 16 | "react-dom": "^19.0.0", 17 | "react-router": "^7.2.0" 18 | }, 19 | "devDependencies": { 20 | "@react-router/dev": "^7.2.0", 21 | "@tailwindcss/vite": "^4.0.0", 22 | "@types/node": "^20", 23 | "@types/react": "^19.0.1", 24 | "@types/react-dom": "^19.0.1", 25 | "react-router-devtools": "^1.1.0", 26 | "tailwindcss": "^4.0.0", 27 | "typescript": "^5.7.2", 28 | "vite": "^5.4.11", 29 | "vite-tsconfig-paths": "^5.1.4" 30 | } 31 | } -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_8/reactjs/demo-app/public/favicon.ico -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/react-router.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "@react-router/dev/config"; 2 | 3 | export default { 4 | // Config options... 5 | // Server-side render by default, to enable SPA mode set this to `false` 6 | ssr: true, 7 | } satisfies Config; 8 | -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "**/*", 4 | "**/.server/**/*", 5 | "**/.client/**/*", 6 | ".react-router/types/**/*" 7 | ], 8 | "compilerOptions": { 9 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 10 | "types": ["node", "vite/client"], 11 | "target": "ES2022", 12 | "module": "ES2022", 13 | "moduleResolution": "bundler", 14 | "jsx": "react-jsx", 15 | "rootDirs": [".", "./.react-router/types"], 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./app/*"] 19 | }, 20 | "esModuleInterop": true, 21 | "verbatimModuleSyntax": true, 22 | "noEmit": true, 23 | "resolveJsonModule": true, 24 | "skipLibCheck": true, 25 | "strict": true 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BATCH_8/reactjs/demo-app/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { reactRouter } from "@react-router/dev/vite"; 2 | import tailwindcss from "@tailwindcss/vite"; 3 | import { defineConfig } from "vite"; 4 | import tsconfigPaths from "vite-tsconfig-paths"; 5 | 6 | export default defineConfig({ 7 | plugins: [tailwindcss(), reactRouter(), tsconfigPaths()], 8 | }); 9 | -------------------------------------------------------------------------------- /BATCH_8/sql/Visual_SQL_JOINS_V2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_8/sql/Visual_SQL_JOINS_V2.png -------------------------------------------------------------------------------- /BATCH_8/sql/alter.sql: -------------------------------------------------------------------------------- 1 | -- ALTER TABLES 2 | 3 | SELECT * FROM students; 4 | 5 | -- ADD NEW COLUMNS 6 | ALTER TABLE students ADD COLUMN age INT; 7 | ALTER TABLE students ADD COLUMN age INT DEFAULT 0; 8 | 9 | -- DELETE COLUMN 10 | ALTER TABLE students DROP COLUMN age; 11 | 12 | -- RENAME COLUMN NAME 13 | ALTER TABLE students RENAME COLUMN name TO full_name; 14 | 15 | -- MODIFY COLUMN TYPE 16 | 17 | ALTER TABLE students COLUMN age SET DECIMAL; 18 | 19 | -------------------------------------------------------------------------------- /BATCH_8/sql/select_sql.sql: -------------------------------------------------------------------------------- 1 | -- GROUPS SELECTION 2 | SELECT * FROM teachers; 3 | 4 | SELECT DISTINCT city FROM teachers; 5 | 6 | SELECT * FROM teachers ORDER BY city ASC LIMIT 10 OFFSET 700; 7 | 8 | SELECT * FROM teachers LIMIT 10 OFFSET 30; 9 | 10 | 11 | -- Aggregation 12 | -- COUNT, MIN, MAX, AVG, SUM, HAVING, GROUP BY 13 | 14 | SELECT COUNT(*) FROM teachers; 15 | 16 | SELECT AVG(experience), AVG(age) FROM teachers; 17 | 18 | SELECT MIN(age), MAX(age) FROM teachers; 19 | 20 | SELECT SUM(salary) FROM teachers; 21 | 22 | SELECT COUNT(*) AS total_employees, AVG(experience) AS avg_exp, AVG(age) AS avg_age, MIN(age), MAX(age), SUM(salary), age, city FROM teachers GROUP BY age, city HAVING age > 30; 23 | -------------------------------------------------------------------------------- /BATCH_9/Basic/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /BATCH_9/Basic/file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_9/Basic/file.txt -------------------------------------------------------------------------------- /BATCH_9/Basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tts_5pm", 3 | "version": "1.0.0", 4 | "main": "path.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "nodemon": "^3.1.7" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BATCH_9/Basic/path.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | // import path from "path"; 3 | 4 | 5 | // const abs = path.resolve("./file.txt"); 6 | 7 | // console.log(path.basename(abs, ".txt")) 8 | // console.log(path.dirname(abs)) 9 | // console.log(path.extname(abs)) 10 | // console.log(path.join(__dirname, "public", "file.txt")) -------------------------------------------------------------------------------- /BATCH_9/Basic/server.js: -------------------------------------------------------------------------------- 1 | const http = require("http"); 2 | 3 | const product = { 4 | name: "Vijayd asd asd s", 5 | price: 70 6 | } 7 | 8 | const server = http.createServer((req, res) => { 9 | // if (req.url === "/home") { 10 | // res.end("home"); 11 | // } else { 12 | // res.statusCode = 404; 13 | // res.end("404 Not found!"); 14 | // } 15 | // res.setHeader("content-type", "application/json") 16 | // res.end(JSON.stringify(product)); 17 | console.log(req.method) 18 | res.end("home"); 19 | // console.log(req) 20 | 21 | }) 22 | 23 | 24 | server.listen(3001, () => { 25 | console.log("Server is running on port 3001"); 26 | }) -------------------------------------------------------------------------------- /BATCH_9/Mongoose/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dist 3 | .vscode -------------------------------------------------------------------------------- /BATCH_9/Mongoose/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const mongoose = require('mongoose'); 3 | const userRoutes = require('./routes/userRoutes'); 4 | 5 | const app = express(); 6 | app.use(express.json()); 7 | 8 | try { 9 | mongoose.connect('mongodb+srv://manish_22:14ankBFPmrxtXoED@cluster0.cwy7m.mongodb.net/users') 10 | console.log('Connected to MongoDB'); 11 | } catch (error) { 12 | console.error('MongoDB connection error:', error) 13 | } 14 | 15 | app.use('/api/users', userRoutes); 16 | 17 | const PORT = process.env.PORT || 3000; 18 | app.listen(PORT, () => { 19 | console.log(`Server running on port ${PORT}`); 20 | }); 21 | -------------------------------------------------------------------------------- /BATCH_9/Mongoose/models/userModel.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | // Define User Schema 4 | const userSchema = new mongoose.Schema({ 5 | name: { type: String, required: true }, 6 | email: { type: String, required: true, unique: true }, 7 | password: { type: String, required: true } 8 | }); 9 | 10 | userSchema.query.byAge = function (value) { 11 | return this.where({ age: value }) 12 | } 13 | 14 | // Export the User model 15 | const User = mongoose.model('User', userSchema); 16 | module.exports = User; 17 | -------------------------------------------------------------------------------- /BATCH_9/Mongoose/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongoose", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "dotenv": "^16.4.5", 14 | "express": "^4.21.1", 15 | "mongoose": "^8.7.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BATCH_9/README.md: -------------------------------------------------------------------------------- 1 | Students: Rohit, Manish 2 | Course: Backend 3 | Start: 2024 -------------------------------------------------------------------------------- /BATCH_9/express/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /BATCH_9/express/build/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "main.css": "/static/css/main.65af164c.css", 4 | "main.js": "/static/js/main.e8c10626.js", 5 | "index.html": "/index.html", 6 | "main.65af164c.css.map": "/static/css/main.65af164c.css.map", 7 | "main.e8c10626.js.map": "/static/js/main.e8c10626.js.map" 8 | }, 9 | "entrypoints": [ 10 | "static/css/main.65af164c.css", 11 | "static/js/main.e8c10626.js" 12 | ] 13 | } -------------------------------------------------------------------------------- /BATCH_9/express/build/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_9/express/build/favicon.ico -------------------------------------------------------------------------------- /BATCH_9/express/build/index.html: -------------------------------------------------------------------------------- 1 | React App
-------------------------------------------------------------------------------- /BATCH_9/express/build/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_9/express/build/logo192.png -------------------------------------------------------------------------------- /BATCH_9/express/build/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/BATCH_9/express/build/logo512.png -------------------------------------------------------------------------------- /BATCH_9/express/build/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /BATCH_9/express/build/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /BATCH_9/express/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "start": "nodemon index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "description": "", 13 | "dependencies": { 14 | "dotenv": "^16.4.5", 15 | "express": "^4.21.0", 16 | "jsonwebtoken": "^9.0.2", 17 | "morgan": "^1.10.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/db.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/db.cpython-311.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/db.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/db.cpython-313.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/main.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/main.cpython-311.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/main.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/main.cpython-313.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/model.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/model.cpython-311.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/model.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/model.cpython-313.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/schemas.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/schemas.cpython-311.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/schemas.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/schemas.cpython-313.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/service.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/service.cpython-311.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/__pycache__/service.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/FastApi/todo_2/__pycache__/service.cpython-313.pyc -------------------------------------------------------------------------------- /FastApi/todo_2/db.py: -------------------------------------------------------------------------------- 1 | from typing import AsyncGenerator 2 | from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker, AsyncSession 3 | from sqlalchemy.orm import DeclarativeBase 4 | 5 | DATABASE_URL = "postgresql+asyncpg://admin:admin123@localhost:5432/todo_app" 6 | 7 | class Base(DeclarativeBase): 8 | pass 9 | 10 | engine = create_async_engine(DATABASE_URL, echo=True) 11 | 12 | AsyncSessionLocal = async_sessionmaker(bind=engine, class_=AsyncSession, expire_on_commit=False) 13 | 14 | async def get_db() -> AsyncGenerator[AsyncSession, None]: 15 | async with AsyncSessionLocal() as session: 16 | yield session 17 | -------------------------------------------------------------------------------- /FastApi/todo_2/environment.yml: -------------------------------------------------------------------------------- 1 | name: fastapi_sqlalchemy 2 | channels: 3 | - pkgs/main 4 | dependencies: 5 | - fastapi=0.112.9 6 | - python=3.11 7 | - sqlalchemy=2.0.39 8 | - uvicorn=0.32.1 9 | - pydantic=2.10.3 10 | - pydantic-core=2.27.1 11 | - asyncpg=0.29.0 12 | 13 | prefix: "C:\\Users\\be1ne\\miniconda3\\envs\\fastapi_sqlalchemy" 14 | -------------------------------------------------------------------------------- /FastApi/todo_2/model.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import Integer, String, Boolean 2 | from sqlalchemy.orm import Mapped, mapped_column 3 | from db import Base 4 | 5 | class ToDo(Base): 6 | __tablename__ = "todos" 7 | 8 | id: Mapped[int] = mapped_column(Integer, primary_key=True) 9 | title: Mapped[str] = mapped_column(String(100)) 10 | completed: Mapped[bool] = mapped_column(Boolean, default=False) -------------------------------------------------------------------------------- /FastApi/todo_2/schemas.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | from typing import Optional 3 | 4 | class ToDoBase(BaseModel): 5 | title: str 6 | completed: bool = False 7 | 8 | class ToDoCreate(ToDoBase): 9 | pass 10 | 11 | class ToDoUpdate(BaseModel): 12 | title: Optional[str] = None 13 | completed: Optional[bool] = None 14 | 15 | class ToDoInDB(ToDoBase): 16 | id: int 17 | 18 | class Config: 19 | orm_mode = True 20 | -------------------------------------------------------------------------------- /Training/mongodb/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /Training/mongodb/index.js: -------------------------------------------------------------------------------- 1 | const { MongoClient } = require("mongodb"); 2 | 3 | const MONGO_URI = "mongodb://localhost:27017/"; 4 | const DB_NAME = "test3" 5 | 6 | const client = new MongoClient(MONGO_URI) 7 | 8 | let db = client.db(DB_NAME); 9 | 10 | 11 | // ==================== find query 12 | // const data = db.collection("user").find({}); 13 | // data.toArray().then(e => { 14 | // console.log({ data: e }) 15 | // }).finally(() => { 16 | // client.close(); 17 | // }) 18 | // 19 | // 20 | // ==================== find single document 21 | // 22 | const data = db.collection("user").findOne({ 23 | name: "Vijay" 24 | }); 25 | data.then(e => { 26 | console.log(e) 27 | }).finally(() => { 28 | client.close(); 29 | }) 30 | // 31 | // insertOne 32 | // const data = db.collection("user").find({}); 33 | // data.toArray().then(e => { 34 | // console.log({ data: e }) 35 | // }).finally(() => { 36 | // client.close(); 37 | // }) 38 | -------------------------------------------------------------------------------- /Training/mongodb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongodb", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "mongodb": "^6.15.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Training/node/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /Training/node/callbacks.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs").promises; 2 | 3 | (async function () { 4 | const data = await fs.readFile("events.js", "utf8"); 5 | console.log(data); 6 | })() 7 | 8 | -------------------------------------------------------------------------------- /Training/node/child_process.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/Training/node/child_process.js -------------------------------------------------------------------------------- /Training/node/events.js: -------------------------------------------------------------------------------- 1 | const Emitter = require("events"); 2 | const emitter = new Emitter(); 3 | 4 | emitter.on("WELCOME", (name) => { 5 | console.log("WELCOME EVENT : ", name); 6 | }) 7 | 8 | emitter.on("WELCOME", (name) => { 9 | console.log("WELCOME EVENT 2 : ", name); 10 | }) 11 | 12 | setTimeout(() => { 13 | emitter.emit("WELCOME", "SOME"); 14 | }, [2000]) -------------------------------------------------------------------------------- /Training/node/fs.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | // ##### File Operations 4 | // 5 | // fs.readFile() 6 | // fs.readFileSync() 7 | // fs.writeFileSync() 8 | // fs.writeFile() 9 | // fs.appendFile() 10 | // fs.appendFileSync() 11 | // 12 | 13 | // #### Directory Operations 14 | // 15 | // fs.mkdir() 16 | // fs.mkdirSync() 17 | // fs.readdirSync() 18 | // fs.readdir() 19 | // fs.rm() 20 | // fs.rmSync() 21 | // fs.stat() 22 | // fs.statSync() 23 | // -------------------------------------------------------------------------------- /Training/node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "express": "^5.1.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Training/node/utils.js: -------------------------------------------------------------------------------- 1 | const util = require("util"); 2 | // 3 | // util.promisify() // convert callback to promise. 4 | // 5 | // util.callbackify() // convert promise to callback. 6 | // 7 | const obj = { a: 1, b: { c: 2, d: [3, 4] } }; 8 | // 9 | // console.log(util.inspect(obj, { showHidden: false, depth: 1, colors: true })); 10 | // 11 | // console.log(util.inspect({ a: { b: { c: { d: { e: { f: { g: ["A", "B"] } } } } } } }, { 12 | // depth: null, 13 | // colors: true, 14 | // compact: true 15 | // })) 16 | // console.log(util.inspect({ a: { b: { c: { d: { e: { f: { g: ["A", "B"] } } } } } } }, { 17 | // depth: null, 18 | // colors: true, 19 | // compact: 1 20 | // })) 21 | 22 | console.log("HI %d Vijay", 5.2) -------------------------------------------------------------------------------- /advanced/how_js_runs.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Be1newinner/programming_classes/b3472f8346bc273b0a787ec348d61e8dbd4d528a/advanced/how_js_runs.md -------------------------------------------------------------------------------- /sample_questions/timeout_in_loop.js: -------------------------------------------------------------------------------- 1 | /* 2 | for ( let i =0; i< 10; i++ ) { 3 | 4 | setTimeout(()=>console.log(i), 1000); 5 | 6 | } 7 | */ 8 | 9 | function delay(){ 10 | return new Promise((resolve)=>setTimeout(resolve,1000)) 11 | } 12 | 13 | (async function(){ 14 | for(let i = 0; i<10; i++) { 15 | console.log(i) 16 | await delay(); 17 | } 18 | })() 19 | -------------------------------------------------------------------------------- /test_sets/js/set1/q1.js: -------------------------------------------------------------------------------- 1 | function findSubarraysWithSum(arr, target) { 2 | const result = []; 3 | 4 | for (let i = 0; i < arr.length; i++) { 5 | let sum = 0; 6 | const subarray = []; 7 | 8 | for (let j = i; j < arr.length; j++) { 9 | sum += arr[j]; 10 | subarray.push(arr[j]); 11 | 12 | if (sum === target) { 13 | result.push([...subarray]); 14 | } 15 | 16 | if (sum > target) break; 17 | } 18 | } 19 | 20 | return result; 21 | } 22 | 23 | const arr = [1, 2, 3, 4, 5]; 24 | const target = 5; 25 | 26 | console.log(findSubarraysWithSum(arr, target)); 27 | -------------------------------------------------------------------------------- /test_sets/js/set1/q2.js: -------------------------------------------------------------------------------- 1 | function countCharFrequency(str) { 2 | const freq = {}; 3 | 4 | for (const char of str) { 5 | if (freq[char]) { 6 | freq[char]++; 7 | } else { 8 | freq[char] = 1; 9 | } 10 | } 11 | 12 | return freq; 13 | } 14 | 15 | const input = "banana"; 16 | console.log(countCharFrequency(input)); 17 | // Output: { b: 1, a: 3, n: 2 } 18 | -------------------------------------------------------------------------------- /test_sets/js/set1/q3.js: -------------------------------------------------------------------------------- 1 | function groupByAge(people) { 2 | const grouped = {}; 3 | 4 | for (const person of people) { 5 | const { age, name } = person; 6 | 7 | if (!grouped[age]) { 8 | grouped[age] = []; 9 | } 10 | 11 | grouped[age].push({ name }); 12 | } 13 | 14 | return grouped; 15 | } 16 | 17 | const people = [ 18 | { name: "Vijay", age: 25 }, 19 | { name: "Amit", age: 30 }, 20 | { name: "Ravi", age: 25 } 21 | ]; 22 | 23 | console.log(groupByAge(people)); 24 | // { 25 | // 25: [ 26 | // { name: "Vijay", age: 25 }, 27 | // { name: "Ravi", age: 25 } 28 | // ], 29 | // 30: [{ name: "Amit", age: 30 }] 30 | // } -------------------------------------------------------------------------------- /test_sets/js/set1/q4.js: -------------------------------------------------------------------------------- 1 | // type 1 2 | 3 | function isPrime(num) { 4 | if (num <= 1) return false; 5 | if (num === 2) return true; 6 | 7 | for (let i = 3; i <= num / 2; i += 2) { 8 | if (num % i === 0) return false; 9 | } 10 | 11 | return true; 12 | } 13 | 14 | // type 2 15 | function isPrime2(num) { 16 | if (num <= 1) return false; 17 | if (num === 2) return true; 18 | if (num % 2 === 0) return false; 19 | 20 | const sqrt = Math.sqrt(num); 21 | for (let i = 3; i <= sqrt; i += 2) { 22 | if (num % i === 0) return false; 23 | } 24 | 25 | return true; 26 | } 27 | 28 | console.log(isPrime(2)); // true 29 | console.log(isPrime(7)); // true 30 | console.log(isPrime(4)); // false -------------------------------------------------------------------------------- /test_sets/js/set1/q5.js: -------------------------------------------------------------------------------- 1 | function isArmstrong(num) { 2 | const digits = num.toString().split(''); 3 | const power = digits.length; 4 | 5 | const sum = digits.reduce((acc, digit) => { 6 | return acc + Math.pow(Number(digit), power); 7 | }, 0); 8 | 9 | return sum === num; 10 | } 11 | 12 | console.log(isArmstrong(153)); // true 13 | console.log(isArmstrong(9474)); // true 14 | console.log(isArmstrong(123)); // false 15 | --------------------------------------------------------------------------------