teleren/devto huggingface dataset:
Array Mutation Methods in JavaScript
Tags: javascript, coding, algorithms, datastructures
Published: 2024-03-15 18:35:05

## Introduction
Mutating is the concept of changing the assignment of a value in Javascript.

```JavaScript
const fruits = ['apple', 'banana', 'cherry']; // arr = ['apple', 'banana', 'cherry']
fruits.push('date'); // arr = ['apple', 'banana', 'cherry', 'date']
```

Certain array methods in Javascript mutate the original array. This may lead to unintended consequences in your code if you're not cautious when using such methods.

```JavaScript
const fruits = ['apple', 'banana', 'cherry']; // arr = ['apple', 'banana', 'cherry']
const newFruits = arr.push('date'); // arr = ['apple', 'banana', 'cherry', 'date']
```

In the example above, `newFruits` is intended to be a copy of `fruits` with the value of `dates` added, however the `push` method mutates the original array, leading to `fruits` being mutated and the `newFruits` assignment likely being redundant.

Mutation is not inherently bad; there are times in which we likely want to mutate an array without keeping a reference to the original array.

```JavaScript
const flowers = ['lilac', 'daisy', 'rose']
flowers.sort();
```

In the example above, you can imagine a list of flowers a user is adding in no particular order but would like to see in alphabetical order. We don't care to store the unsorted list in this scenario, so we can mutate the original array.

## Mutating Methods
The following is a list of methods that mutate an array:

1. `copyWithin`: Copies part of the array to another location in the same array
2. `fill`: Changes all elements within a range in an array to a static value
3. `pop`: Removes the last element from an array
4. `push`: Adds the specified elements to the end of an array
5. `reverse`: Reverses an array
6. `shift`: Removes the **first** element from an array
7. `sort`: Sorts an array
8. `splice`: Removes or replaces existing elements and/or adds new elements
9. `unshift`: Adds the specified elements to the beginning of an array

In general, methods that mutate change the array's length or the values at particular indices of the array.

