Snippets Collections
vector<int> bellman_ford(int V, vector<vector<int>>& edges, int S) {
       vector<int> dis(V,1e8);
       dis[S] = 0;
       for(int cnt = 0; cnt<=V-1; cnt++){
           for(auto edge : edges){
               int u = edge[0];
               int v = edge[1];
               int w = edge[2];
               if(dis[u] != 1e8 and dis[u] + w < dis[v]){
                   dis[v] = dis[u] + w;
               }
           }
       }
       
       // Check for negative weight cycles
       for(auto edge : edges) {
           int u = edge[0];
           int v = edge[1];
           int w = edge[2];
           if(dis[u] != 1e8 && dis[u] + w < dis[v]) {
               // If we can still relax an edge, there is a negative weight cycle
               return {-1}; // Return an empty vector to indicate the presence of a negative cycle
           }
       }
       
       return dis;
    }
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Responsive Swiper Slider with Background Image</title>
  <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
  <style>
    body, html {
      margin: 0;
      padding: 0;
      overflow-x: hidden;
    }

    .Banner {
      overflow: hidden;
      position: relative;
    }

    .swiper-container {
      width: 100%;
      height: 100vh;
    }

    .swiper-slide {
      display: flex;
      justify-content: center;
      align-items: center;
      background-size: cover;
      background-position: center;
      height: 100%;
    }

    /* Define different background images for each slide */
    .swiper-slide:nth-child(1) {
      background-image: url('img/soccer-player-action-stadium.png');
    }

    .swiper-slide:nth-child(2) {
      background-image: url('img/soccer-player-action-stadium.png');
    }

    .swiper-slide:nth-child(3) {
      background-image: url('img/soccer-player-action-stadium.png');
    }

    .slider {
      width: 100%;
      text-align: center;
      color: white; /* Adjust text color for visibility */
    }

    .slide-main {
      max-width: 800px;
      margin: auto;
      padding: 20px;
    }

    .slide-main p {
      font-size: 1rem;
      margin-bottom: 10px;
    }

    .slide-main h2 {
      font-size: 1.5rem;
      margin-bottom: 20px;
    }

    .slide-main a {
    display: inline-block;
    padding: 10px 20px;
    background-color: #08351e;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1rem;
}

    @media (min-width: 768px) {
      .slide-main p {
        font-size: 1.25rem;
      }
      .slide-main h2 {
        font-size: 2rem;
      }
      .slide-main a {
        font-size: 1.25rem;
      }
      .swiper-container {
    width: 100%;
    height: 50vh;
}
    }
    @media (min-width: 500px ) {
      .swiper-container {
    width: 100%;
    height: 40vh !important;
}
    }
    @media (min-width: 400px ) {
      .swiper-container {
    width: 100%;
    height: 35vh !important;
}
    }
    @media (min-width: 320px ) {
      .swiper-container {
    width: 100%;
    height: 30vh !important;
}
    }
  </style>
</head>
<body>
  <section class="Banner">
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide">
          <div class="slider">
            <div class="slide-main">
              <p>Free <strong>3D Render</strong> Models</p>
              <h2>Exclusive Promotional Gift Solutions Await You!</h2>
              <a href="#">Corporate Gifts</a>
            </div>
          </div>
        </div>
        <div class="swiper-slide">
          <div class="slider">
            <div class="slide-main">
              <p>From <strong>the best</strong> designers</p>
              <h2>Peruse Giveaway Categories</h2>
              <a href="#">Corporate Gifts</a>
            </div>
          </div>
        </div>
        <div class="swiper-slide">
          <div class="slider">
            <div class="slide-main">
              <p>Quality <strong>You Can</strong> Trust!</p>
              <h2>Elevate Gifting with Our Exclusive Selection</h2>
              <a href="#">All Shop</a>
            </div>
          </div>
        </div>
      </div>
      <!-- Add Navigation -->
      <div class="swiper-button-next"></div>
      <div class="swiper-button-prev"></div>
    </div>
  </section>

  <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
  <script>
    var swiper = new Swiper('.swiper-container', {
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
      pagination: {
        el: '.swiper-pagination',
        clickable: true,
      },
      slidesPerView: 1,
      spaceBetween: 30,
      breakpoints: {
        640: {
          slidesPerView: 1,
          spaceBetween: 20,
        },
        768: {
          slidesPerView: 1,
          spaceBetween: 30,
        },
        1024: {
          slidesPerView: 1,
          spaceBetween: 40,
        },
      },
    });
  </script>
</body>
</html>
Cascading Style Sheets

CSS - 
SASS - Syntactically Awesome Style Sheet
LESS - Leaner CSS
...

How to add CSS
////////////////////
INLINE CSS
<html style="background: blue">
  </html>

////////////////////
INTERNAL CSS
<html>
  <head>
   <style>
    	html {
    	  background: red;
  		  }
		h1 {
          background: green;
        }
	</style>
  </head>
</html>
 
////////////////////
EXTERNAL CSS
<html>
  <head>
   <link
		rel="stylesheet"
		href="./styles.css"
    />
  </head>
</html>


CSS Selectors
////////////////////
ELEMENT SELECTOR
h1 {
  color: blue
}
You can add the same group of styles to many elements by creating a list of selectors. Each selector is separated with commas like this:
selector1, selector2 {
  property: value;
}
 
////////////////////
CLASS SELECTOR. used for many elements
.red-heading {
  color: red
}
<h1 class="red-heading"></h1>
 
////////////////////
ID SELECTOR. used for one specific element
#main {
color: red
}
<h1 id="main"></h1>
 
////////////////////
ATTRIBUTE SELECTOR. used for all elements with specific attributes
p[draggable="true"]{
  color: red
}
<p id="" class="" draggable="true"></p> //applied
<p id="" class="" draggable="false"></p> //not applied
 
////////////////////
UNIVERSAL SELECTOR. used to select everything where stylesheet is active
* {
  color: red
}

COLOR PROPERTIES

Named Colors: background-color: blue

Hex Codes: background-color: #5D3891


FONT SIZE
//static sizes
1px = 1/96th of an inch //PIXEL
1pt = 1/72nd of an inch //POINT
 
//relative sizes (scalable)
1em = 100% of parent
1rem = 100% of root

FONT WEIGHT
//Keywords
normal; //-100
bold; //+100

//Relative to Parent
lighter;
bolder;

//Number
light-bold
100-900;


FONT FAMILY
h1{
  font-family: "FONTNAME", "BACKUP GENERIC FONT TYPE" //Helvetica, sans-serif
}
fonts needs quotation marks with multiple words
include link in html file under style element

TEXT ALIGN
sets the horizontal alignment of the element


THE BOX MODEL

border: 10px solid black //border: "thickness" "style" "color"
	border-top: 0px //has to come after border property
border property adds outwards of the html element

border-width: 0px 10px 20px 30px //border-width: "top" "right" "bottom" "left"
border-width: 0px 20px //border-width: "top+bottom" "left+right"

padding: 20px //doesn't affect height or width of element, adds to it. around paragraph, inside border

margin: 10px //adds space around element, outside of border


CONTENT DIVISION ELEMENT

<div>		//take as many elements as needed
  <p><p/>
  <img/>
</div> 

horizontally center div with img

div{
width: 50%;
margin-left: 25%;
}
img{
  width: 100%;
}


CASCADE

resolving conflicting styling rules for elements

css rules apply by:

Position
order in stylesheet
li {
  color: red; 
  color: blue; //overwrites red value
}
li{
  color: green; //overwrites blue value
}

Specificity
how specific a selector is
<li id="first-id" class="first-class" draggable></li>

li{color: blue;} //selects all list item elements(least specific)
.first-class{color: red;} //class selector with classname, second specific
li[draggable] {color: purple;} //attribute selector, third specific
#first-id {color: orange;} //id selector, most specific

Type
<link rel="stylesheet" href="./style.css">	//external, least important
<style> <style/>							//internal, second important
<h1 style="">Hello</h1>						//inline, most important

Importance
color: red;
color: green !important; //gets most important rule for element

Color

