teleren/devto huggingface dataset:
Understanding Pass-By-Value and Pass-By-Reference in JavaScript: A Beginner's Guide
Published: 2024-02-17 18:45:11

Introduction:
Welcome, fellow coding enthusiasts! Today, we're diving into the intriguing world of pass-by-value and pass-by-reference in JavaScript. These concepts might sound a bit intimidating at first, but fear not! We'll break them down into simple terms with real-world examples to make it crystal clear.

**Pass-By-Value: The Copycat Game**

Let's imagine a scenario: you and your friend love playing a game where you copy each other's drawings. In JavaScript, pass-by-value works similarly. When you pass a primitive data type (like a number, string, or boolean) to a function, you're essentially making a copy of that value.

```javascript
// Example of pass-by-value
function doubleValue(num) {
  num = num * 2;
  console.log("Inside the function:", num);
}

let originalNumber = 5;
doubleValue(originalNumber);
console.log("Outside the function:", originalNumber);
```

In this example, the `doubleValue` function takes a copy of the `originalNumber`, doubles it inside the function, but the original remains unchanged outside the function.

**Pass-By-Reference: Sharing is Caring**

Now, let's switch gears and imagine a shared notebook. You and your friend can both make changes to it, and those changes are reflected for both of you. This mirrors pass-by-reference in JavaScript.

```javascript
// Example of pass-by-reference
function updateArray(arr) {
  arr.push(4);
  console.log("Inside the function:", arr);
}

let originalArray = [1, 2, 3];
updateArray(originalArray);
console.log("Outside the function:", originalArray);
```

In this case, the `updateArray` function modifies the original array directly. The changes made inside the function are visible outside as well because objects (including arrays) are passed by reference.

**Interactive Challenge: Guess the Output!**

Now, let's have some fun with a challenge! Can you guess the output of the following code snippet before running it?

```javascript
function modifyObject(obj) {
  obj.property = "Modified!";
  console.log("Inside the function:", obj);
}

let originalObject = { property: "Original" };
modifyObject(originalObject);
console.log("Outside the function:", originalObject.property);
```

Take a moment to make your prediction and then try it out in your code editor. Understanding the output will solidify your grasp on pass-by-reference in JavaScript!

**Conclusion: Mastering Pass-By-Value and Pass-By-Reference**

Congratulations! You've navigated the realms of pass-by-value and pass-by-reference in JavaScript. Remember, pass-by-value involves making a copy of primitive values, while pass-by-reference allows direct manipulation of objects. These concepts are crucial as you progress in your coding journey, so keep practicing and exploring real-world scenarios to reinforce your understanding.

Happy coding!
: 🌱 Nurturing the Developer Community: 🤝🌍🚀
Tags: discuss, beginners, learning, programming
Published: 2024-02-17 18:53:30

Title: 🌱 Nurturing the Developer Community: 🤝🌍🚀

Introduction:
Hey there, fellow developers! 👋 Let's dive into the vibrant world of the developer community and how it thrives on collaboration, knowledge sharing, and mutual growth. 🌟👩‍💻👨‍💻

🌐 Embracing Diversity:
The beauty of the developer community lies in its diverse range of backgrounds, experiences, and perspectives. It's like a global melting pot where developers from all corners of the world come together to exchange ideas, solve problems, and create amazing things. 🌍✨🌈

💡 Knowledge Sharing:
Sharing knowledge is the lifeblood of the developer community. Whether it's through blog posts, forums, Stack Overflow, or meetups, developers eagerly share their insights, tips, and tricks with others. This collective wisdom accelerates learning and helps everyone stay up to date with the latest technologies and best practices. 📚🧠💡

🤝 Collaboration and Teamwork:
Collaboration is key to success in the developer community. Developers often team up on open-source projects, hackathons, or even during work to build innovative solutions together. The power of collaboration lies in leveraging each other's strengths, combining diverse skill sets, and creating something truly remarkable. 👥🚀💪

🌱 Mentorship and Growth:
Seasoned developers play a crucial role in nurturing the next generation. Mentoring programs and initiatives provide guidance, support, and encouragement to aspiring developers. It's a rewarding experience for mentors as well, as they witness the growth and success of those they mentor. Together, we cultivate a culture of continuous learning and personal development. 🌱🌟📈