## Resources
[Does it Mutate](https://doesitmutate.xyz/) is an excellent resource which lists array methods in JavaScript, provides, examples, and classifies each one as "mutates" or "no mutation".

[mdn web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#copying_methods_and_mutating_methods) provides a comparison table of mutating methods and their non-mutating alternative, if one exists.

## Conclusion
While the concept of mutation of arrays in JavaScript warrants merit, often it can lead to error-prone code if an array-mutating method is used unintentionally. If you're finding that values in your arrays in your code are inexplicably changing, you may have an array-mutating method in use. It's worthwhile investigating, and if find this is your case, set up testing around this functionality to prevent regression.
What Is the Difference Between Bad Code and Good Code?
Tags: programming, productivity, career, learning
Published: 2024-03-15 18:33:16

_How do you know if code is good or bad?_

Code. It's the lifeblood of your software, yet it can also be the source of endless headaches. What's the difference between good code and bad code?

The answer lies not in personal preference, but in the cold, hard reality of what makes code work for your business.

My another blog post dives into the battlelines of bad code vs. good code, revealing the hidden costs of a messy codebase and the powerful benefits of well-crafted software. Get ready to understand how code quality directly impacts your team's efficiency, your product's success, and ultimately, your bottom line.

Let's explore the difference between bad and good code together: 
👉 [What Is the Difference Between Bad Code and Good Code?](https://iwooky.substack.com/p/difference-between-bad-code-and-good-code)


[![What Is the Difference Between Bad Code and Good Code?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bi00d2e8cpzgxd5qbl1.jpg)](https://iwooky.substack.com/p/difference-between-bad-code-and-good-code)
Concept of Life
Tags: life, webdev, lifesearch, meaning
Published: 2024-03-15 18:16:18

Life! What is life? Does anyone know, please do tell me because I dont wanna  go and read a million books and pieces of advice or whatever resource there is available for finding the meaning,  because I am a bit confused:
*Dilemma*: Sometimes it feels like some battle, sometimes it feels like a game and sometimes it's really hard to wrap my head around it. What it could possibly mean? I mean one second before I am alive and the next minute bamm! I could be d**d, and how is this logical, you know where I get confused is here only that such complex collective conciousness can get lost in a jiffy and that also by such petty means and can go completely invisible the next second, I mean this certainly does not make a lot of sense, not after we created quantum physics. I mean how can a mind that uncovered and understood quantum physics convert into dust, into nothingness, doesn't make a lot of sense to me atleast, tell me your thoughts I am more interested in yours:) also because I wanna know.
What I know now, that would have accelerated getting my first job.
Tags: career, community
Published: 2024-03-15 18:06:23

I want to share a testimony on how I was able to transition into the tech industry in hopes that this inspires and motivates others.

After 20 years of working two jobs, just to be poor, I started to attend tech events. Incredibly, the people I met showed me another life. I didn’t know that people, similar to my background, could work just 40 hours, take sick leave (total shocker), and do something that they enjoyed doing on the weekends for free. AKA, I wanted an opportunity for a better life worth living.

My first job in tech came from a referral. That referral came from being an active part of my local tech community. This included:

- **Learn in public.** I strived for 3 years to build 12 projects a year in public. People watch my ideas grow from design to deployment.
- **Say “Yes” to every opportunity to volunteer.** Someone mentioned being a TA at a tech boot camp, I said Yes. Someone mentioned volunteer leadership to set up meetups, arrive first, shake hands, find speakers, and a dozen other tasks. I said Yes.
- **Find opportunities to work with and engage others.** I attended (and lost) dozens of hackathons. I’ve attended hundreds of tech meetups. I've given several tech talks. I’ve been to tech conferences. I’ve paired-programmed with others for thousands of hours.

AKA, I sincerely believe that the referral came from me showing the world my worth, moving away from the computer to meet others, and giving a lot of myself to the community. All of this before the referral was even considered. **Give God (or the universe) something to bless.**

A few things I know now that I wished I had known earlier:
- **A tech role isn’t about being the best coder.** 75% of the job is communication and working with others. I wish I’d spent more time practicing my communication skills and working on group projects.
- **There are different types of work experiences.** I wished that I hadn’t spent several years just coding. Instead, I should have been seeking opportunities to work on remote teams, open source contributions, freelance with others (share the load, not about the money), and anything that creates value.
- **Your network is equal to your net worth.** I’m quiet, scared of people, and like being alone. Nothing in that sentence has helped me in any shape or form. I wished I had spent more time meeting people and making connections than coding. Coding is safe, but not the only requirement for a tech career. The number of people who know you, who can vouch for you, who will listen to you, and who are willing to talk about your achievements when you aren’t in the room is the single biggest career factor.

So friends, please share your thoughts on the following questions in the chat:
1. What can tech professionals do to get referrals?
2. What do you know now that you wished you knew earlier?
TCF Pro Conference Slides 2024
Published: 2024-03-28 13:10:32

---
title: TCF Pro Conference Slides 2024
published: true
date: 2024-03-15 18:06:00 UTC
tags: 
canonical_url: 
---

[ https://www.slideshare.net/slideshows/tcfpro24-building-realtime-generative-ai-pipelines/266807785](https://www.slideshare.net/slideshows/tcfpro24-building-realtime-generative-ai-pipelines/266807785)
CSS Responsive Image Overlay
Tags: codepen, webdev, css, javascript
Published: 2024-03-15 17:45:22

<p>This is a CSS Responsive Image overlay loader with blurred main content, simply paste the code in a javascript file and call it anywhere, like API call, on page load, and remove when any task is done.</p>

{% codepen https://codepen.io/sameech/pen/zYXKJGe %}
90 Days Challenge : Learning Data Science 2024
Tags: datascience, challenge, beginners
Published: 2024-03-15 17:43:55


<center><b>

Introduction
</b></center>

---

In your daily activities u've been waking up and scrolling the whole time, switching from one app to another. Spend a lot of time on social media meaning this media accounts have your basic data from name, when you frequently use there app. They collect and analysed that **DATA** Time Spent on certain social media and general over view of social media this has drained my thoughts...
![My letter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8vyuzp19qrm94g1gqru.jpeg)

### Day_1

I have read through how Venn Diagram Data Science [Venn Diagram](http://drewconway.com/zia/2013/3/26/the-data-science-venn-diagram) yes, on my desk i have a lot. 

I have understood Data science is a discipline,and a pivot domain of data. One is you cant wake up today and be a data scientist but maybe I can, even in 24 hours but is it even realistic?

Today I've covered what I anticipate to learn. 

Data Science is Discipline of three Mix:
                

> - Mathematics Techniques 
> - Algorithms 
> - Visualization



> "Understand the tools, libraries, framework,how modules work, and principals in it" Joel Grus 


There is Data Cycle : that involves the daily or the track of a data scientist 

---

On This Journey i will cover

>- Python 
>- Basic Mathematics(Algebra, Statistics, and Probability)
>- The EDA (Collecting, explore, clean, munge, and manipulate data)
>- ML(machine learning)
>- Models - k-nearest neighbor
>- NLP, recommender system and Database 

---
#### It's a cycle:

- Understand, find insights, patterns and trends in datasets
- Know and when to apply and use algorithms and data models
- Get the know-how of machine learning techniques
- Get your way-around with Python, and SQL
- Read Articles  

From [simpli learn](https://www.simplilearn.com/tutorials/data-science-tutorial/what-is-data-science)

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




I will be documenting My Learning and Challenge task on my Github https://github.com/kipkosgeii/90-Day-Challenge
Do anyone wants to contribute?
Tags: vercel, python, beginners, webscraping
Published: 2024-03-15 17:35:16

## Hey guys, 

Actually few weeks ago I built my portfolio but the thing is I want to display all my featured post. So Now, I decided to make an API of my own that uses bs4 to scrape my featured post from my profile. Do anyone wants to help?

### Link To Github Repo : https://github.com/vivek09thakur/LinkedIn-Scraper-API
Nasted Incus in WSL2
Tags: nasted, incus, lxc, containers
Published: 2024-03-15 15:50:04

Incus merupakan perisian linux container fork dari lxd. ia sebahagian daripada Linuxcontainer.org , manakala lxd dahulunya merupakan projek kerjasama antara Linuxcontainer dan Canonical. Namun begitu, lxd telah diambilalih oleh syarikat Canonical dan berpisah dengan Linuxcontainer.Boleh baca di [sini](https://linuxcontainers.org/lxd/) 


1. Create satu container 

```
incus launch images:debain/12 cluster1
```

2. Set security.nesting true, security.privileged true

```
incus config set cluster1 security.nesting true
```

```
incus config set cluster1 security.privilegde true
```
3. Install sekali lagi incus dalam container clouster1 tadi. 
```
curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc
```

```
sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
Components: main
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/zabbly.asc
EOF'
```

```
apt-get update
```

```
apt install incus
```

4. Setelah selesai install incus dalam cluster1. Cluster ini dijadikan sebagai backup untuk cipta beberapa cluster lain. 

5. Copy cluster1 kepada cluster-utama 

```
incus cp cluster1 cluster-utama

```



Masukkan command ini dalam .wslconfig 

```
kernelCommandLine = cgroup_no_v1=all to .wslconfig

```

bersambung
Devin, First AI Software Engineer.
Tags: ai, softwareengineering, softwaredevelopment, developers
Published: 2024-03-15 17:18:26



Devin is an AI tool developed by Cognition has access to all the same developer tools;
-Its own command line.
-Its own editor.
-Its own browser.

Devin has the ability to: 
create code, test it, learn form its mistakes, solving problems, push the project to Github repo and can create new brushes do pull request if in need!
 Not just these, also if Devin run into error it fix and go on.🚀

It's designed to help, software engineers and who can solve problems not replace them but surely it's not good news for coders.

Finally Its an AI tool it can't discern what the client want and need perfectly as humans engineers but we should be excellent in command prompts to get best results enhance our output quality goals.

[Devin link
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2zlajf7kdl3hv7nwdf6.jpg)k](https://preview.devin.ai/)
How do you balance code completeness, security, and maintainability when creating example code?
Tags: discuss, security, softwareengineering, cloud
Published: 2024-03-15 17:17:53

---
title: How do you balance code completeness, security, and maintainability when creating example code?
published: true
description: Discussion prompt around balancing code completeness, security, and maintainability in samples. 
tags: discuss, security, softwareengineering, cloud
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-03-15 16:48 +0000
---

My team often discusses how to present code samples effectively. We want to strike a balance between providing helpful, runnable (and fun!) examples and avoiding repetitive yet more secure boilerplate code. 

Should you include comprehensive security and reliability features (like rate limiting or observability) in samples, even when those aren't the primary focus? 

Another example of this is whether to use frameworks like Express and libraries like express-rate-limit. These can streamline implementation, but also potentially add complexity. 

## Why does this matter?

* **Security** Omitting safeguards like rate-limiting may cause issues for folks who copy pasta these samples straight into use. (Check out this [OWASP resource](https://cheatsheetseries.owasp.org/cheatsheets/Denial_of_Service_Cheat_Sheet.html) on Denial of Services to understand why you'd want to have rate limiting as an example.)
* **Maintainability** Repeating these code blocks creates maintenance overhead. 
* **Clarity** Focusing on the core concept improves readability. 

I'd love to hear from others on this topic and hopefully spark up some conversations around common methodologies we could approach this as a community. 

1. How do you approach demonstrating concepts in code samples with regards to completeness and security?
2. What are your preferred ways to manage common concerns like authentication and rate-limiting in a way that promotes reusability?
3. How do you balance the use of frameworks/libraries with the goal of keeping samples clear and focused?
4. What strategies do you employ to ensure consistency in code standards across your teams?
Exploring the World of Evoplay Entertainment: A Guide to Free Demo Play
Published: 2024-03-15 17:11:58

Evoplay Entertainment has carved a unique niche in the gaming industry, offering an array of captivating and innovative online casino games. For those eager to dive into the world of gaming without the initial investment, Evoplay provides an enticing solution through their free demo play feature available at Evoplay's Games Collection.

The free demo play is a standout feature that allows both novices and seasoned gamers to explore Evoplay's diverse catalog without the risk. This includes an extensive range of slots, table games, and instant games that are known for their stunning graphics, immersive soundtracks, and innovative gameplay mechanics.

One of the highlights of Evoplay's offering is its commitment to innovation, particularly through the use of HTML5 technology. This ensures that all games are mobile-friendly and can be played on any device, providing a seamless gaming experience whether at home or on the go. The free demo mode available on their website is a testament to their user-friendly approach, allowing players to familiarize themselves with the mechanics and features of each game before placing real bets.

The demo play is not just for new players; even experienced gamers can benefit from this feature. It provides an opportunity to try out new strategies or explore games outside of one's comfort zone without any financial commitment. This can be particularly beneficial with Evoplay's array of slots that vary significantly in terms of themes, volatility, and bonus features.

Moreover, the free evoplay play demo platform is a valuable resource for understanding the intricacies of less familiar games like Sic Bo, Teen Patti, or Andar Bahar. Players can learn the rules and develop their strategies without the pressure of losing money.

In conclusion, Evoplay's free demo play is a golden opportunity for gamers to explore a diverse and innovative game portfolio. Whether you are a beginner looking to understand the basics or a seasoned player keen on mastering new games, the demo feature at Evoplay is your gateway to a risk-free gaming adventure. Visit Evoplay's Games Collection to start your journey into the exciting world of online casino games without any strings attached.
Validating a Supabase JWT locally with Python and FastAPI
Tags: supabase, jwt, python, fastapi
Published: 2024-03-15 17:06:36

---
title: Validating a Supabase JWT locally with Python and FastAPI 
published: true
description: 
tags: supabase, jwt, python, fastapi 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-03-15 15:03 +0000
---

Supabase is nice, but the functionality it provides for verifying tokens (`auth.get_user`) for some inexplicable reasons makes a round trip to their end, and this trip in fact takes quite a while (up to 600ms).

JWT tokens should by their very nature be verifiable locally, provided we know the secret. Luckily Supabase does expose this JWT secret under project settings.

Here's how a FastAPI dependency to get user email and verify their authenticity using the token alone might look like:

```python
import jwt
from fastapi import Depends, HTTPException, status
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer

from katalystai.conf import SETTINGS



async def get_user_email(
    res: Response,
    cred: HTTPAuthorizationCredentials = Depends(HTTPBearer(auto_error=False)),
):

    if cred is None:
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Bearer authentication required",
            headers={"WWW-Authenticate": 'Bearer realm="auth_required"'},
        )

    try:
        jwt_result = jwt.decode(
            cred.credentials,
            SETTINGS.supabase_jwt_secret,
            audience="authenticated",
            algorithms=["HS256"],
        )

        return jwt_result["email"]
    except jwt.exceptions.PyJWTError:
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Invalid authentication credentials",
            headers={"WWW-Authenticate": 'Bearer realm="auth_required"'},
        )
```

We can then use this "middleware" like so:

```python
from fastapi import Depends
from katalystai.auth import get_user_email

@router.post
async def create_thing(user_email: str = Depends(get_user_email)):
    pass
```

Supabase python client overall is not that nice, it's kinda slow and unreliable. I also suggest switching to another ORM and communicating with Postgres directly instead of using their community python client. I had luck using `tortoise`, which has excellent async support and clean Django-like API.
Learning AWS Day by Day — Day 6 — EBS(Elastic Block Storage)
Tags: aws, webdev, cloud, cloudcomputing
Published: 2024-03-15 16:46:49

Exploring AWS !!

Day 6:

Elastic Block Storage (EBS)

One physical volume divided into multiple logical volumes. It is the backbone for EC2. In an EBS block level storage, server-base OS connects with raw volumes which are created through fiber channels.
Then they are used as individual disks, and if its versatile it can be used as file storage, database storage and virtual machine volumes.
An EC2 volume is directly connected to EBS, while the instance is running, a volatile memory called ephemeral storage will be attached to instance. If instance is stopped, the ephemeral memory will be detached.

EBS Concepts:

It is a raw unformatted block level storage, it is exposed as raw device to EC2 instance.
EBS volumes persist independently from life of EC2 instance.
An EBS volume is automatically replicated within AZ.
Throughput — It is sequential transfer rate that an SSD or HDD will maintain continuously.
IOPS — measure of number of I/O operations a drive, SSD or HDD can handle per second with each block being read from or written to RANDOM location to disk.

Volume Types:

GP2 (General Purpose SSD) — size 1 GB — 16 TB
— Baseline performance is 3 IOPS/GB with minimum of 100 IOPS and a maximum of 10000 IOPS.
— Maximum burst performance is 3000 IOPS.
— Maximum throughput per volume 160 Mbps.

IO1: Provisioned SSD — size 4 GB — 16 TB
— From 100 to 32000 IOPS can be provisioned.
— Maximum throughput 500 Mbps.

ST1 Throughput Optimized HDD — size 500 GB — 16 TB
— Baseline performance 40 Mbps per TB with maximum of 500 Mbps per volume.
— Burst performance is 250 Mbps per TB with maximum of 500 Mbps per volume.

SC1 Cold Storage HDD — size — 500 GB — 16 TB
— Baseline performance 1 2Mbps per TB with maximum of 192 Mbps per volume.
— Burst performance is 80 Mbps per TB with maximum of 250 Mbps per volume.


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