The CSS linear-gradient function lets you control the direction of the transition along a line, and which colors are used.
linear-gradient(gradientDirection, color1, color2, ...);
gradientDirection is the direction of the line used for the transition. color1 and color2 are color arguments, which are the colors that will be used in the transition itself. These can be any type of color, including color keywords, hex, rgb, or hsl.
background: linear-gradient(90deg, rgb(255, 0, 0), rgb(0, 255, 0), rgb(0, 0, 255));

With the CSS opacity property, you can control how opaque or transparent an element is. With the value 0, or 0%, the element will be completely transparent, and at 1.0, or 100%, the element will be completely opaque like it is by default.

The rgba function works just like the rgb function, but takes one more number from 0 to 1.0 for the alpha channel:
rgba(redValue, greenValue, blueValue, alphaValue);

The box-shadow property lets you apply one or more shadows around an element.
box-shadow: offsetX offsetY color;

both offsetX and offsetY accept number values in px and other CSS units
a positive offsetX value moves the shadow right and a negative value moves it left
a positive offsetY value moves the shadow down and a negative value moves it up
if you want a value of zero (0) for any or both offsetX and offsetY, you don't need to add a unit. Every browser understands that zero means no change.

If a blurRadius value isn't included, it defaults to 0 and produces sharp edges. The higher the value of blurRadius, the greater the blurring effect is.
box-shadow: offsetX offsetY blurRadius color;

The vh unit stands for viewport height, and is equal to 1% of the height of the viewport. This makes it relative to the viewport height.

Now, get rid of the horizontal scroll-bar, by setting the body default margin added by some browsers to 0.






















add_action( 'sp_tabs_name_slug', '__return_true' );
import { NextPage } from "next";
import {
  BackHomeButton,
  CommandPalletteButton,
  MinimalPage,
  PageHeading,
} from "ui";
import { VesselInfoForm } from "@/components/forms/vesselInfoForm";
import { BugReportButton, CommandInterface, Navigation } from "@/components";
import { useRouter } from "next/router";

const RegularVessel: NextPage = () => {
  const router = useRouter();

  const handleModeChange = (mode: "add" | "edit") => {
    if (mode === "edit") {
      const imo = router.query.imo;
      router.push(`/secure/manager/manageVessel/editRegularVessel?imo=${imo}`);
    }
  };

  return (
    <MinimalPage
      pageTitle={"Add Vessel | Vessel Interface"}
      pageDescription={"Vessel Interface | Vessel Info"}
      commandPrompt
    >
      <div className="flex w-full flex-row justify-between pl-1 pt-1">
        <BackHomeButton />
        <Navigation />
        <div className="flex flex-row gap-4">
          <BugReportButton />
          <CommandPalletteButton />
          <CommandInterface />
        </div>
      </div>
      <PageHeading text="Vessel Info" />
      <VesselInfoForm mode="add" onModeChange={handleModeChange} />
    </MinimalPage>
  );
};

