teleren/devto huggingface dataset:
Javascript .splice() vs .toSpliced()
Tags: webdev, javascript, tutorial, programming
Published: 2023-12-27 15:00:32

In this tutorial, we will learn how **.toSpliced()** method can be handy. 
You might have used JavaScript array splice method.

Lets have a look at how **.splice()** works then we will understand how **.toSpliced()** is different from it.

## Splice
We can use splice when we want to remove some item from array.


_Below code example shows what happens when we remove array items using .splice()._
![Removing items using splice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6sl0qomsqkoatzg6jh3e.png)

_Below code example shows what happens when we add array items using .splice()_.
![Adding items using splice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2mhejm3qspju733qo8p.png)

One thing which is important to notice here is, arr.splice() always returns removed Items.
You can also add and remove items at the same time but the output of arr.splice() will always be removed items.

And it modifies the actual array.

## toSpliced

Array .toSpliced() also accepts the same parameter as .splice().
But the first difference is it won't modify the original array instead it will return the updated array.

_Below code example shows what happens when we remove array items using .toSpliced()._

![removing items using .toSpliced()](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ie3ex79ljnccue49fui.png)

_Below code example shows what happens when we add array items using .toSpliced()_.


![adding items using toSplice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6p1hwkv5ew1igtl8ypb.png)
Beginner's TypeScript #10
Tags: programming, beginners, typescript
Published: 2023-12-27 15:00:00

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

⭐ **Passing Type Arguments** ⭐

In this example, we will work with the Set data structure from JavaScript.

Here we are creating a set of guitarists and adding **Jimi Hendrix** and **Eric Clapton** to it.

```ts
const guitarists = new Set();

guitarists.add("Jimi Hendrix");
guitarists.add("Eric Clapton");
```

We expect an error to be thrown when we try to add a **non-string** to the set.

However, our error is not being thrown because the **guitarists** set is not strictly typed as a set of strings.

We see this same issue when hovering over the **guitaristsAsArray** variable inside of the array test:

Hovering shows us that **guitaristsAsArray** is an **unknown** array.

We will figure out how to update **guitarists** to be typed a set of strings.

👉 **Solution:**

We can pass in a type argument to the Set to tell it what type it should be:

```ts
const guitarists = new Set<string>();
```

When the argument is in place, we can only add items of that specific type.

This also enables useful things like hovering over **guitarists.add()** and seeing that it expects a string.

✍️ **Digging Deeper:**

We can pass in type arguments as well as function arguments to certain functions.

In this case, since Set is a class that we are instantiating, we can command-click or right-click and say **"Go to Definition"**.

Double-clicking takes us to a file called lib.es2015.collection.d.ts which is where certain parts of JavaScript are typed out.

There is an interface for Set that starts like this:

```ts
interface Set<T> {
```

That **T** represents the type argument.

Back in our solution code, if you erase the type argument and go back to just **Set()**, hovering over it will show you that it is typed as **Set<unknown>**.

Lots of JavaScript constructs and popular libraries use this.

🫶 **Another Example:**

Let's create a new Map and pass a string as a type argument:

```ts
const map = new Map<string>()
```

Now when we hover, we see the following:

```ts
Map<any, any>
```

This is because Map accepts two types of arguments: the first is the key, and the second is the value.

If we wanted to create a map where the keys and values were both strings, it would look like this:

```ts
const map = new Map<string, string>()

map.set('someKey', 'someValue')
```

Changing **someKey** to a number would now give us an error.

This concept of passing type arguments to certain functions and constructors and classes is crucial for understanding TypeScript as a whole!

---

I hope you found it useful. Thanks for reading. 🙏

Let's get connected! You can find me on:

