This file contains hidden or 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: "[email protected]" }, | |
{ id: 2, first_name: "Jane", last_name: "Smith", age: 25, email: "[email protected]" }, | |
{ id: 3, first_name: "Michael", last_name: "Johnson", age: 35, email: "[email protected]" }, | |
{ id: 4, first_name: "Emily", last_name: "Brown", age: 28, email: "[email protected]" } | |
] | |
# Function to apply the search filter | |
def search_users(query, users) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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: '#' }, | |
] |
This file contains hidden or 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 ComponantA from "./ComponantA"; | |
import ComponantB from "./ComponantB"; | |
import ComponantC from "./ComponantC"; | |
function ChangeComponantSelect(){ | |
const [selected,setSelected]=useState('First Componant') | |
const handleChange=(e)=>{ | |
console.log(e.target.value) |
This file contains hidden or 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 AWS = require('aws-sdk') | |
const lambda = new AWS.Lambda() | |
const sleep = (milliseconds) => { | |
return new Promise(resolve => setTimeout(resolve, milliseconds)) | |
} | |
const recursionLimit = 5 | |
exports.handler = async(event) => { | |
await sleep(2000) |
This file contains hidden or 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 AWS = require('aws-sdk') | |
const lambda = new AWS.Lambda() | |
const sleep = (milliseconds) => { | |
return new Promise(resolve => setTimeout(resolve, milliseconds)) | |
} | |
const recursionLimit = 5 | |
exports.handler = async(event) => { | |
await sleep(2000) |