🌟 Celebrating Achievements:
The developer community is quick to celebrate achievements, both big and small. From launching a successful project to solving a complex bug, everyone cheers each other on, fostering a positive and motivating environment. It's incredible to witness the collective pride and joy that comes from sharing our successes. 🎉🏆🙌

Conclusion:
In this interconnected world, the developer community serves as a beacon of collaboration, knowledge sharing, and growth. It's a place where diverse minds unite, pushing the boundaries of innovation and creating a better future. So, let's continue to support and uplift each other, together shaping the technology landscape for generations to come. 🤝🚀💻

Keep coding, keep learning, and keep inspiring! 🌟😊💪


![high five](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bce91eysvelk1lctrol.png)
Download torrent files using Golang
Tags: go, torrent, concurrent, concurrency
Published: 2023-06-17 13:01:28

Hey everyone,

Today, I want to show you how to download torrent files easily using Golang. So stay with me…

First of all, you should have your torrent file or its magnet URL, which you can obtain from torrent websites such as 1377x.to or RARBG, and so on.

In this post, we will be using the ‘github.com/aliworkshop/torrent’ package to download torrent files with suitable downloading progress.

**Step 1:**
go get -v github.com/aliworkshop/torrent

**Step 2:**

```
client := torrent.NewClient(torrent.ClientConfig{
 TickerDuration: 3 * time.Second,
 })
defer client.Stop()
```

In this code, we create a client to start adding torrent files to.

`torrent.NewClient` takes a configuration parameter where you can set options. In our example, we only defined `TickerDuration`, which determines the duration of the downloading progress display.

We use defer to stop the client after all torrents have finished downloading.

**Step 3:**

```
err := client.AddTorrent("magnet:?xt=urn:btih:AE204757FE376C70852CD5818B01870F05EE7064")
 if err != nil {
 log.Fatalln("error on add torrent magnet url")
 }

```
In this code, we added our torrent file’s magnet URL to the client to start the download later.

If you want to download using a torrent file, you can add the relative path instead:

```
err := client.AddTorrent(“/path/to/file”)
 if err != nil {
 log.Fatalln(“error on add torrent file”)
 }

```
You can add more torrent files as needed and download them concurrently.

**Step 4:**

```
eg, _ := errgroup.WithContext(context.Background())
for _, tt := range client.GetTorrents() {
    eg.Go(func(t torrent.TorrentModel) func() error {
        return func() error {
            t.Initiate()
            t.Download()
            go t.DownloadLog()
            return nil
        }
    }(tt))
}
eg.Wait()

```
In this code, we start downloading the torrent files concurrently using the `errgroup` package in Golang. It allows us to perform concurrent jobs and handle errors if any of them occur.

**Step 5:**
```
client.GetClient().WaitAll()
 log.Print(“congratulations, all torrents downloaded!”)

```
Here, we wait for all torrent files to finish downloading before displaying a completion message.

Please note that this code assumes you have imported the necessary packages and have the required dependencies installed.

I hope this helps! Let me know if you have any further questions.
How to install several Flutter SDK
Tags: flutter, dart
Published: 2024-02-17 18:35:30

To install multiple Flutter SDKs on your system, you can use Flutter version management tools. The most common tool for this purpose is flutter version.

Here are the steps to install multiple Flutter SDKs:

Install Flutter:
If you haven't installed Flutter yet, you can do so by following the official installation guide: Flutter - Get Started.

Install Dart SDK:
Flutter requires Dart, so make sure Dart SDK is installed. Flutter usually comes bundled with the Dart SDK.

Install Flutter Version Management Tool:
Use a version management tool like flutter version to easily switch between different Flutter versions.

```
flutter pub global activate fvm
```
Make sure to add the Dart SDK binaries to your system's PATH. The command to add the binaries might look something like this:

```
export PATH="$PATH":"$HOME/.pub-cache/bin"
```

Add the above line to your shell profile (e.g., .bashrc or .zshrc) so that it persists across sessions.

Initialize FVM:
Run the following command to initialize FVM:

```
fvm install [desired_flutter_version]
```

