Tooltip

javascript

Simple WebSocket Server using 'ws' library

This Node.js code sets up a simple WebSocket server using the 'ws' library. It listens for...

javascript

JavaScript Validate URL

This JavaScript code defines a function isValidURL that uses a regular expression (urlRegex) to...

php

File Upload with Type Validation in PHP

This PHP code checks if a file has been submitted, validates its type (allowing only 'jpg' or...

python

Find Maximum Value in a List

This Python code uses the max() function to find the maximum value in a list (numbers). The...

python

Sort List of Objects by Attribute in Python

This Python code defines a Person class, creates instances of Person, and then sorts the list of...

javascript

Calculate Greatest Common Divisor (GCD) of Two Numbers

This JavaScript code defines a function calculateGCD that uses the Euclidean Algorithm to...

javascript

JavaScript Class with Constructor and Method

This JavaScript code defines a Person class with a constructor for initializing properties (name...