export default RegularVessel;
import {
  ButtonContent,
  DestructiveButton,
  Form,
  FormControl,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
  Icon,
  Input,
  Toaster,
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import * as z from "zod";
import React, { useEffect, useState } from "react";
import { toast } from "sonner";
import wretch from "wretch";
import { useRouter } from "next/router";
import { useGetVesselFromIMO } from "@/hooks";

const formSchema = z.object({
  imo: z.string().max(7),
  cargo_type: z.string().optional(),
  cargo_sub_type: z.string().optional(),
  mmsi: z.string().max(9).optional(),
  vessel_name: z.string().optional(),
  year_of_build: z.string().optional(),
  flag: z.string().optional(),
  grt: z.string().optional(),
  dwt: z.string().optional(),
  overall_length: z.string().optional(),
  beam: z.string().optional(),
  maximum_draft: z.string().optional(),
});

type FormFields = z.infer<typeof formSchema>;

const fieldsNameHelper: Record<
  keyof FormFields,
  { name: string; description: string }
> = {
  imo: {
    name: "IMO",
    description: "International Maritime Organization identifier",
  },
  cargo_type: {
    name: "Cargo Type",
    description: "The type of cargo the vessel carries",
  },
  cargo_sub_type: {
    name: "Cargo Sub Type",
    description: "The subtype of cargo the vessel carries",
  },
  mmsi: { name: "MMSI", description: "Maritime Mobile Service Identity" },
  vessel_name: { name: "Vessel Name", description: "The name of the vessel" },
  year_of_build: {
    name: "Year of Build",
    description: "The year the vessel was built",
  },
  flag: { name: "Flag", description: "The flag country code" },
  grt: { name: "GRT", description: "Gross Registered Tonnage" },
  dwt: { name: "DWT", description: "Dead Weight Tonnage" },
  overall_length: {
    name: "Overall Length",
    description: "The overall length of the vessel",
  },
  beam: { name: "Beam", description: "The beam of the vessel" },
  maximum_draft: {
    name: "Maximum Draft",
    description:
      "The deepest point of the vessel below the waterline when fully loaded",
  },
};

interface VesselInfoFormProps {
  mode: "add" | "edit";
  initialValues?: FormFields;
  onModeChange?: (mode: "add" | "edit") => void;
}

export function VesselInfoForm({
  mode,
  initialValues,
  onModeChange,
}: VesselInfoFormProps) {
  const [imoChecked, setImoChecked] = useState(false);
  const [isEditMode, setIsEditMode] = useState(mode === "edit");
  const [updateError, setUpdateError] = useState(null);
  const form = useForm({
    resolver: zodResolver(formSchema),
    defaultValues: initialValues || {},
  });

  const router = useRouter();
  const imoValue = form.watch("imo");
  const {
    data: vesselData,
    isError,
    isLoading,
  } = useGetVesselFromIMO(imoValue);

  useEffect(() => {
    if (mode === "edit" && initialValues) {
      form.reset(initialValues);
    }
  }, [initialValues, mode, form]);

  useEffect(() => {
    if (vesselData && vesselData.length > 0 && mode === "add") {
      setIsEditMode(true);
      if (onModeChange) onModeChange("edit");
    } else {
      setIsEditMode(false);
      if (onModeChange) onModeChange("add");
    }
  }, [vesselData, mode, onModeChange]);

  async function onCheckIMO() {
    if (vesselData && vesselData.length > 0) {
      router.push(
        `/secure/manager/manageVessel/editRegularVessel?imo=${imoValue}`,
      );
    } else {
      setImoChecked(true);
    }
  }

  async function onSubmit(values: FormFields) {
    const updatedVesselInfo = Object.entries(values).reduce(
      (acc: Record<string, string>, [key, value]) => {
        const vesselInfoKey = fieldsNameHelper[key as keyof FormFields].name;
        acc[vesselInfoKey] = (value || "").toString().toLowerCase();
        return acc;
      },
      {},
    );

    setUpdateError(null);
    try {
      const apiUrl = isEditMode
        ? "/api/form/updateVessel"
        : "/api/form/insertVessel";
      const response = await wretch(apiUrl).post(updatedVesselInfo).res();
      if (response.ok) {
        toast.success("Success!", {
          description: isEditMode
            ? "Vessel details updated."
            : "Vessel details added.",
        });
        form.reset();
        setImoChecked(false);
      } else {
        throw new Error("Error submitting form");
      }
    } catch (error) {
      setUpdateError(error);
    }
  }

  return (
    <div className={"mt-4"}>
      <Form {...form}>
        <form className="space-y-4">
          <FormField
            control={form.control}
            name="imo"
            render={({ field }) => (
              <FormItem className={"flex flex-row items-center"}>
                <FormLabel className={"w-64 text-lg font-light"}>
                  {fieldsNameHelper.imo.name}
                </FormLabel>
                <div className={"mr-2"}>
                  <TooltipProvider>
                    <Tooltip>
                      <TooltipTrigger className="text-black hover:text-black/50 dark:text-white dark:hover:text-white/50">
                        <Icon name="unknown" style="h-5 w-5" />
                      </TooltipTrigger>
                      <TooltipContent>
                        <p>{fieldsNameHelper.imo.description}</p>
                      </TooltipContent>
                    </Tooltip>
                  </TooltipProvider>
                </div>
                <FormControl className={"w-full"}>
                  <Input
                    {...field}
                    className={"text-md font-light"}
                    type="text"
                    value={field.value ?? ""}
                  />
                </FormControl>
                <FormMessage />
              </FormItem>
            )}
          />
          {imoChecked &&
            (!vesselData || vesselData.length === 0) &&
            (Object.keys(formSchema.shape) as Array<keyof FormFields>).map(
              (key) =>
                key !== "imo" && (
                  <FormField
                    key={key}
                    control={form.control}
                    name={key}
                    render={({ field }) => (
                      <FormItem className={"flex flex-row items-center"}>
                        <FormLabel className={"w-64 text-lg font-light"}>
                          {fieldsNameHelper[key].name}
                        </FormLabel>
                        <div className={"mr-2"}>
                          <TooltipProvider>
                            <Tooltip>
                              <TooltipTrigger className="text-black hover:text-black/50 dark:text-white dark:hover:text-white/50">
                                <Icon name="unknown" style="h-5 w-5" />
                              </TooltipTrigger>
                              <TooltipContent>
                                <p>{fieldsNameHelper[key].description}</p>
                              </TooltipContent>
                            </Tooltip>
                          </TooltipProvider>
                        </div>
                        <FormControl className={"w-full"}>
                          <Input
                            {...field}
                            className={"text-md font-light"}
                            type="text"
                            value={field.value ?? ""}
                          />
                        </FormControl>
                        <FormMessage />
                      </FormItem>
                    )}
                  />
                ),
            )}
          <div className="flex flex-row justify-end">
            <DestructiveButton
              onClick={imoChecked ? form.handleSubmit(onSubmit) : onCheckIMO}
              className="mt-4"
            >
              <ButtonContent>
                {isEditMode
                  ? "Save Changes"
                  : imoChecked
                    ? "Add Vessel"
                    : "Check IMO"}
              </ButtonContent>
            </DestructiveButton>
          </div>
          <Toaster />
        </form>
      </Form>
    </div>
  );
}
import { NextPage } from "next";
import {
  BackHomeButton,
  CommandPalletteButton,
  MinimalPage,
  PageHeading,
} from "ui";
import { VesselInfoForm } from "@/components/forms/vesselInfoForm";
import { BugReportButton, CommandInterface, Navigation } from "@/components";
import { useRouter } from "next/router";
import { useGetVesselFromIMO } from "@/hooks";

const EditRegularVessel: NextPage = () => {
  const router = useRouter();
  const { imo } = router.query;
  const {
    data: vesselData,
    isError,
    isLoading,
  } = useGetVesselFromIMO(imo as string);

  if (isLoading) {
    return (
      <MinimalPage
        pageTitle={"Edit Vessel | Vessel Interface"}
        pageDescription={"Vessel Interface | Edit Vessel Info"}
        commandPrompt
      >
        <div className="flex w-full flex-row justify-between pl-1 pt-1">
          <BackHomeButton />
          <Navigation />
          <div className="flex flex-row gap-4">
            <BugReportButton />
            <CommandPalletteButton />
            <CommandInterface />
          </div>
        </div>
        <PageHeading text="Edit Vessel Info" />
        <p>Loading...</p>
      </MinimalPage>
    );
  }

  if (isError || !vesselData || vesselData.length === 0) {
    return (
      <MinimalPage
        pageTitle={"Edit Vessel | Vessel Interface"}
        pageDescription={"Vessel Interface | Edit Vessel Info"}
        commandPrompt
      >
        <div className="flex w-full flex-row justify-between pl-1 pt-1">
          <BackHomeButton />
          <Navigation />
          <div className="flex flex-row gap-4">
            <BugReportButton />
            <CommandPalletteButton />
            <CommandInterface />
          </div>
        </div>
        <PageHeading text="Edit Vessel Info" />
        <p>Vessel not found.</p>
      </MinimalPage>
    );
  }

  return (
    <MinimalPage
      pageTitle={"Edit Vessel | Vessel Interface"}
      pageDescription={"Vessel Interface | Edit Vessel Info"}
      commandPrompt
    >
      <div className="flex w-full flex-row justify-between pl-1 pt-1">
        <BackHomeButton />
        <Navigation />
        <div className="flex flex-row gap-4">
          <BugReportButton />
          <CommandPalletteButton />
          <CommandInterface />
        </div>
      </div>
      <PageHeading text="Edit Vessel Info" />
      <VesselInfoForm mode="edit" initialValues={vesselData[0]} />
    </MinimalPage>
  );
};

export default EditRegularVessel;
HTML Elements

<h1> //opening tag
</h1> // closing tag

Heading Element
<h1> to <h6>
not good practice to have more than one h1 or skip levels.

  
Paragraph
<p></p>
adds a linebreak
  

Horizontal Rule Element (self closing)
<hr />
doesn't take content
adds a horizontal line
  
Break Element (self closing)
<br />
doesn't take content
adds a break at the end
don't use break elements to break up paragraphs
  
List Element

Unordered
<ul>		//unordered
  <li></li> // list item
</ul>
will create bullet points. order of items don't matter
  
Ordered
<ol>
  <li></li>
</ol>
adds numbers to every item

Anchor Element
<a href="LINK"></a>
adds a target to some content
  
Image Element
<img src="URL" alt="ALTERNATIVE TEXT DESCRIPTION" />

HTML Boilerplate
<!DOCTYPE html> //tells browser code is written in html
  <html lang="en"> //language of text content, used for screen readers
    <head> //important information that does not get displayed
    <meta charset="UTF-8"> //character encoding
      <title>TITLE</title> //gets displayed in tab bar
      </head>
      
      <body> //content of website goes here
        
      </body>
  </html>

Main Element
The main element is used to represent the main content of the body of an HTML document.
<main>
  <h1>Most important content of the document</h1>
  <p>Some more important content...</p>
</main>

Section Element
The section element is used to define sections in a document, such as chapters, headers, footers, or any other sections of the document. It is a semantic element that helps with SEO and accessibility.
<section>
  <h2>Section Title</h2>
  <p>Section content...</p>
</section>

Figure Element
The figure element represents self-contained content and will allow you to associate an image with a caption.
A figure caption (figcaption) element is used to add a caption to describe the image contained within the figure element.
<figure>
  <img src="image.jpg" alt="A description of the image">
  <figcaption>A cute cat</figcaption>
</figure>

Form Element
The form element is used to get information from a user like their name, email, and other details.
The action attribute indicates where form data should be sent.
<form action="/submit-url"></form>

Input element
The input element allows you several ways to collect data from a web form.
There are many kinds of inputs you can create using the type attribute. You can easily create a password field, reset button, or a control to let users select a file from their computer.
In order for a form's data to be accessed by the location specified in the action attribute, you must give the text field a name attribute and assign it a value to represent the data being submitted.
To prevent a user from submitting your form when required information is missing, you need to add the required attribute to an input element.

Fieldset Element
The fieldset element is used to group related inputs and labels together in a web form.

Legend Element
The legend element acts as a caption for the content in the fieldset element. It gives users context about what they should enter into that part of the form.

Footer Element
The footer element is used to define a footer for a document or section. A footer typically contains information about the author of the document, copyright data, links to terms of use, contact information, and more.

Select Element
Adding a dropdown to the form is easy with the select element. The select element is a container for a group of option elements, and the option element acts as a label for each dropdown option. Both elements require closing tags.









import type { NextApiRequest, NextApiResponse } from "next";
import { rdsConnection } from "@/lib/aws";

export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse,
) {
  if (req.method === "POST") {
    const { imo } = req.body;
    const query = `
      SELECT COUNT(*) as count FROM spotship_vessel WHERE imo = ?
    `;

    rdsConnection.query(query, [imo], (error, results) => {
      if (error) {
        return res.status(500).json({ success: false, error: error.message });
      }
      const exists = results[0].count > 0;
      return res.status(200).json({ success: true, exists });
    });
  } else {
    res.setHeader("Allow", ["POST"]);
    return res
      .status(405)
      .send(`Method ${req.method ?? "Undefined"} Not Allowed`);
  }
}
# Create a virtual environment
python -m venv venv  # Windows
python3 -m venv venv  # MacOS/Linux

# Activate the virtual environment
venv\Scripts\activate  # Windows
source venv/bin/activate  # MacOS/Linux

# Install required packages
pip install kivy

# Create requirements.txt file
pip freeze > requirements.txt

# Run a test script
python test.py

