Skip to content

Instantly share code, notes, and snippets.

import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useCourseContext } from '../../context/contextFiles/CourseContext';
import { createCourseAction } from '../../context/Actions/courseActions';
import {
Box, Typography, Button, TextField, Select, MenuItem,
FormControl, IconButton, Paper, CircularProgress, Avatar, Input,
FormHelperText, Container, Switch
} from '@mui/material';
import { Upload as UploadIcon, Close as CloseIcon } from '@mui/icons-material';
const passwordResetTemplate = (name, resetLink) => `
<html>
<body style="font-family: Arial, sans-serif; color: #333;">
<h2>Password Reset Request</h2>
<p>Hello <strong>${name}</strong>,</p>
<p>You recently requested to reset your password. Click the button below to proceed:</p>
<a href="${resetLink}" style="display: inline-block; background-color: #0078D4; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;">
Reset Password
</a>
<p>If you did not request this, please ignore this email.</p>
const generateCertificate = expressAsyncHandler(async (req, res) => {
const { name, courseTitle, empId, courseId, certificateType } = req.body;
const userId = req.user._id;
if (!mongoose.Types.ObjectId.isValid(courseId)) {
return res.status(400).json({ success: false, message: "Invalid course ID." });
}
if (!mongoose.Types.ObjectId.isValid(userId)) {
return res.status(400).json({ success: false, message: "Invalid user ID." });
<!DOCTYPE html>
<html>
<head>
<style>
body,
html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
export const testData = {
_id: "686cbf48c811dbae8cf9a387",
title: "Introduction to POSH",
description: "Assessment on Introduction to POSH",
questions: [
{
_id: "q1",
questionText: "Which of the following is not considered sexual harassment?",
type: "mcq",
options: [
import {
Box,
Typography,
Button,
Paper,
Divider,
Avatar,
IconButton,
LinearProgress,
Grid,
{
"status": "success",
"message": "Projects fetched successfully",
"data": {
"projects": [
{
"project_id": "b6bee9f9-8f68-40a0-9d15-58647c290135",
"project_name": "C2DeVal",
"project_description": "Description of the project",
"project_owner": "fe0cd2b1-4af1-4fdf-96b4-d314d8092ec1",

Logs:

*** Log file does not exist: /opt/airflow/logs/dag_id=news_etl_pipeline/run_id=manual__2025-04-16T10:50:58+00:00/task_id=fetch_news/attempt=1.log
*** Fetching from: http://:8793/log/dag_id=news_etl_pipeline/run_id=manual__2025-04-16T10:50:58+00:00/task_id=fetch_news/attempt=1.log
*** Failed to fetch log file from worker. Request URL is missing an 'http://' or 'https://' protocol.

Python DAG Code:

Ways to Trigger an API Request (Along with Syntax)

Axios (JavaScript)

Axios is a popular JavaScript library used to make HTTP requests.

GET request with Axios:

axios.get('https://api.example.com/users')
  .then(response => console.log(response.data))
 .catch(error =&gt; console.log(error));
import React, { useState } from 'react';
import Header from '../components/Header';
import { Link, useNavigate } from 'react-router-dom'
import { IoArrowBack } from "react-icons/io5";
import { toast } from 'react-toastify';
const preBookedSlots = {
"2025-03-26-07:00 AM - 08:00 AM-C1": true,
"2025-03-26-07:00 AM - 08:00 AM-C2": true,
"2025-03-26-08:00 AM - 09:00 AM-C3": true,