Replace [desired_flutter_version] with the version of Flutter you want to install. For example:

```
fvm install 2.8.0
```

Use Flutter Version:
Once installed, you can switch between Flutter versions using:

```
fvm use [desired_flutter_version]
```

Verify Version:
Confirm that you are using the desired Flutter version by running:

```
flutter --version
```

This should reflect the version you installed with fvm.

Repeat steps 4-6 for each Flutter version you want to install.

Remember that Flutter projects specify their Flutter SDK version in the pubspec.yaml file. When switching between projects, it's a good practice to run flutter pub get to ensure the correct dependencies are installed for the specified Flutter version.

This way, you can have multiple Flutter SDK versions installed on your machine and easily switch between them based on project requirements.
TypeScript's noUncheckedIndexedAccess
Tags: typesafety, typescript, webdev, tsconfig
Published: 2024-02-17 18:27:45

Recently, a friend shared a TypeScript project with me, and as I delved into it, I noticed something crucial missing: the basic configuration of noUncheckedIndexedAccess

## ⚙️ Why is this configurations important?

noUncheckedIndexedAccess feature ensures that accessing elements in arrays or objects doesn't result in undefined or null, reducing runtime errors. Without it, developers might overlook potential null or undefined values, leading to unexpected crashes or behaviors.


## 🔍 Examples Speak Louder Than Words:

Consider this snippet without noUncheckedIndexedAccess:

```ts
const arr: string[] = ["a", "b", "c"];
const element: string = arr[4]; // Potential runtime error if arr[4] is undefined
```


## ✅ Conclusion:

Integrating noUncheckedIndexedAccess into your TypeScript projects might seem like a minor tweak, but it can prevent major headaches down the line. By catching potential issues early and enforcing stricter typing, these features contribute to more robust and reliable codebases.

Let's prioritize these configurations in our TypeScript projects to ensure smoother development experiences and fewer surprises in production. Keep coding confidently! 💻✨
Creating my first project - An interactive trivia quiz
Tags: beginners, javascript, tailwindcss, webdev
Published: 2024-02-17 17:51:56