--------------------------
in case of an POLICY error -- 
PS D:\Coding Stuff, Editing\Visual Studio Python Codings\MyProjects\BurgerBillingSystem> .\burger-billing-system-env\Scripts\activate     
.\burger-billing-system-env\Scripts\activate : File D:\Coding Stuff, Editing\Visual Studio Python 
Codings\MyProjects\BurgerBillingSystem\burger-billing-system-env\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system.     
For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\burger-billing-system-env\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

The error message you are encountering indicates that running scripts is disabled on your systems PowerShell execution policy. This is a security measure to prevent malicious scripts from running.

Here is how to fix this and activate your virtual environment:

Change the Execution Policy (For Administrators Only):

Open PowerShell as Administrator. "Right-click on the PowerShell" icon and select "Run as administrator".

Type the following command and press Enter:
"PowerShell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"

Activate the Virtual Environment (After Policy Change):
Navigate to your project directory using the cd command in PowerShell.
Run the activation command again:

---------------------------------
For Anaconda Jupyter Notebook -
pip install venv
python -m venv env_test
.\env_test\Scripts\activate
pip install ipykernel
python -m ipykernel install --user --name kernel_ai_cnn_1
import { rdsConnection } from "@/lib/aws";
import { v4 as uuidv4 } from "uuid";

export async function insertVessel(data) {
  const {
    cargo_type,
    cargo_sub_type,
    imo,
    mmsi,
    vessel_name,
    year_of_build,
    flag,
    grt,
    dwt,
    overall_length,
    beam,
  } = data;

  const vessel_id = uuidv4();

  const query = `
    INSERT INTO spotship_vessel (
      vessel_id, cargo_type, cargo_sub_type, ais_enabled, map_enabled, imo, mmsi, vessel_name, year_of_build, flag, grt, dwt, overall_length, beam
    ) VALUES (?, ?, ?, 1, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?)
  `;

  return new Promise((resolve, reject) => {
    rdsConnection.query(
      query,
      [
        vessel_id,
        cargo_type,
        cargo_sub_type,
        imo,
        mmsi,
        vessel_name,
        year_of_build,
        flag,
        grt,
        dwt,
        overall_length,
        beam,
      ],
      (error, results) => {
        if (error) {
          return reject(error);
        }
        resolve(results);
      },
    );
  });
};
import type { NextApiRequest, NextApiResponse } from "next";
import { insertVessel } from "@/lib/db";

export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse,
) {
  if (req.method === "POST") {
    try {
      const result = await insertVessel(req.body);
      return res.status(200).json({ success: true, data: result });
    } catch (error) {
      return res.status(500).json({ success: false, error: error.message });
    }
  } else {
    res.setHeader("Allow", ["POST"]);
    return res
      .status(405)
      .send(`Method ${req.method ?? "Undefined"} Not Allowed`);
  }
}
	$(document).ready(function () {
			$(document).on('mousewheel', function (event) {
				if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) {
					// Mouse wheel up
					$('.nav-main, .header__contact').css({
						opacity: '1',
						visibility: 'visible',
						overflow: 'visible',
					});
				} else {
					// Mouse wheel down
					$('.nav-main, .header__contact').css({
						opacity: '0',
						visibility: 'hidden',
						overflow: 'hidden',
					});
				}
			});
		});
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# download and install Node.js (you may need to restart the terminal)
npm install 20
# verifies the right Node.js version is in the environment
node -v # should print `v20.14.0`
# verifies the right NPM version is in the environment
npm -v # should print `10.7.0`
img {
          margin: 0 auto;
          width: 800px;
          @include respond-to(maxlarge) {
            width: 700px;
          }
            @include respond-to(desktop) {
                width: 600px;
            }
            @include respond-to(tabs) {
                width: 500px;
            }
            @include respond-to(phablet) {
                width: 450px;
            }
          @include respond-to(mobile) {
            width: 420px;
          }
        }


   .slide-video{
            border-radius: 20px;
            width: 800px;
            @include respond-to(maxlarge) {
              width: 700px;
            }
            @include respond-to(desktop) {
              width: 600px;
            }
            @include respond-to(tabs) {
              width: 500px;
            }
            @include respond-to(phablet) {
              width: 450px;
            }
          }
#include <iostream>
using namespace std;

