This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react"; | |
import { GoogleGenerativeAI } from "@google/generative-ai"; | |
function Gemini() { | |
const [loading, setLoading] = useState(false); | |
const [apiData, setApiData] = useState(""); | |
const [selectedFile, setSelectedFile] = useState(null); | |
const genAI = new GoogleGenerativeAI(process.env.NEXT_PUBLIC__API_GEN_API); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import axios from 'axios'; | |
// Define a functional component called FileUpload | |
const FileUpload = () => { | |
// Declare two state variables using the useState hook: | |
// - selectedFile: to store the currently selected file | |
// - uploadStatus: to display the upload status message | |
const [selectedFile, setSelectedFile] = useState(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const { Pool } = require('pg'); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
const pool = new Pool({ | |
user: 'your_db_user', | |
host: 'localhost', | |
database: 'your_db_name', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample array of user objects | |
users = [ | |
{ id: 1, first_name: "John", last_name: "Doe", age: 30, email: "john@example.com" }, | |
{ id: 2, first_name: "Jane", last_name: "Smith", age: 25, email: "jane@example.com" }, | |
{ id: 3, first_name: "Michael", last_name: "Johnson", age: 35, email: "michael@example.com" }, | |
{ id: 4, first_name: "Emily", last_name: "Brown", age: 28, email: "emily@example.com" } | |
] | |
# Function to apply the search filter | |
def search_users(query, users) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function domainName(url) { | |
// Remove protocol and www. prefix from domain | |
let domain = url.replace(/(https?:\/\/)?(www\.)?/, ''); | |
// Remove everything after the first dot (including the dot) | |
domain = domain.split('.')[0]; | |
return domain; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sorts an array of objects by a specified property | |
* | |
* @param {Array} array - The array to sort | |
* @param {string} property - The property to sort by | |
* @returns {Array} - The sorted array | |
*/ | |
const sortByProperty = (array, property) => { | |
return array.sort((a, b) => { | |
if (a[property] < b[property]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Shaking Particles</title> | |
<style> | |
.shape { | |
position: absolute; | |
width: 50px; | |
height: 50px; | |
transform: scale(0.8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react"; | |
const ThirtySecCounter = () => { | |
const [timeLeft, setTimeLeft] = useState(30); | |
useEffect(() => { | |
if (!timeLeft) return; | |
const intervalId = setInterval(() => { | |
setTimeLeft((prevTimeLeft) => prevTimeLeft - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// api.ts | |
import axios, { AxiosResponse } from 'axios'; | |
import apiConfig from './apiConfig'; | |
// Define interfaces for request data types | |
interface LoginData { | |
email: string; | |
password: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react' | |
import { Dialog } from '@headlessui/react' | |
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline' | |
const navigation = [ | |
{ name: 'Product', href: '#' }, | |
{ name: 'Features', href: '#' }, | |
{ name: 'Marketplace', href: '#' }, | |
{ name: 'Company', href: '#' }, | |
] |
NewerOlder