![Screenshot of the interface of the app](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1rm1tvbf8mcyc2hlc56w.png)I created a [Greek Mythology Trivia Quiz](https://greek-myth-quiz.netlify.app/) using HTML, Tailwind CSS and JS.

I learnt:
- How to pull data from an [external API](https://the-trivia-api.com/) inside an asynchronous function
- Applying Tailwind CSS for styling a responsive interface
What is the way to get sucess after becoming a developer but without any graduation.
Tags: programming, flutter, dart, fullstack
Published: 2024-02-17 17:49:11

Hey! I'm 16 year old kid and I have learnt flutter and dart even I have made an application name is FarmYara [https://play.google.com/store/apps/details?id=com.global.farmyara](url) but I want to know that how I can get quick success because some peoples are demotivating me that if you will not graduate and just focus on this developing stuffs without any kind of graduation you will not get success. Is it really true or I can success. I know it depends upon me I get success or not but taking suggestion from experience people help alot so tell if you have any thoughts regarding this.
Stunning Pendulum Animation Crafted with HTML+CSS: A CodeParrot VS Code Extension Masterpiece
Tags: html, css, webdev
Published: 2024-02-17 17:35:35

{% codepen https://codepen.io/soniya1/pen/abMMzPG %}
This pendulum animation, designed with HTML and CSS, showcases the elegance of pure CSS animations and the versatility of HTML for creating visually appealing web components. Crafted using the _**CodeParrot VS Code extension**_


**HTML Structure:**

- The .base class creates a central container for the pendulum.

- Inside .base, there are several elements: .holder for the attachment point of the pendulum, .thread for the string or rod of the pendulum, which contains .knob at the top and .pendulum at the bottom as the weight, and finally, .shadow to simulate the pendulum's shadow.

**CSS Styling:**

- _Global styles_ reset (*) ensure consistent styling by setting margin, padding, and box-sizing to their base values.
- _The .base_ class styles the main container, setting its width and creating a top border to simulate the ceiling or support structure.

- _.holder_ is styled to look like the fixture from which the pendulum hangs.
- _.thread_ represents the pendulum's string, with its movement animated by keyframes.
- _.knob_ and .pendulum are styled to represent the top attachment and the bottom weight of the pendulum, respectively, with specific shapes and colors.
- _.shadow_ is styled to mimic the moving shadow of the swinging pendulum, enhancing the realism of the animation.

**CSS Animations:**
- _moveIt Animation:_ Applies to the .thread to create a swinging effect. The keyframes rotate the element from one side to the other, simulating the pendulum's motion.
- _moveShade Animation:_ Targets the .shadow, simulating the movement of the pendulum's shadow across the floor. This animation alternates and loops infinitely, matching the pendulum's swing with horizontal movement and blur effects.

The use of border-radius, gradients, and subtle border styling on the pendulum and knob adds depth and a more realistic appearance.
The shadow's animation includes scaling and blurring effects to mimic the changing perspective and focus as the pendulum swings.

This pendulum animation is not just a demonstration of HTML and CSS capabilities but also highlights the practicality of using the **_CodeParrot VS Code extension_** for web development. The extension's efficiency and developer-friendly features streamline the coding process, allowing for the creation of intricate animations and designs with ease.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snpdviqjrwno95pli0qu.png)
Você entende JSX?
Published: 2024-02-17 17:33:15

Você consegue entender a sintaxe abaixo?

A constante "elemento" não é uma string, não é um array, não é um número, não é undefined, e nem qualquer outro tipo convencional do javascript. Ele é (ou irá se tornar) um objeto

E é por isso que você deveria olhar mais a fundo nos framework JS (neste post falaremos sobre React) e entender exatamente como funcionam!

Quando escrevemos código React, estamos criando uma cópia do nosso DOM, chamada de virtual DOM. Entenda este ambiente como sendo nosso ambiente de desenvolvimento, que mais tarde irá ser traduzido pro DOM propriamente dito

Quando você escreve código JSX, a sintaxe abaixo será traduzida para um elemento React

A sintaxe abaixo poderia ser traduzida para a função React.createElement("button", {}, "Botão")

A partir disso, todos os seus elementos JSX vão ser traduzidos para objetos Javascript normais, com propriedades. Com toda essa árvore criada, é hora de criar o nosso DOM "real"

O ReactDOM irá criar todos os seus nós, baseados na propriedade type. E aí que realmente tudo isso é transformado em códigos HTML. Lembra quando fazíamos document.createElement() no Javascript? É, entre muitas aspas, isso que fazemos com todos os elementos que criamos no React

Você já conhecia como funcionava o React em seus detalhes?
Cursor: The AI-First Code Editor Revolutionizing Development Efficiency
Tags: ai, programming, productivity, learning
Published: 2024-02-17 17:09:10

also read this on [Medium](https://medium.com/@sanjayxr/cursor-the-ai-first-code-editor-revolutionizing-development-efficiency-ad5c4926016f) , [Codenewbie](https://community.codenewbie.org/sanx/cursor-the-ai-first-code-editor-revolutionizing-development-efficiency-3pk2)

**Introduction**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f6vvmwyq0pmbxgpdx8k5.png)

[Cursor Code Editor](https://cursor.sh/) is an AI-powered code editor that's a fork of VS Code. It integrates GPT-4 and GPT-3.5 and features a privacy mode, ensuring that code is never stored anywhere other than the user's machine and will not be used for training. 

**Features**
This code editor features an integrated AI accessible within the interface. Unlike other editors like VS Code, which rely on AI extensions, Cursor comes with AI built-in. Transitioning from VS Code to this IDE is seamless, as it allows for easy importation of all previously used extensions. For more features, you can check out this  [link](https://cursor.sh/features#docs).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/io79guwminichvffqlmc.png)

Its UI closely resembles that of VS Code, making it familiar to users.

**Ctrl K**
The Ctrl K command facilitates code editing and writing with the AI.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvrmmqkt673fg3zdgm14.png)

Users can request necessary code directly in the chat, with the AI generating the code directly within the editor.

**Ctrl L**

Additionally, a separate chat feature is available for clarifying doubts and finding bugs. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ukdaoabnaas8c0ccwys.png)

**Conclusion**
In my opinion, Cursor IDE has the potential to significantly improve productivity and save time for developers. While AI won't replace programmers, those who leverage AI tools can potentially outperform others. I encourage everyone to give it a try.
(1/n) My adventure of implementing Redis in Rust
Tags: rust, redis, learning, programming
Published: 2024-02-17 16:52:53

## Where is the idea comes from?
Lately I got an email from a big sized company HR providing some open positions, and one caught my eyes. A position in a team that builds **a global low-latency key-value data store**.

That's the story where is the idea of trying to implement redis from start came in. Of course there was a background that why this topic interests me (Like following Phil Eaton, seeing his database related contents) but I won't dig deeper.

## Searching for resources
So I started looking around for resources to get an idea about how to do it. Luckily after spending some time staring [redis codebase](https://github.com/redis/redis) I found CodeCrafters, and their redis course.

Good to mention for time being I'm not sponsored by CodeCrafters, I was using their campaign while writing this. I didn't even paid for it :D

## Found the resource, let's start!
CodeCrafters supports multiple programming languages, but in between them I was interested in Rust and C#. But this time I'm choosing Rust. I flipped a coin to decide in between btw.

Following the course is easy, it doesn't even require any git knowledge at all. You complete the task, push it to the remote and they test and mark the step as passed.

In past I was using Exercism which followed a similar route, I think they were using a cli for this but git way of doing this is not bad as well.

## End of the entrance post...
This one was the beginning of the journey, I am not planning to write for every small detail but while I go further in the course I will take notes here about the interesting and time consuming topics. 

My goal is leaving notes for myself but you're always welcome to read and suggest better way of doing things!
How to find the right partners for your project
Tags: startup, tutorial, discuss, productivity
Published: 2024-02-17 16:47:17

When you’re trying to find the perfect people to work with on your project, it can feel like searching for a special kind of rock on a big beach. But don’t worry, we’re here to guide you to makes this search easier.

The Problem: Too Many Choices, Not Enough Quality
It's tough to find the right partners because there are so many people out there, and it's hard to know who's serious and who's not. Plus, some folks might not have the skills or commitment you need for your project.

Solution: A Place for Serious Pros
[Craftit.site](https://www.craftit.site/) is a platform for people who are serious about their work:

1. Quality First:
We focuses on making sure everyone in the community is top-notch. That means you won’t waste time talking to folks who aren’t serious or skilled enough for your project.

2. Find What You Need:
You can post exactly what kind of partners you’re looking for on your project – like what skills they need or how much experience they should have. This helps you find the perfect match.

3. Trustworthy

We checks everyone’s profiles to make sure they’re real and reliable. So, you can trust that the people you meet there are the real deal.

4. Pitch your project:
You can [pitch](https://www.craftit.site/pitch) your project and let people know what you’re trying to build. This way, people who interested can find you instead of you hunting them down.

Ready to bring your project to life?
visit [Craftit.site](https://www.craftit.site/)
How to find well-planned projects to join
Tags: discuss, startup, devops, tutorial
Published: 2024-02-17 16:37:24

Are you tired of sifting through project ideas that seem like they were scribbled on a napkin? Finding well-planned projects can feel like finding a hidden treasure. But fear not, I'm here to guide you through the process.

The Problem: Lots of Messy Ideas
In a world where anyone can pitch an idea online, it can be overwhelming to find projects that are well-thought-out and ready for action. Many projects are pitched by Unexperienced people wich lack clarity, feasibility, or a solid plan, making it hard to take it seriously and investing your time on.

Solution: A Place for Thoughtful Projects
[Craftit.site](https://www.craftit.site) is a platform for projects that have been carefully crafted and planned:

1. Only the Good Stuff:
We makes sure only projects with clear goals and solid plans get on the platform. That means you won't waste time on projects that are all over the place.
Before projects go live, they get checked out by admins . This helps make sure they're good to go and have everything they need to succeed.

2. All the Details:
Each project on the platform has a clear description, so you know exactly what it's about and what's needed to make it happen. No more guessing games!

4. Trustworthy People:

We checks everyone's profiles to make sure they're real and reliable. So, you can trust that the people who pitch are the real deal.

Ready to Find Your Next Project?

give [Craftit.site](https://www.craftit.site) a try!