Search code snippets, questions, articles...

A portal for programmers by programmers

Learn something new everyday and share your knowledge

Programming Feeds

Web Page with 3 cards Displaying images

anandts / February 6, 2023

This code uses functional components, Card and App, to display the cards. The Card component takes in props for an image, title, and text and displays them using inline styles. The App component then uses the Card component three times, passing in different values for each card.

Convert a List of Strings to List of Integers in Python

Devsheet / January 28, 2023

Converting a list of strings to a list of integers in Python can be a useful technique for data manipulation and processing. In this post, we will explore different methods to convert a list of strings to a list of integers in Python, including using list comprehension and the map() function.

Javascript to find which DOM element has the focus

Devsheet / January 28, 2023

In JavaScript, you can use the document.activeElement property to determine which DOM element currently has the focus. This property returns the element that currently has focus, or null if no element has focus.

Create a Modal Popup Component in React

Devsheet / January 28, 2023

Creating a modal popup component in React is a great way to add a user-friendly, interactive element to your website or application. A modal popup is a dialog box that appears on top of the current screen, allowing users to interact with the content within it.

Efficiently Remove the Last Element from an Array in JavaScript [6 Methods Explained]

Devsheet / January 28, 2023

Welcome to our guide on how to efficiently remove the last element from an array in JavaScript. In this tutorial, we will be discussing six different methods that can be used to accomplish this task.

HTMX - Show loader when request is in progress

Devsheet / January 28, 2023

In HTMX, you can use the hx-get or hx-post attribute to make an AJAX request, and the hx-indicator attribute to toggle the visibility of a loader element.

HTMX - Send a Post request on Form Submit

Devsheet / January 28, 2023

To send a POST request using the HTMX library in Python, you can use the htmx.post() function. It send a POST request to the server with form data.

Convert List of Tuples to JSON string in Python

Devsheet / January 27, 2023

You can use the json module in Python to convert a list of tuples to a JSON string. We will explain it with examples in this post.

Create a tab component in React

Devsheet / January 26, 2023

Welcome to this tutorial on creating a tab component in React. Tabs are a common UI element in web applications and can be used to organize and present content in a clear and user-friendly way.

Vim - exit insert mode if ESC not working

Devsheet / January 24, 2023

If the ESC key is not working in Vim's insert mode, you can try using the "Ctrl + [" key combination instead to exit insert mode. This is because the "Ctrl + [" key combination is the default mapping for the ESC key in Vim.

Flutter run app in release mode

Devsheet / January 16, 2023

To run a Flutter app in release mode, you can use the command flutter run --release in the terminal while in the root directory of your app. This will build and run the app in release mode, which is optimized for performance and is typically used for distribution to end users.

Get Tag Name of an Element using Javascript

Devsheet / January 14, 2023

In JavaScript, the tag name of an HTML element can be retrieved using the .tagName property. The .tagName property returns a string representing the tag name of the provided element.

Email_Automation

sovbam125E8C / January 4, 2023

This Code is to be used to automatically send Emails from sheet data.

Native Video Ad Sample xml file

Devsheet / January 2, 2023

This XML file provides an example of how a native video ad can be created and encoded in XML. It includes the necessary parameters and elements needed to successfully encode a native video ad, allowing developers and advertisers to quickly and effectively create their own native video ad.

Python program to Generate a Random String

Devsheet / January 1, 2023

In Python, it is often useful to generate random strings for various purposes, such as generating unique IDs, passwords, or test data. Python provides several modules that allow you to generate random strings easily.

The Maximum Length of a Python String Explained

Devsheet / January 1, 2023

In Python, the maximum length of a string is determined by the amount of memory available to the Python interpreter. In practice, this means that a Python string can be as long as your system's available memory allows.

Python Strings: Learn How to Add Line Breaks

Devsheet / January 1, 2023

Python strings can be used to store text and data. They are useful for displaying text to users, writing messages, and other types of communication. In some cases, you may need to add a line break to your string. This article will explain how to do this in Python.

Learn to Use Python's Built-In String Functions

Devsheet / January 1, 2023

There are several built-in string functions in Python that can be used to manipulate and work with strings. Here is a list of some of the most commonly used string functions:

Check if the Java JDK is installed on Mac

Devsheet / January 1, 2023

In this post, we will explain how to check if Java JDK is installed on your MAC or not.

Flutter Container Widget

Devsheet / December 30, 2022

In Flutter, the Container widget is a box that can contain other widgets. It allows you to apply visual styling to the contained widgets, such as padding, background color, and borders.

Get element position from the bottom of the screen

ante.buleAEF6 / December 27, 2022

Calculate the distance of the widget from the bottom of the screen

Get the largest value from an array using javascript

Devsheet / December 11, 2022

In this post, we will learn different methods and functions to get the largest value from an array. We will use Math.max() function in order to do that along with other methods with explanation.

While loop in Javascript with examples

Devsheet / December 10, 2022

In JavaScript, a while loop is a control flow statement that allows you to execute a block of code repeatedly as long as a certain condition is true. In this post we will explain the while and do-while loop of Javascript with examples.

How to iterate over an object in Javascript

Devsheet / December 8, 2022

Iterating over an object in Javascript can be a great way to access data stored within the object. By looping over an object, you can get the specific values of the object keys, which can be a helpful tool when trying to access and manipulate data. In this article, you'll learn how to iterate over an object in Javascript and use it to access the data stored within.

Include a template in another template Django

Devsheet / November 30, 2022

When building a website, there are often common elements that are used on multiple pages. Rather than duplicate code, a template can be created that includes the common elements, and then that template can be included in other templates as needed.

How to get current file path in Python

Devsheet / November 28, 2022

Python is a powerful programming language that is widely used in many different industries today. One of its key features is its ability to manipulate file paths. This can be extremely useful when working with files in Python. In this article, we will show you how to get the current file path in Python.

Check if firebase app is initialized in Python

Devsheet / November 28, 2022

If you are using firebase admin in your python project and getting the error - The default Firebase app already exists. Then you can use the code examples explained here.

Render a string as HTML in React

Devsheet / November 28, 2022

If you're working with React and you need to render a string as HTML, there are a few options available to you. You can use the built-in dangerouslySetInnerHTML prop, you can use a third-party library like DOMPurify, or you can write your own function to handle the conversion. Whichever option you choose, be sure to take care when handling user input, as it's possible for malicious actors to inject code into your app that can wreak havoc.

Create Android Emulator on Mac

haidaranwar7863F06 / November 24, 2022

This is script to make android emulator on Mac

Set height and width of Button in Flutter

Devsheet / November 14, 2022

If you're creating a button in Flutter, you may want to know how to set the height and width. This can be done in a few different ways, and we'll cover them here. First, you can use the SizedBox widget to set specific dimensions, or you can use the ConstrainedBox widget to set constraints on the button's size.

Loading more...