int main() {
    float a, b, c;

    for (int i = 1; i < 30; ++i) {
        cout << "Digite as notas: " << endl;
        cin >> a >> b >> c;
       cout << "Media do aluno e de: "<< (a + b + c)/3 << endl;
    }

    return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main(){
  string meses[12] = {"Janeiro", "Fevereiro", "Marco", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"};
  int numero;
  cin >> numero;
  if (numero >= 1 && numero <= 12){
    cout << meses[numero -1] << endl;
  } else {
    cout << "Numero invalido" << endl;
  }
}
	add_filter('woocommerce_product_add_to_cart_text', 'custom_woocommerce_product_add_to_cart_text');

	function custom_woocommerce_product_add_to_cart_text($text) {
		global $product;
		if ($product->is_type('external')) {
			return __('See Prices', 'woocommerce');
		}
		return $text;
	}
function custom_external_add_to_cart_button($button, $product) {
    if ($product->is_type('external')) {
        // URL of the Amazon icon image
        $icon_url = 'https://mejormovil.es/wp-content/themes/woodmart/images/amazon-icon.png';
        $button_text = 'See Prices';

        // Create the button HTML with the Amazon icon and new text
        $button = sprintf(
            '<a href="%s" class="button product_type_external add-to-cart-loop customize-unpreviewable" data-product_id="%s" aria-label="%s" rel="nofollow">
                <img src="%s" style="width: 20px; height: auto; margin-right: 5px; vertical-align: middle;" alt="Amazon Icon"/> %s
            </a>',
            esc_url($product->add_to_cart_url()), // URL for the product
            esc_attr($product->get_id()), // Product ID
            esc_attr($product->add_to_cart_description()), // ARIA label
            esc_url($icon_url), // Amazon icon URL
            esc_html($button_text) // Button text
        );
    }
    return $button;
}
add_filter('woocommerce_loop_add_to_cart_link', 'custom_external_add_to_cart_button', 10, 2);
impl Point {
    pub fn new(x: u16, y: u16) -> Self {
        Self { x, y }
    }

    pub fn transform(&self, direction: Direction, times: u16) -> Self {
        let times = times as i16;
        let transformation = match direction {
            Direction::Up => (0, -times),
            Direction::Right => (times, 0),
            Direction::Down => (0, times),
            Direction::Left => (-times, 0),
        };

        Self::new(
            Self::transform_value(self.x, transformation.0),
            Self::transform_value(self.y, transformation.1),
        )
    }

    fn transform_value(value: u16, by: i16) -> u16 {
        if by.is_negative() && by.abs() as u16 > value {
            panic!("Transforming value {} by {} would result in a negative number", value, by);
        } else {
            (value as i16 + by) as u16
        }
    }
}
<!DOCTYPE html>
<html>
<body>
​
<h2>Image Maps</h2>
<p>Click on the computer, the phone, or the cup of coffee to go to a new page and read more about the topic:</p>
​
<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400" height="379">
​
<map name="workmap">
  <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
  <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
  <area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>
​
</body>
</html>
​
​
options = map();
optionlist = list();
optionlist.add("workflow");
options.put("trigger",optionlist);
updateRec= zoho.crm.updateRecord(module_name, updatemap, options, connection);
<StyledTableCell>
                                        {connectedEmail.credentialInfoProvider.toUpperCase() === "IMAP" ? (
                                            <Tooltip
                                                arrow
                                                title="IMAP provider support emails incoming and outgoing, not calendar functionalities"
                                                placement="top"
                                                classes={{ tooltip: classes.tooltip }}
                                            >
                                                <StyledChip style={statusChipColor("WARNING")}>
                                                    {connectedEmail.credentialInfoProvider.toUpperCase()}
                                                </StyledChip>
                                            </Tooltip>
                                        ) : (
                                                <StyledChip style={statusChipColor("WARNING")}>
                                                {connectedEmail.credentialInfoProvider.toUpperCase()}
                                            </StyledChip>
                                        )}
                                    </StyledTableCell>
{
  "associationAccountInfoId": 11,
  "associationId": 30,
  "name": "Dr.Reddys foundation",
  "bankName": "Indian Bank",
  "bankAccountNumber": "6245789568",
  "bankRoutingTypeId": 46,
  "bankRoutingCode": "Indian bank 1234",
  "associationAccountTypeId": 170
}





{
  "associationAccountInfoId": 12,
  "associationId": 30,
  "upiId": "Reddysfoundations@IndianBank",
  "associationAccountTypeId": 171
}
class Solution {
public:
  
   
  int f(int ind, vector<int> &nums, vector<int> &dp) {
    if(ind == 0) return nums[ind];
    if(ind < 0) return 0;
    if(dp[ind] != -1) return dp[ind];
    int pick = nums[ind] + f(ind - 2, nums, dp);
    int notPick = 0 + f(ind - 1, nums, dp);
    return dp[ind] = max(pick, notPick);
}
    int rob(vector<int>& nums) {
        int n=nums.size();
        vector<int> dp(nums.size()+2,-1);
         int a = f(n-1,nums,dp);
         return a;
        
    }
};
const calcTip = (bill) => {
  return bill >= 50 && bill <= 300 ? bill * 0.15 : bill * 0.20;
}



const demandIcon = demand === "low" ? iconArrowDown 
: demand === "stable" ? iconArrowRight 
: demand === "high" ? iconArrowUp : "";
Node.js

Is a Javascript Runtime built on google's open source V8 javascript engine.
Executes js code outside of the browser.

Javascript on the Server:
Perfect conditions for using node.js as a web-server
We can use js on the server-side of web development
build fast, highly scalable network applications (back end)

Node.js pros:

perfect for building fast and scalable data-intensive apps.
javascript across the entire stack, front and back end.
npm: huge library of open source packages
very active

use for:
api with database
data streaming (youtube)
real time chat application
server-side web application

Modules

----------Filessystem----------

//reading and writing to files
const fs = require('fs');

//synchronous way of file reading
//takes filepath and char encoding param
fs.readFileSync('./txt/input.txt', 'utf-8');
console.log(textIn);

//synchronous way of file writing
const textOut = `This is what we know about avocado: ${textIn}.`
//takes output filepath and content to write
fs.writeFileSync('./txt/output.txt', textOut)


//asynchronous way of file reading

//Non-blocking file execution
fs.readFile('input.txt', 'utf-8', (err, data) => {
  console.log(data);
});
console.log('Reading file...');

callback get's called first, starts reading file in background and immediately moves on to next statement, printing console.log.


----------Server----------

const http = require('http');

//creating server, callback will be executed each time a new request hits server
const server = http.createServer((req, res) => {
  res.end('Hello from the server!');
});

//listening for incoming requests
server.listen(8000, '127.0.0.1' () => {
  console.log('Listening to request on port 8000');
});


// ROUTING

const url = require('url');

//creating server, callback will be executed each time a new request hits server
const server = http.createServer((req, res) => {
    // ROUTING
    const pathName = req.url;

    if(pathName === '/' || pathName === '/overview') {
        res.end('This is the OVERVIEW');
    } else if (pathName === '/product') {
        res.end('This is the PRODUCT');
    } else {
        //sending a html header element to the browser
        res.writeHead(404, {
            'Content-type': 'text/html',
            'my-own-header': 'hello-world'
        });
        res.end('<h1>Page not found!</h1>');
    }
});


----------NPM----------

Node Package Manager

//USEFUL DEPENDENCIES
slugify //used to control url params
nodemon //restarts server automatically after code changes
//specify npm scripts:
{  "scripts": {
    "start": "nodemon index.js"
  },}

Used to manage third-party packages in projects.

npm init //creates package.json for projects

npm i //installs locally, only works for specific project

npm i --global //installing dependencies globally (across projects)

npm i *packageName* //installing dependencies for project

npm i *packageName* --save-dev //dependencies for development purposes

npm run start //run npm scripts

npm outdated //check for outdated npm packages

npm i *packageName* @1.0.0 //install a specific version of a package

"dependencies": {
    "slugify": "^1.6.6" //only accepts minor and patch releases
  }

"dependencies": {
    "slugify": "~1.6.6" //only accepts patch releases
  }

"dependencies": {
    "slugify": "*1.6.6" //accepts all update realeases, might create conflicts
  }

npm uninstall *packageName* //uninstall packages

npm install //installs all dependencies in package.json file


























#include <stdio.h>
#include <string.h>

struct Product
{
    char name [20];
    char brand [20];
    float price ;
    int quantity;

};

void print_product(struct Product a_product);

int main(void)
{
    struct Product a_product[3];
    
    sprintf(a_product[0].name,"Xbox One S");
    sprintf(a_product[0].brand,"Microsoft");
    a_product[0].price= 395.50;
    a_product[0].quantity = 35;
    
    sprintf(a_product[1].name,"PlayStation 4 Pro");
    sprintf(a_product[1].brand,"Sony");
    a_product[1].price= 538.00;
    a_product[1].quantity = 71;
    
    sprintf(a_product[2].name,"Switch");
    sprintf(a_product[2].brand,"Nintendo");
    a_product[2].price= 529.95;
    a_product[2].quantity = 8;
    
    for(int i = 0; i < 3; i++)
    {
        print_product(a_product[i]);
    }
	return 0;
}

void print_product(struct Product a_product)
{
	printf("Item name: %s\n", a_product.name);
	printf("Brand:     %s\n", a_product.brand);
	printf("Price:     $%.2f\n", a_product.price);
	printf("Quantity:  %d\n\n", a_product.quantity);
}
#include <stdio.h>
#include <math.h>

struct Circle
{
	float radius;
	float x_position;
	float y_position;
	
};

float distance_between(struct Circle c1, struct Circle c2);

int main(void)
{
	struct Circle c1;
	struct Circle c2;

    float r1 = 0;
    float r2 = 0;
    scanf("%f", &r1);
    scanf("%f", &r2);
	c1.radius = r1;
	c2.radius = r2;
	c1.x_position = 11;
	c1.y_position = 22;
	c2.x_position = 4;
	c2.y_position = 6;

	float distance = distance_between(c1, c2);
	printf("distance between two circle is %f.", distance);

	return 0;
}

float distance_between(struct Circle c1, struct Circle c2)
{
    float distance;
    distance = sqrt( pow((c1.x_position - c2.x_position),2) + pow((c1.y_position - c2.y_position),2)) - c1.radius - c2.radius;
    return distance;
}

#include <stdio.h>

struct SoftDrink
{
    char name[17];
    int size;
    int energy;
    float caffeine;
    int intake;

};

void print_soft_drink(struct SoftDrink* drink);

int main(void)
{
    struct SoftDrink drink = { "Life Modulus",250,529,80.50,500};
    
    print_soft_drink(&drink);
    
    return 0;
    
}

void print_soft_drink(struct SoftDrink *drink)
{   
    printf("A soft drink...\n\n");
    printf("Name: %s\n",drink->name);
    printf("Serving size: %d mL\n",drink->size);
    printf("Energy content: %d kJ\n",drink->energy);
    printf("Caffeine content: %f mg\n",drink->caffeine);
    printf("Maximum daily intake: %d mL\n",drink->intake);

}
$file = fopen('myCSVFile.csv', 'r');
while (($line = fgetcsv($file)) !== FALSE) {
  //$line is an array of the csv elements
  print_r($line);
}
fclose($file);
\Drupal::service('file_system')->realpath(file_default_scheme() . '://');
Your output should use the following template:
#### Summary
#### Highlights
- [Emoji] Bulletpoint

Your task is to summarise the text I have given you in up to seven concise bullet points, starting with a short highlight. Choose an appropriate emoji for each bullet point. Use the text above: {{Title}} {{Transcript}}.
// Shortcode For AUCTION [all-categories]
add_shortcode('all-categories', 'cf_woo_all_categories');
function cf_woo_all_categories()
{
   ob_start(); ?>

<h3 class="headd">All Categories </h3>
<div id="owl-demo" class="all-cat categories-boxes">
               
       <?php
$cat_args = array(
   'hide_empty' => true,
);
$product_categories = get_terms( 'product_cat', $cat_args );
foreach ($product_categories as $key => $category) {
$thumbnail_id = get_term_meta( $category->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id ); ?>
            <div class="item" style="background:url( <?php echo $image ?> ) no-repeat center center / cover ">
               <div class="content">
                   <div class="readmore">
                    <a href="<?php echo get_term_link($category) ?>"><?php  echo $category->name; ?></a>
                   </div>
               </div>
            </div>
  <?php
}
   ?>
   
   </div> <!-- owl-demo -->
<!-- structucre past hese -->
<?php
wp_reset_postdata();
   return '' . ob_get_clean();
}
// HIDE PLUGIN FROM ADMIN PANEL;
add_action('admin_head', 'hide_plugins_css');

function hide_plugins_css() {
    // Replace 'plugin-folder-1', 'plugin-folder-2', etc., with the actual folder names of the plugins
    $plugin_folder_names = array('gravityforms', 'advanced-custom-fields-pro');

    echo '<style>';
    foreach ($plugin_folder_names as $plugin_folder_name) {
        echo "tr[data-slug='$plugin_folder_name'] { display: none !important; }";
    }
    echo '</style>';
}
// WP CONFIG ADD TO STOP NOTIFICATIONS;
define('DISALLOW_FILE_EDIT', true);
define('DISALLOW_FILE_MODS', true);
// WP CONFIG ADD TO STOP NOTIFICATIONS;

// Disable all WordPress core updates
add_filter('automatic_updater_disabled', '__return_true');
add_filter('auto_update_core', '__return_false');
add_filter('pre_site_transient_update_core', '__return_null');
add_filter('pre_site_transient_update_plugins', '__return_null');
add_filter('pre_site_transient_update_themes', '__return_null');
 
// Disable plugin updates
remove_action('load-update-core.php', 'wp_update_plugins');
add_filter('pre_site_transient_update_plugins', '__return_null');
 
// Disable plugin update checks
add_action('admin_init', function() {
    remove_action('admin_init', '_maybe_update_plugins');
    remove_action('wp_update_plugins', 'wp_update_plugins');
    remove_action('load-plugins.php', 'wp_update_plugins');
});
 
// Disable theme updates
remove_action('load-update-core.php', 'wp_update_themes');
add_filter('pre_site_transient_update_themes', '__return_null');
 
// Disable theme update checks
add_action('admin_init', function() {
    remove_action('admin_init', '_maybe_update_themes');
    remove_action('wp_update_themes', 'wp_update_themes');
    remove_action('load-themes.php', 'wp_update_themes');
});
 
// Disable all automatic updates
add_filter('automatic_updater_disabled', '__return_true');
 
// Disable update notifications
add_filter('admin_init', function() {
    remove_action('admin_notices', 'update_nag', 3);
});
// TOP BAR REMOVED MENU SECTION OF WORDPRESS ADMIN PANEL;
function remove_woodmart_admin_bar_option($wp_admin_bar) {
    $wp_admin_bar->remove_node('xts_dashboard');
    $wp_admin_bar->remove_node('wp-logo');
    $wp_admin_bar->remove_node('comments');
}
add_action('admin_bar_menu', 'remove_woodmart_admin_bar_option', 999);


add_action('admin_init', 'remove_dashboard_meta_boxes', 999);
function remove_dashboard_meta_boxes() {
    remove_action('welcome_panel', 'wp_welcome_panel');
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
    remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
    remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
    remove_meta_box('dashboard_primary', 'dashboard', 'side');
    remove_meta_box('dashboard_secondary', 'dashboard', 'side');
    remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
    remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
    remove_meta_box('dashboard_woocommerce', 'dashboard', 'normal');
    remove_meta_box('dashboard_activity', 'dashboard', 'normal');
    remove_meta_box('woocommerce_dashboard_status', 'dashboard', 'normal');
    remove_action('admin_footer', 'wp_admin_footer');
    remove_action('wp_footer', 'wp_generator');
    remove_filter('update_footer', 'core_update_footer');
    add_filter('admin_footer_text', '__return_empty_string');
}

add_action( 'admin_menu', 'wpdocs_remove_menus', 999);
function wpdocs_remove_menus(){
    // global $menu;
    // echo '<pre>';
    // print_r( $menu );
    // echo '</pre>';
    if ( current_user_can( 'manage_options' ) ) {
        remove_menu_page( 'cp_calculated_fields_form' );
        remove_menu_page( 'super_forms' );
        remove_menu_page( 'wc-admin&path=/marketing' );
        remove_menu_page( 'edit.php?post_type=custom-css-js' );
    }
    
    if ( current_user_can( 'view_woocommerce_reports' ) ) {
        remove_submenu_page( 'wc-admin', 'wc-admin&path=/analytics/overview' );
    }
    if ( current_user_can( 'manage_woocommerce' ) ) {
        remove_menu_page( 'woocommerce-marketing' );
    }
    remove_menu_page( 'index.php' );
    
    remove_menu_page( 'betheme' );
    remove_menu_page( 'edit-comments.php' );
    remove_menu_page( 'options-general.php' );
    remove_menu_page( 'themes.php' );
    remove_menu_page( 'plugins.php' );
    remove_menu_page( 'users.php' );
    remove_menu_page( 'tools.php' );
    remove_menu_page( 'page=cp_calculated_fields_form' );
    remove_menu_page( 'revslider' );
    remove_menu_page( 'wc-admin' );
    remove_menu_page( 'edit.php?post_type=layout' );
    remove_menu_page( 'edit.php?post_type=slide' );
    remove_menu_page( 'woocommerce' );
    remove_menu_page( 'wpforms-overview' );
    remove_menu_page( 'getwooplugins' );
    remove_menu_page( 'wpcode' );
    remove_menu_page( 'gf_edit_forms' );
    remove_menu_page( 'vc-general' );
    remove_menu_page( 'wc-admin&path=/analytics/overview' );
    remove_menu_page( 'wc-admin&path=/payments/connect' );

    remove_submenu_page( 'woocommerce', 'wc-admin' );
    remove_submenu_page( 'woocommerce', 'wc-reports' );
    remove_submenu_page( 'woocommerce', 'wc-settings' );
    remove_submenu_page( 'woocommerce', 'wc-status' );
    remove_submenu_page( 'woocommerce', 'wc-addons' );
	remove_menu_page( 'wp-hide' );
	remove_menu_page( 'wpfastestcacheoptions' );
}


===============================================
Different CODE
==============================================
add_action( 'admin_init', function () {
// 	remove_menu_page( 'edit.php?post_type=page' );
	remove_menu_page( 'edit.php?post_type=woodmart_layout' );
	remove_menu_page( 'edit.php?post_type=woodmart_slide' );
	remove_menu_page( 'edit.php?post_type=woodmart_sidebar' );
	remove_menu_page( 'edit.php?post_type=portfolio' );
	remove_menu_page( 'edit.php?post_type=cms_block' );
	 $current_user = wp_get_current_user();
    if ($current_user && $current_user->user_login === 'appleagues') {
    	remove_menu_page('edit.php?post_type=acf-field-group');
    	remove_menu_page('edit.php?post_type=product');
    }
});
function remove_gf_menu_page() {
    $current_user = wp_get_current_user();
    if ($current_user && $current_user->user_login === 'appleagues') {
        remove_menu_page( 'gf_edit_forms' );
        remove_menu_page('themes.php');
        remove_menu_page('plugins.php');
        remove_menu_page('users.php');
        remove_submenu_page('options-general.php', 'options-writing.php');
        remove_submenu_page('options-general.php', 'options-reading.php');
        remove_submenu_page('options-general.php', 'options-discussion.php');
        remove_submenu_page('options-general.php', 'options-media.php');
        remove_submenu_page('options-general.php', 'options-permalink.php');
        remove_submenu_page('options-general.php', 'options-privacy.php');
        remove_submenu_page('options-general.php', 'smtp-mailer-settings');
        remove_submenu_page('options-general.php', 'really-simple-security');
        remove_submenu_page('options-general.php', 'table-of-contents');
        remove_submenu_page('options-general.php', 'cpto-options');
    }
}
add_action('admin_menu', 'remove_gf_menu_page', 9999 );
#include <stdio.h>

char to_lower(char letter);

int main(void)
{
	char input;

	printf("Please input a letter: \n");

	scanf("%c", &input);

	printf("%c's lowercase is %c\n", input, to_lower(input));

	return 0;
}

char to_lower(char letter)
{
     if (letter >= 'A' && letter <= 'Z') {
        return letter + 32; // Convert to lowercase by adding 32
    } else {
        return '\0'; // Return null character if not uppercase
    }
}
#include <stdio.h>

int get_length(char *cstring) 
{
    int length = 0;
    while (cstring[length] != '\0') 
    {
        length++;
    }
    return length;
}

int main(void) {
    char *text[] = { "Steffan", "Pascal", "Jade" };

    printf("%s is %d chars.\n", text[0], get_length(text[0]));
    printf("%s is %d chars.\n", text[1], get_length(text[1]));
    printf("%s is %d chars.\n", text[2], get_length(text[2]));
    
    // Do not change the following code
    char user_input[64];
    scanf("%63[^\n]", user_input);
    printf("%s is %d chars.\n", user_input, get_length(user_input));
    
    return 0;
}
#include <stdio.h>

struct Character_Counts
{
	int vowels;
	int consonants;
	int uppercase;
	int lowercase;
	int spaces;
	int digits;
};
//add 
int is_vowel(char ch) {
    char lower_ch = (ch >= 'A' && ch <= 'Z') ? ch + 32 : ch;  // Convert to lowercase if uppercase
    return (lower_ch == 'a' || lower_ch == 'e' || lower_ch == 'i' || lower_ch == 'o' || lower_ch == 'u');
}

int is_alpha(char ch) {
    return ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'));
}

int is_upper(char ch) {
    return (ch >= 'A' && ch <= 'Z');
}

int is_lower(char ch) {
    return (ch >= 'a' && ch <= 'z');
}

int is_digit(char ch) {
    return (ch >= '0' && ch <= '9');
}

struct Character_Counts analyse_text(char text[])
{
    struct Character_Counts counts = {0, 0, 0, 0, 0, 0};
    char *ptr = text;

    while (*ptr != '\0') {
        char ch = *ptr;
        if (is_alpha(ch)) {
            if (is_upper(ch)) {
                counts.uppercase++;
            }
            if (is_lower(ch)) {
                counts.lowercase++;
            }
            if (is_vowel(ch)) {
                counts.vowels++;
            } else {
                counts.consonants++;
            }
        } else if (is_digit(ch)) {
            counts.digits++;
        } else if (ch == ' ') {
            counts.spaces++;
        }
        ptr++;
    }

    return counts;
}


void print_counts(struct Character_Counts data)
{
    printf("Vowels = %d\n", data.vowels);
    printf("Consonants = %d\n", data.consonants);
    printf("Uppercase = %d\n", data.uppercase);
    printf("Lowercase = %d\n", data.lowercase);
    printf("Spaces = %d\n", data.spaces);
    printf("Digits = %d\n", data.digits);
}

int main(void)
{
	char buffer[80];
	printf("> ");
	scanf("%79[^\n]", buffer);
	struct Character_Counts results = analyse_text(buffer);
	print_counts(results);
	return 0;
}
#include <stdio.h>

void divide(int dividend, int divisor, int* p_quotient, int* p_remainder);

int main(void)
{
	int numerator = 0;
	printf("Dividend? ");
	scanf("%d", &numerator);
	int denominator = 0;
	printf("\nDivisor?");
	scanf("%d", &denominator);
	int quotient;
	int remainder;
	// TODO: Call divide...
	divide(numerator, denominator, &quotient, &remainder);
	printf("\nQuotient is %d\n", quotient);
	printf("Remainder is %d\n", remainder);
	return 0;
}

// TODO: Define divide function:
void divide(int dividend, int divisor, int* p_quotient, int* p_remainder) 
{
    *p_quotient = dividend / divisor;
    *p_remainder = dividend % divisor;
}

	 	

Maksym Radchenko	
BA
MR. GLAZIER
Honest Estimates
Clean Execution
max@mglazier.com
979 3rd Avenue suite 815, New York NY 10022
<table class="signature_tbl" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:10px;font-family:Inter,sans-serif;"> <tbody><tr> <td class="layout_maintd" style="line-height:16px;font-family:Inter, sans-serif; border-collapse:collapse;"><table cellpadding="0" cellspacing="0" style="border-collapse: separate;"> <tbody><tr> <td valign="top" align="left" class="layout_border" style="border-collapse:separate; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid; padding:3px 8px 8px 8px;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr><td style="padding:5px 0 0 0" class="layout-web-icon sicon"><a href="http://mrglazier.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/web-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-linkedin-icon sicon"><a href="http://link.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/linkedin-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-google-icon sicon"><a href="https://g.page/r/CaH6NEWXm9CWEB0/review" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/google-icon.gif" width="24" style="display:block;"></a></td></tr> </tbody></table></td> <td width="8" style="border-collapse:collapse;">&nbsp;</td> <td valign="top" align="left" class="layout_border" style="border-collapse:collapse; padding:15px; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="left" valign="middle" style="border-collapse:collapse;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td><a href="http://mrglazier.com" id="layout_link"><img class="layout_logo" src="https://app.customesignature.com/upload/signature/complete/5173/5173.gif" width="215" style="display:block;"></a></td> </tr> <tr> <td style="border-collapse: collapse; padding:0 0 10px 0;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td style="padding:15px 0 0 0; border-collapse: collapse;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="left" valign="middle"><span class="layout_firstname" style="font-weight:bold; font-style:normal; color:#000000; font-size:20px;">Maksym Radchenko</span> </td> <td align="left" valign="middle" style="padding-left:5px;"><img class="layout_verified" width="15" height="15" src="https://app.customesignature.com/images/verify.gif" style="display:block;"></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_jobtitle" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">BA</span></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_company" style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">MR. GLAZIER</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Honest</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Estimates</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Clean</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Execution</span></td> </tr>              <tr> <td style="border-collapse: collapse;"> <a href="mailto:max@mglazier.com" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px; text-decoration:none;">max@mglazier.com</a></td> </tr>          <tr> <td style="border-collapse: collapse;"> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">979 3rd Avenue suite 815, New York NY 10022</span></td> </tr>          <tr> <td style="border-collapse:collapse; padding:5px 0 0 0;"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;"> <tbody><tr></tr> </tbody></table></td> </tr> <tr> <td style="border-collapse:collapse;"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;"> <tbody><tr></tr> </tbody></table></td> </tr> </tbody></table></td> <td align="left" valign="middle" style="padding:0 0 0 15px; border-collapse:collapse;" class="htmltogifClass"><div style="max-height:inherit;overflow:visible"><img style="display:none;border-radius:10px" class="signature_profile image_gif_overlay" src="https://app.customesignature.com/upload/signature/profile/1710476884-5173.jpg" width="140"></div><img src="https://app.customesignature.com//upload/signature/gifs/giphyy-1.gif" class="profile-annimation-gif" name="profile_annimation_gif" style="z-index:-1;position:relative;display:none;border-radius:10px;" width="140"></td> </tr> </tbody></table></td> </tr> </tbody></table></td> </tr> <tr> <td align="left" valign="top"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr>    </tr> </tbody></table></td> </tr> <tr> </tr><tr> <td style="padding:10px 0 0 0;"><a href="javascript:void(0);" id="layout_bannerlink"><img class="layout_banner" src="https://app.customesignature.com/upload/signature/banner/1710475377-5173.jpg" width="400" style="border-radius:10px; display:none;"></a></td> </tr>      </tbody></table>
<table class="signature_tbl" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:10px;font-family:Inter,sans-serif;"> <tbody><tr> <td class="layout_maintd" style="line-height:16px;font-family:Inter, sans-serif; border-collapse:collapse;"><table cellpadding="0" cellspacing="0" style="border-collapse: separate;"> <tbody><tr> <td valign="top" align="left" class="layout_border" style="border-collapse:collapse; padding:15px; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="center" valign="middle" style="padding:15px 15px 0 0;"><a href="http://mrglazier.com" id="layout_link"><img class="layout_logo" src="https://app.customesignature.com/upload/signature/complete/5173/5173.gif" width="215" style="display:block;"></a></td> <td align="left" valign="middle" class="layout_divider" style=" border:none; border-left-width:1px; border-left-color:#000000; border-left-style: solid; padding:0 0 0 15px;"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: separate;"> <tbody><tr> <td style="border-collapse: collapse; padding-bottom:10px;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td style="padding:5px 0 0 0; border-collapse: collapse;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="left" valign="middle"><span class="layout_firstname" style="font-weight:bold; font-style:normal; color:#000000; font-size:20px;">Maksym Radchenko</span> </td> <td align="left" valign="middle" style="padding-left:5px;"><img class="layout_verified" width="15" height="15" src="https://app.customesignature.com/images/verify.gif" style="display:block;"></td> <td align="left" valign="middle" style="padding-left:20px;" class="htmltogifClass"><div style="max-height:inherit;overflow:visible"><img style="display:none;border-radius:10px" class="signature_profile image_gif_overlay" src="https://app.customesignature.com/upload/signature/profile/1710476884-5173.jpg" width="20"></div> <img src="https://app.customesignature.com//upload/signature/gifs/giphyy-1.gif" class="profile-annimation-gif" name="profile_annimation_gif" style="z-index:-1;position:relative;display:none;border-radius:10px;" width="20"></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_jobtitle" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">BA</span></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_company" style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">MR. GLAZIER</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Honest</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Estimates</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Clean</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Execution</span></td> </tr>              <tr> <td style="border-collapse: collapse;"> <a href="mailto:max@mglazier.com" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px; text-decoration:none;">max@mglazier.com</a></td> </tr>          <tr> <td style="border-collapse: collapse;"> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">979 3rd Avenue suite 815, New York NY 10022</span></td> </tr>          <tr> <td valign="top" align="center" style="border-collapse: collapse; padding:5px 0 0 0;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr></tr> </tbody></table></td> </tr> <tr> <td style="border-collapse:collapse;"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;"> <tbody><tr></tr> </tbody></table></td> </tr> </tbody></table></td> </tr> </tbody></table></td> <td width="8" style="border-collapse:collapse;">&nbsp;</td> <td valign="top" align="left" class="layout_border" style="border-collapse:separate; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid; padding:3px 8px 8px 8px;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr><td style="padding:5px 0 0 0" class="layout-web-icon sicon"><a href="http://mrglazier.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/web-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-linkedin-icon sicon"><a href="http://link.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/linkedin-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-google-icon sicon"><a href="https://g.page/r/CaH6NEWXm9CWEB0/review" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/google-icon.gif" width="24" style="display:block;"></a></td></tr> </tbody></table></td> </tr> </tbody></table></td> </tr> <tr> <td align="left" valign="top"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr>    </tr> </tbody></table></td> </tr> <tr> </tr><tr> <td style="padding:10px 0 0 0;"><a href="javascript:void(0);" id="layout_bannerlink"><img class="layout_banner" src="https://app.customesignature.com/upload/signature/banner/1710475377-5173.jpg" width="400" style="border-radius:10px; display:none;"></a></td> </tr>      </tbody></table>
const printName = (name) => {
    console.log(name)
}
const countLength = (name) => {
    return `${name} ${name.length}`
}
const capitalize = (name) => {
    return name.toUpperCase(name)
}
const trimName = (name) => {
    return name.trim(name)
}

const compose = (...fns) => (val) => fns.reduceRight((prev, fn) => fn(prev), val) 

// printName(countLength(capitalize(trimName(' harsh  '))))

// pipe(trimName,capitalize,countLength,printName)(' harsh  ')

compose(printName,countLength,capitalize,trimName)(' harsh  ')

star

Thu Jun 13 2024 14:06:35 GMT+0000 (Coordinated Universal Time)

@divay6677 ##c++

star

Thu Jun 13 2024 13:37:03 GMT+0000 (Coordinated Universal Time)

@shees

star

Thu Jun 13 2024 12:33:47 GMT+0000 (Coordinated Universal Time)

@NoFox420 #html

star

Thu Jun 13 2024 11:52:23 GMT+0000 (Coordinated Universal Time) https://secure.helpscout.net/reports/happiness/

@Pulak

star

Thu Jun 13 2024 11:44:55 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 11:44:17 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 11:43:51 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 11:11:30 GMT+0000 (Coordinated Universal Time)

@NoFox420 #html

star

Thu Jun 13 2024 08:24:42 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 08:24:06 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

@eziokittu #python #env #kernel #jupyter #anaconda

star

Thu Jun 13 2024 08:23:59 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 08:23:38 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 07:41:07 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/crypto-casino-game-development

@steeve #crypto #casino #game #development

star

Thu Jun 13 2024 06:40:29 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #jquery

star

Thu Jun 13 2024 05:16:51 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/crypto-casino-game-development

@steeve #crypto #casino #game

star

Thu Jun 13 2024 03:35:26 GMT+0000 (Coordinated Universal Time)

@jrray

star

Thu Jun 13 2024 01:08:48 GMT+0000 (Coordinated Universal Time)

@galaxy #css

star

Wed Jun 12 2024 20:48:26 GMT+0000 (Coordinated Universal Time)

@tomasp #c++

star

Wed Jun 12 2024 20:43:19 GMT+0000 (Coordinated Universal Time)

@tomasp #c++

star

Wed Jun 12 2024 19:18:26 GMT+0000 (Coordinated Universal Time)

@Promakers2611

star

Wed Jun 12 2024 19:17:31 GMT+0000 (Coordinated Universal Time)

@Promakers2611

star

Wed Jun 12 2024 19:07:16 GMT+0000 (Coordinated Universal Time) https://blog.scottlogic.com/2020/10/08/lets-build-snake-with-rust.html

@ORDINAL

star

Wed Jun 12 2024 15:21:53 GMT+0000 (Coordinated Universal Time)

@tokoyami_ds

star

Wed Jun 12 2024 12:46:06 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/html/tryit.asp?filename

@sandeepv

star

Wed Jun 12 2024 12:45:59 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/html/tryit.asp?filename

@sandeepv #undefined

star

Wed Jun 12 2024 10:57:31 GMT+0000 (Coordinated Universal Time)

@RehmatAli2024 #deluge

star

Wed Jun 12 2024 10:18:30 GMT+0000 (Coordinated Universal Time)

@taufiq_ali

star

Wed Jun 12 2024 10:17:35 GMT+0000 (Coordinated Universal Time) https://studio.youtube.com/channel/UCkNG6QrabEQdyroozJp4nCg/editing/sections

@calazar23

star

Wed Jun 12 2024 10:14:31 GMT+0000 (Coordinated Universal Time)

@Ranjith

star

Wed Jun 12 2024 07:15:08 GMT+0000 (Coordinated Universal Time)

@ayushg103 #c++

star

Wed Jun 12 2024 06:23:57 GMT+0000 (Coordinated Universal Time)

@davidmchale #condtional #ternary

star

Wed Jun 12 2024 04:55:43 GMT+0000 (Coordinated Universal Time)

@NoFox420 #nodejs

star

Wed Jun 12 2024 04:14:25 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function #struct

star

Wed Jun 12 2024 03:19:24 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function #struct

star

Wed Jun 12 2024 03:12:37 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function #struct

star

Wed Jun 12 2024 03:09:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1269562/how-to-create-an-array-from-a-csv-file-using-php-and-the-fgetcsv-function

@al.thedigital #php

star

Wed Jun 12 2024 03:08:55 GMT+0000 (Coordinated Universal Time) https://drupal.stackexchange.com/questions/185572/get-the-public-path-directory

@al.thedigital #php #filepath #sitesdefaultpath

star

Wed Jun 12 2024 01:55:12 GMT+0000 (Coordinated Universal Time)

@calazar23

star

Tue Jun 11 2024 23:44:55 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 23:43:51 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 23:42:22 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 23:41:09 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 20:49:42 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 20:44:52 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 20:43:03 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 20:41:15 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 17:48:45 GMT+0000 (Coordinated Universal Time)

@oleg

star

Tue Jun 11 2024 16:23:33 GMT+0000 (Coordinated Universal Time)

@oleg

star

Tue Jun 11 2024 16:18:45 GMT+0000 (Coordinated Universal Time)

@oleg

star

Tue Jun 11 2024 13:04:10 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/pipe-and-compose-in-javascript-5b04004ac937/

@Harsh_shh ##javascript

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension