DeveloperBreeze

Smooth Scroll to Contact Element on DOM Content Load

document.addEventListener('DOMContentLoaded', function () {
    // Get the contact element by its ID
    var contactElement = document.getElementById('contact');

    // Check if the contact element exists
    if (contactElement) {
        // Scroll to the contact element with smooth behavior
        contactElement.scrollIntoView({
            behavior: 'smooth'
        });
    }
});

Continue Reading

Discover more amazing content handpicked just for you

Code

How to Create a New MySQL User with Full Privileges

No preview available for this content.

May 01, 2025
Read More
Code
python

Configuring SQLAlchemy with PostgreSQL on Heroku: A Quick Guide

  • This code retrieves the DATABASE_URL from the environment.
  • If DATABASE_URL starts with postgres://, it replaces it with postgresql+psycopg2://.
  • The db instance is initialized with SQLAlchemy(app) for use with SQLAlchemy ORM.
  • The replacement of "postgres://" with "postgresql+psycopg2://" is necessary because of a compatibility issue between the URI format provided by Heroku and the URI format expected by SQLAlchemy.
  • When you provision a PostgreSQL database on Heroku, it sets an environment variable called DATABASE_URL with the connection string for your database.
  • This URI uses the format postgres://.

Nov 08, 2024
Read More
Code
php

How to Delete All WordPress Posts and Their Uploads Using a Custom PHP Script

Make sure your script has access to the WordPress environment by loading wp-load.php:

require_once('/path/to/your/wp-load.php');

Oct 25, 2024
Read More
Code
php

How To enable all error debugging in PHP

No preview available for this content.

Oct 25, 2024
Read More
Code
bash

How to Paste in an SSH Terminal Without a Mouse

  • Copy: Select text (it automatically copies to the clipboard).
  • Paste: Right-click or Shift + Insert.
  • Copy: Ctrl + Shift + C
  • Paste: Ctrl + Shift + V

Oct 20, 2024
Read More
Note
javascript nodejs

Vite vs Webpack

No preview available for this content.

Aug 14, 2024
Read More
Code
nodejs graphql

GraphQL API Server with Node.js and Apollo Server

Run the server using Node.js:

   node index.js

Aug 12, 2024
Read More
Code
javascript

React Custom Hook for API Requests

Here’s an example of how to use the useFetch hook in a React component to fetch and display data.

import React from 'react';
import useFetch from './useFetch'; // Ensure correct import path

function UserList() {
    const { data, loading, error } = useFetch('https://jsonplaceholder.typicode.com/users');

    if (loading) return <p>Loading...</p>;
    if (error) return <p>Error: {error.message}</p>;

    return (
        <ul>
            {data.map(user => (
                <li key={user.id}>{user.name}</li>
            ))}
        </ul>
    );
}

export default UserList;

Aug 12, 2024
Read More
Code
csharp

Unity Inventory System using Scriptable Objects

No preview available for this content.

Aug 12, 2024
Read More
Code
csharp

Unity Player Controller Blueprint

  • Animation Integration: Add animator components and trigger animations based on movement and jump states.
  • Advanced Physics: Integrate more complex physics interactions, such as slopes or surface friction.
  • Networking: Adapt the controller for multiplayer environments using Unity’s networking solutions.

Aug 12, 2024
Read More
Code
bash

Bash: How to Loop Over Files in a Directory

No preview available for this content.

Aug 12, 2024
Read More
Code
csharp

C#: How to Read a File

No preview available for this content.

Aug 12, 2024
Read More
Code
html

HTML: Basic Template Structure

No preview available for this content.

Aug 12, 2024
Read More
Code
php

PHP: How to Connect to a MySQL Database

No preview available for this content.

Aug 12, 2024
Read More
Code
css

CSS: How to Center a Div Horizontally and Vertically

No preview available for this content.

Aug 12, 2024
Read More
Code
java

Java: How to Sort a List

No preview available for this content.

Aug 12, 2024
Read More
Code
javascript nodejs

Node.js: How to Create an HTTP Server

No preview available for this content.

Aug 12, 2024
Read More
Code
sql

SQL: How to Select Top N Records

-- For SQL Server
SELECT TOP 10 * FROM Customers;

-- For MySQL and PostgreSQL
SELECT * FROM Customers LIMIT 10;

-- For Oracle
SELECT * FROM (SELECT * FROM Customers) WHERE ROWNUM <= 10;

Aug 12, 2024
Read More
Code
python

Python: How to Reverse a String

No preview available for this content.

Aug 12, 2024
Read More
Code
javascript json

How to Deep Clone a JavaScript Object

// Using JSON methods
const deepClone = (obj) => {
    return JSON.parse(JSON.stringify(obj));
};

// Using structured cloning (modern browsers)
const deepCloneModern = structuredClone(obj);

// Usage
const original = { a: 1, b: { c: 2 } };
const clone = deepClone(original);

Aug 12, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!