- **Medium:** https://medium.com/@nhannguyendevjs/
- **Dev**: https://dev.to/nhannguyendevjs/
- **Hashnode**: [https://nhannguyen.hashnode.dev](https://nhannguyen.hashnode.dev/)/
- **Linkedin:** https://www.linkedin.com/in/nhannguyendevjs/
- **X (formerly Twitter)**: https://twitter.com/nhannguyendevjs/
Alternatives to Pull Requests
Tags: pullrequest, trunkbaseddevelopment, alternatives
Published: 2023-12-27 14:55:26


---
title: Alternatives to Pull Requests 
published: true
description: Alternatives to Pull Requests
tags: pullrequest,trunkbaseddevelopment,alternatives
canonical_url: https://jessewarden.com/2023/12/alternatives-to-pull-requests.html
cover_image: 
---

If you’re tired of reviewing PR’s, you have other options. I’ll list some of the tradeoffs, but they’re worth a try if you’re losing patience and feel PR’s are taking too much time and break focus.

Check into main/trunk instead of making branches
------------------------------------------------

<https://minimumcd.org/minimumcd/#trunk-based-development>

**Pros**: No more branches, no more merge fiascos, faster delivery of code assuming your main branch is pushed to some higher environment.

**Cons**: Git still can merge things automatically that are wrong, team has to take initiative to review code on their own, often having to “catch up on their reading”. If you don’t have good types and automated tests, this can wreak havoc. Small evidence shows TBD can stress out mid to junior developers vs opposite for seniors.

**Option**: Continuous Code Review
https://thinkinglabs.io/articles/2023/05/02/non-blocking-continuous-code-reviews-a-case-study.html

Pair Programming – 2 coders at 1 keyboard
-----------------------------------------

[https://en.wikipedia.org/wiki/Pair\_programming](https://en.wikipedia.org/wiki/Pair_programming)

**Pros**: Code is designed & reviewed in real-time. Evidence shows it sometimes is more efficient having 2 developers working on 1 task vs “2 coders doing 2 tasks at the same time” as well as better quality code.

**Cons**: Team has to swap roles & rotate on a schedule so same 2 devs don’t get paired. Some devs don’t like other certain team members. Some devs want to get into flow state alone. Can be extremely tiring for some devs despite them enjoying it.

**Option**: Doesn’t have to be everyday, all day.

Mob Programming – entire team at 1 keyboard
-------------------------------------------

<https://thinkinglabs.io/articles/2023/05/02/non-blocking-continuous-code-reviews-a-case-study.html>

**Pro**: Similar to Pair, but task truly is a “team effort”; entire team takes responsibility for a feature, code reviewed in real-time, entire team possibly “knows that section of the code base”.

**Cons**: Same for pair programming, but sometimes worse. Entire team can be deadlocked on an argument (aka “hung jury”), and make no progress; tradeoffs for having an arbiter.

**Options**: Attendance is not required, and people can drop out as needed (meetings, errands, build failure on other team, etc).
"Binários em 1984": Uma Viagem Ludicamente Distópica pelos Bits
Published: 2023-12-27 14:45:00

Bem-vindo à nossa jornada através dos corredores binários de um universo à moda de "1984". Embarcaremos em uma exploração lúdica dos operadores binários, onde a informação é tão controlada quanto nos escritos de George Orwell. Vamos mergulhar nas entranhas dos bits, trazendo um toque de humor e reflexão sobre o controle da informação.

## 1. Atribuição de Bits: Pensamentos Duplos e Duplos Pensamentos

```pseudo
inteiro PensamentoDuplo = 0b1100;  // Pensamentos binários duplos, a verdade em bits
inteiro DuploPensamento = 0b1010;  // Duplos pensamentos binários, a perspectiva alternativa
```

Nossa história começa com pensamentos duplos e duplos pensamentos, representados em bits. Cada bit é um fragmento da verdade, esperando ser moldado à nossa vontade.

## 2. Operações Bit a Bit: Uma Dança de Verdades

### AND Bit a Bit: O Partido dos Bits Controladores

```pseudo
inteiro VerdadeEstrita = PensamentoDuplo AND DuploPensamento;
```

No balé binário, o operador AND é como o Partido dos Bits Controladores. A verdade só se manifesta quando ambos os lados concordam, criando uma coreografia rígida de bits.

### OR Bit a Bit: A Rumba dos Fragmentos Verdadeiros

```pseudo
inteiro VerdadeAmpliada = PensamentoDuplo OR DuploPensamento;
```

Na pista de dança binária, o OR é uma rumba de fragmentos verdadeiros. Cada bit contribui para uma Verdade Ampliada, uma dança harmoniosa de perspectivas.

### XOR Bit a Bit: A Revolta Sutil da Dança Binária

```pseudo
inteiro RevoltaSutil = PensamentoDuplo XOR DuploPensamento;
```

A revolta sutil acontece no XOR, onde bits divergentes dançam uma dança de resistência. É a reviravolta inesperada na coreografia binária.

## 3. Deslocamento de Bits: Moldando a Narrativa Binária

### Deslocamento para a Esquerda: Peso da Informação na Pista

```pseudo
inteiro NarrativaPonderada = PensamentoDuplo << 2;  // Desloca 2 bits para a esquerda
```

Na pista de dança binária, deslocar para a esquerda é como dar peso à narrativa. Os bits se movem com elegância para posições mais significativas, dominando a coreografia.

### Deslocamento para a Direita: Reduzindo a Influência na Dança Binária

```pseudo
inteiro InfluenciaReduzida = PensamentoDuplo >> 1;  // Desloca 1 bit para a direita
```

Reduzir a influência na dança binária é sutil como um passo para a direita. Os bits se movem graciosamente para posições menos significativas, diminuindo sua influência na coreografia.

## Conclusão: Uma Dança Binária sob o Olhar Atento de 1984

Em nosso espetáculo binário inspirado por "1984", os operadores dançam na pista da informação controlada. Cada operação é um passo, uma revolta ou um redemoinho na dança binária, moldando uma narrativa única. Enquanto nos divertimos com os bits, também refletimos sobre o poder de controlar a informação, uma dança fascinante no palco binário, onde a verdade é apenas uma questão de perspectiva.
Do you already know Digestabot?
Tags: digestabot, chainguard, security, container
Published: 2023-12-27 14:32:05

In summary, Digestabot is a GitHub Action developed by Chainguard to keep your images always up-to-date, minimizing the risks of CVEs (Common Vulnerabilities and Exposures).

Using the 'tag+digest' pattern, the Action opens a Pull Request (PR) to update the image in use, and the user only needs to approve the merge with the most recent version(s), not only from Chainguard but also from any other registry used in the repository.

Consider the following configurations when utilizing Digestabot:

- Your images must follow the `<repo>:<tag>@sha256:<digest>` pattern. For example, `cgr.dev/chainguard/nginx:latest@sha256:81bed54c9e507503766c0f8f030f869705dae486f37c2a003bb5b12bcfcc713f`.

- You need to authorize GitHub Actions to create Pull Requests in the `Settings -> Actions` tab by selecting the option 'Allow GitHub Actions to create and approve pull requests.'

Now let's create the `digestabot.yml` file in the `.github/workflows` directory.

```yaml
name: Image digest update

on:
  workflow_dispatch:
  schedule:
    # Every day at 00:00 UTC
    - cron: "0 0 * * *"

jobs:
  image-update:
    name: Image digest update
    runs-on: ubuntu-latest

    permissions:
      contents: write # Write access to the repository
      pull-requests: write # Permission to create pull requests
      id-token: write # It's necessary to create the `JWT` token
    
    steps:
    - uses: actions/checkout@v4
    - uses: chainguard-dev/digestabot@v1.0.2
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        signoff: true # Add the email field to the commit
        author: update-bot # Set the author of the commit
        committer: update-bot@example.com # Set the committer email
        labels-for-pr: automated pr, kind/cleanup, release-note-none # Set the labels for the PR
        branch-for-pr: update-digests # Set the branch name for the PR
        title-for-pr: Update images digests # Set the PR title
        commit-message: Update images digests # Set the commit message
```

For more information about Digestabot, please access the Action's link on the [Marketplace](https://github.com/marketplace/actions/update-the-image-digest) or the [official repository on GitHub](https://github.com/chainguard-dev/digestabot).
When can I build up a website after starting an online business?
Tags: productivity, discuss, business, ai
Published: 2023-12-27 14:31:24

The timing of building a website for your online business can vary based on several factors. Here are some considerations that might help you determine when to start building your website:

**Validation of your business idea:** If you're in the initial stages of your business and are still validating your idea, you might want to start with a minimal viable product (MVP) or test the market through other means before investing in a website.

**Market research and planning:** Take the time to conduct thorough market research to understand your target audience, their needs, and preferences. Develop a comprehensive business plan that outlines your goals, strategies, and how your website fits into the overall business strategy.

**Brand identity and positioning:** Before creating a website, ensure you have a clear understanding of your brand identity, including your brand message, logo, color scheme, and overall brand positioning. These elements will need to be reflected in your website design.

**Product or service readiness:** Ensure your products or services are ready for launch or at least in a state where they can be showcased or sold. Your website will need content and images related to what you're offering.

**Resource availability:** Consider the resources needed to build and maintain a website. This includes budget, time, technical skills, and personnel. Determine whether you have the necessary resources or need to allocate them before starting the website development.

**Timeline and priorities:** Assess your timeline for launching the business and how crucial a website is for your initial launch. If it's a critical component, plan accordingly to have the website ready before the launch. If not, you might prioritize other aspects initially.

In general, having a website is essential for most online businesses, as it serves as a central hub for information, sales, and customer interaction. However, the exact timing can vary depending on your specific circumstances and business model. It's often beneficial to have at least a basic online presence early on to start establishing your brand and engaging with potential customers.
Explore Luxury with SUV Rental in Dubai
Published: 2023-12-27 14:25:20

Dubai, a city synonymous with opulence and grandeur, invites you to elevate your travel experience through SUV rentals. Discover the epitome of comfort, style, and adventure as you navigate the dazzling streets of Dubai in a luxurious **[suv rental in Dubai](https://amexcarsuae.com/)**.

Unleashing the Potential: SUV Rental Benefits
1. Comfort Redefined
Indulge in the lavish comfort of our SUVs, meticulously designed to provide a smooth and enjoyable ride. Feel the embrace of plush interiors and cutting-edge features as you cruise through the iconic landmarks of Dubai.

2. Versatility at Your Fingertips
SUVs offer more than just comfort; they provide unparalleled versatility. From family vacations to business trips, these vehicles adapt to your needs seamlessly. Experience the freedom to explore both the urban landscape and off-road terrains with confidence.

3. Safety First, Always
Prioritize safety without compromising on style. Our SUVs are equipped with state-of-the-art safety features, ensuring a secure journey for you and your loved ones. Feel empowered knowing that your travel experience is safeguarded by top-notch technology.

The Dubai Difference: Why Choose SUV Rental?
4. Exquisite Fleet Selection
Immerse yourself in a world of automotive luxury with our diverse fleet of SUVs. From iconic brands to the latest models, we offer a selection that caters to the most discerning tastes. Elevate your arrival at any destination with a vehicle that speaks volumes.

5. Effortless Booking Process
Your journey begins with simplicity. Our user-friendly online booking platform ensures a seamless and efficient reservation process. Choose the SUV that suits your preferences, select your rental dates, and embark on a hassle-free adventure in Dubai.

6. Tailored Experiences
We understand that every traveler is unique. That's why our SUV rental services are designed to cater to your specific requirements. Whether it's a chauffeur-driven experience or a self-drive adventure, customize your journey for an unforgettable Dubai experience.
Home Improvement & Design
Published: 2023-12-27 14:18:03

At Home Improvement and Design, we’ve had vast experience in all kinds of masonry contracting for residential properties near New Jersey and built on a solid foundation of values that sit at the heart of everything we do. With a dedicated group of professionals who consistently uphold these principles. 100% guaranteed to meet your needs that fit your budget. Whether you want to make new enhancements or take care of concrete work that already exists, we can provide a selection of masonry options that will match the design of your home style.

[retaining wall](https://homeimprovementanddesign.com/)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6aydb3msadyep5qcflvh.jpg)
Laura Giannini: Virtuoso Violinist Extraordinaire Taking the Global Stage by Storm
Tags: violin, topartis, music
Published: 2023-12-27 14:01:07

Meet Laura Giannini, an extraordinary violin virtuoso whose musical prowess transcends borders, captivating audiences worldwide with her enchanting performances. Hailing from Italy and now based in the vibrant cultural hub of New York City, Giannini has soared to the upper echelons of the classical music scene, establishing herself as a revered artist on the global stage.

Her journey into the world of classical music began with a remarkable feat at the age of 19 when she was handpicked by the legendary violinist Uto Ughi to perform as a soloist and member of the esteemed Festival Omaggio a Roma Orchestra. This early recognition marked the beginning of a brilliant career that has since seen her grace some of the most prestigious concert halls and stages across continents.

Giannini's musical education reads like a testament to her dedication and relentless pursuit of excellence. Graduating from Italy's revered Accademia di Santa Cecilia in Rome and further refining her craft at the Hochschule für Künste in Bremen, Germany, under the guidance of renowned mentors like Felix Ayo, Katrin Scholz, Shmuel Ashkenasi, and Daniel Phillips in the United States, she honed her skills to perfection.

Her talent has garnered recognition through multiple accolades in duo and piano trio competitions throughout Europe. Collaborating with esteemed musical entities such as Accademia dei Cameristi, A.Gi.Mus. Roma, Musica a Piazza Navona, and Deutscher Tonkünstlerverband, Giannini's performances have resonated globally and have been broadcasted on prestigious platforms like Deutschland Radio Kultur.

Her artistry extends beyond the confines of traditional concert halls, as Giannini has performed with renowned ensembles such as Semplice Players, The Symphony Orchestra of the Americas, Broadway Sings, The Queens Consort, and Ensemble Leonarda. Her recent collaboration with the acclaimed New Britain Symphony Orchestra under the baton of conductor Toshiyuki Shimada is a testament to her unwavering commitment to musical excellence.

Giannini's performances have graced the world's most renowned venues, including Lincoln Center, Carnegie Hall, DiMenna Center for Classical Music, The National Opera Center, Shinmin Art Center Performance Hall, Yuanlin Performance Hall, Die Glocke, Temple du Foyer de l’Âme, and Auditorium Parco della Musica. As a fervent advocate for chamber music, she co-founded the OLLA Rhapsody, a violin duo, and the QueensSound Ensemble, showcasing her passion for both vocal and instrumental musical compositions.

Laura Giannini’s journey is a testament to passion, dedication, and an unparalleled commitment to her art. Her performances resonate on a deeply emotional level, captivating audiences worldwide and establishing her as a leading force in the realm of classical music, transcending boundaries and leaving an indelible mark on the global stage.
Featured Mods of the Year 2023
Tags: meta, moderation, community, devimpact2023
Published: 2023-12-27 14:00:00

This past year, we started up a fresh series called [Featured Mod of the Month](https://dev.to/michaeltharrington/series/22642) to highlight some of the many awesome [community mods](https://dev.to/community-moderation) we have helping us out here at DEV!

Each month since April, we've put the spotlight on a different DEV mod and asked them 5 interview questions so that y'all can learn a little bit more about the individuals helping us to make DEV better. 

Mods make the community kinder & more inclusive, welcoming new folks and spreading good vibes by leaving encouraging & constructive comments on folks' posts. They regularly assist us with identifying and uplifting the best content, while also keeping the site better organized using tags. They pass on valuable product feedback and alert us to issues that the community has flagged as particularly painful, e.g. AI-generated content or listicles. They're incredibly impactful and essential to our success. I can't say enough how grateful I am to our fantastic mods. 💚

## Featured Mods of the Month 2023

The folks listed below are just some of the amazing mods who have helped us out in 2023, but understand that there are many other incredible DEV moderators who have yet to be interviewed in this series.

### April — Andy Piper

{% embed https://dev.to/andypiper %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-andy-piper-2fg6 %}

### May — Christine Belzie

{% embed https://dev.to/cbid2 %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-christine-belzie-p09 %}

### June — Jeff Jessie

{% embed https://dev.to/j3ffjessie %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-jeff-jessie-5b6f %}

### July — Thomas Bonnet

{% embed https://dev.to/thomasbnt %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-thomas-bnt-4lo3 %}

### August — Ayu Adiati

{% embed https://dev.to/adiatiayu %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-ayu-adiati-3o1e %}

### September — Pradumna Saraf

{% embed https://dev.to/pradumnasaraf %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-pradumna-saraf-e7j %}

### October — Elizabeth Mattijsen

{% embed https://dev.to/lizmat %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-elizabeth-mattijsen-3gfe %}

### November — Dumebi Okolo

{% embed https://dev.to/dumebii %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-dumebi-okolo-4adk %}

### December — Helen Anderson

{% embed https://dev.to/helenanders26 %}

{% embed https://dev.to/devteam/featured-mod-of-the-month-helen-anderson-38mc %}

## Give a hand for the mods 👏

Let's give a hand for these awesome folks helping us to moderate DEV. And another big thank you to all the unnamed mods that haven't yet had the spotlight. 🙌

On that note, stay tuned for more [Featured Mod of the Month interviews](https://dev.to/michaeltharrington/series/22642) in 2024! 🥳