teleren/devto huggingface dataset:
No Continuous Delivery? Then Walk Out. w/ Charity Majors of Honeycomb.io
Tags: continuousdelivery, softwaredelivery, cycletime, observability
Published: 2021-07-13 17:36:27

The benefits of continuous delivery are enormous, and almost **every** engineer you ask would agree. But almost no organizations are shipping software in under 15 minutes. So what’s stopping us?

Continuous Delivery, the action of having a short feedback loop when shipping software to production, is the best way for engineering teams to operate. In this incredible episode of [Dev Interrupted](https://devinterrupted.com/podcast/no-continuous-delivery-then-walk-out/), Charity Majors, CTO of Honeycomb.io, explains how to implement continuous delivery, and why you should walk out if your organization doesn’t support the practice.
#**Listen to the full episode**
{% spotify spotify:episode:6UhYrAGA8jn97Qux2THsy0 %}

#**Episode Highlights include:**
* How to break out of the “Software Delivery Death Cycle” 	
* The overwhelming benefits of having a [short feedback cycle](https://linearb.io/blog/how-to-reduce-cycle-time-in-software-delivery/)
* The greatest failure of our generation of software developers
* How to implement true Continuous Delivery at your enterprise
* What Observability Driven Development means at the developer level

{% youtube fz2c-Owt4ok %}

#**Join the Dev Interrupted Discord Server**
With over 1200 members, the Dev Interrupted Discord Community is the best place for Engineering Leaders to engage in daily conversation. No sales people allowed. [Join the community >>](https://discord.gg/devinterrupted)
![Join the Dev Interrupted Discord Community!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19j3dzgz4r4kzav3w6z8.png)
How to empty the DOM element in JavaScript?
Tags: javascript, dom, jstips, 100daysofcode
Published: 2021-07-13 17:26:39

---
title: How to empty the DOM element in JavaScript?
published: true
description: Learn how to empty DOM elements in JavaScript 
tags: JavaScript,DOM,jstips,100DaysOfCode
---

We can remove the children of the DOM element in 4 ways:
 * Removing all children 
 * Setting `innerHTML` to empty string 
 * Setting `textContent` to empty string 
 * Using `replaceChildren` method

## 1. Removing all children
The `remove` method of the `Element` can be used to remove an element from the DOM. Using this, we can loop through all the child elements of the parent.

Consider we have a ul with 4 li child

```html
// HTML
<ul id="parent">
  <li> list 1 </li>
  <li> list 2 </li>
  <li> list 3 </li>
  <li> list 4 </li>
</ul>
```

In JavaScript, remove all the child until parent have no child

```js
// js

function empty(element) {
  while(element.firstElementChild) {
     element.firstElementChild.remove();
  }
}

let parent = document.getElementById("parent");
empty(parent);

```

The `element.firstElementChild` will return the first child of the `parent`. We will remove the `firstElementChild` of the `parent` as long as the parent has a child. 

## 2.  Setting `innerHTML` to empty String 

By setting an empty string as `innerHTML`, we can remove all the children of an Element. When we set a value to `innerHTML`, JavaScript will parse the value using `HTMLParser` and replace the HTML content as parsed values -- this may cause performance issues. 

```js
function empty(element) {
   element.innerHTML = ""; 
}

let parent = document.getElementById("parent");
empty(parent);
```

## 3. Setting `textContent` to empty String
By setting an empty string as `textContent`, we can remove all the children of an Element. When we set a value to `textContent`, JavaScript will replace all children of the element with a `#text` node. This method is considered faster than `innerHTML`.

```js
function empty(element) {
   element.textContent = ""; 
}

let parent = document.getElementById("parent");
empty(parent);
```
## 4. Using `replaceChildren` method

The `replaceChildren` method replaces the children of a node with a specified new set of children. If we don't send an argument, this method will remove all the children of the node in which it was called.

```js
function empty(element) {
   element.replaceChildren(); 
}

let parent = document.getElementById("parent");
empty(parent);

```
---

Consider Supporting me [here](https://ko-fi.com/jagathish)
This en JavaScript
Tags: javascript, this, spanish, tutorial
Published: 2021-07-13 17:24:58

¡Hola!, muchas gracias por darte el tiempo de leer este artículo, en él hablaremos sobre this en Javascript.

## This

En Javascript siempre va a representar algo diferente dependiendo del **contexto** en el que se encuentre, ya sea en una función, objecto o clase.

```jsx
// this en el scope global
console.log(`this: ${this}`);

// Print: this: [object Window]
```

nos dirá que **this** es un **objeto Window**. Siempre que usemos **this** de forma global el browser lo va a **asignar** a Window.

### This en el Scope de una función

```jsx
function whoIsThis() {
  return this
}

console.log(`whoIsThis: ${whoIsThis()}`);
// Print: whoIsThis: [object Window]
```

> Al llamar la función directamente JavaScript le asigna **Window**.

El motor de JavaScript le asigna este valor por **defecto**, excepto si estamos usando JavaScript en el modo **'use strict'**.

## This en el scope de una función en strict mode

```jsx
function whoIsThisStrict() {
  'use strict'
  return this
}

console.log(`whoIsThisStrict: ${whoIsThis()}`)
// Print: whoIsThisStrict: undefined
```

> Strict mode nos sirve para evitar algunos **errores**

Errores que el puede pasar a cualquier programador.

### This en el contexto de un objecto

> Se refiere a un objeto. Ese objeto es el que actualmente está ejecutando un pedazo de código.

Básicamente, **this** está dentro de una función pero dicha función **pertenece a un objeto**, su valor cambia. En ese caso **this** se refiere al objecto.

```jsx
// this en el contexto de un objeto
const person = {
  name: 'Gabriel',
  saludar: function() {
    console.log(`Hola soy ${this.name}`);
  },
};

person.saludar();
// Print: Hola soy Gabriel
```

## This cuando sacamos la función saludar del objeto

```jsx
// this cuando sacamos a una función de un objecto
const person = {
  name: 'Gabriel',
  saludar: function() {
    console.log(`Hola soy ${this.name}`);
  },
};

// Pasamos la función como referencia
const accion = person.saludar;
accion();
// Print: Hola soy
```

Esta función **`accion()`**, **no** se está llamando dentro del contexto de un objecto.

Es como **ejecutar** una función **directamente**.

> This en este caso sería **Window**

## This en el contexto de una "clase"

Las clase como tal **no existen** de la misma manera en Javascript como en otros lenguajes de programación.

```jsx
// this en el contexto de una "clase"
function Person(name) {
	this.name = name;
}

Person.prototype.saludar = function() {
	console.log(`Me llamo ${this.name}`);
}

const angela = new Person('Angela');
angela.saludar();

// Me llamo Angela
```

This, se refiere al objeto instanciado "Angela".

Entonces en **`this.name**=**name**` lo hacemos sobre la instancia **Luis** no sobre el objeto prototipo.
C# String Methods
Tags: csharp, dotnet, tutorial, beginners
Published: 2021-07-13 17:22:50


In this tutorial, we'll learn about some common string methods in C#.

## Equal

This method returns whether the two string objects have the same value or not.

```csharp
string text = "Dev.to";
string text2 = "Devto";

if(text.Equals(text2))
{
    Console.Write("Yes!");
}
else
{
    Console.Write("No");
}

// Outputs - No
```

## Contains
This method returns `true` if the given string is present in the source string.

```csharp
string text = "Dev.to is the best platform for developers";

if(text.Contains("best"))
{
    Console.Write("Yes!");
}
else
{
    Console.Write("No");
}

// Outputs - Yes!
```
You can also check if a character is present in the string, for example

```csharp
text.Contains('b');
```

## Compare

This method compares two strings and returns an integer. It returns

- **less than zero** if the first substring precedes the second substring in the sort order. 
- **zero** if the two strings are equal
- **more than zero** if the first substring follows the second substring in the sort order.

```csharp
string text = "Dev.to";
string text2 = "Devto";

Console.Write(String.Compare(text, text2)); // -1
```

## IndexOf

This method returns the first index of a character or substring in a source string. If the character or substring is not present in the source, it returns **-1**.

```csharp
string text = "Dev.to";

Console.WriteLine(text.IndexOf('.')); // 3
Console.WriteLine(text.IndexOf('a')); // -1
```

## IsNullOrEmpty

This method indicates whether the given string is **null** or an empty string **("")**.

```csharp
string text = "";
if(String.IsNullOrEmpty(text))
{
    Console.Write("Yes");
}
else
{
    Console.Write("No");
}

// Outputs - Yes
```

## Split

This method splits the string into an array of strings or characters by a **delimiter**.

```csharp
string text = "C# provides support for OOP.";

foreach (var item in text.Split(' '))
{
    Console.WriteLine(item);
}

/* Outputs
C#
provides
support 
for     
OOP. */ 
```

## Join

This method concatenates the elements of the specified array or collection using the given separator.

```csharp
string[] elements = {"This", "is", "my", "blog."};

Console.Write(String.Join(' ', elements));

// Outputs - This is my blog.
```

## Trim

This method removes all the leading and trailing occurences of the specified character or a set of characters.

```csharp
string text = "----C# provides support for OOP.----";

Console.Write(text.Trim('-'));
```

## Replace

This method returns a new string after replacing all the occurrences of a specified character or string with another specified character or string.

```csharp
string text = "C# provides support for OOP.";

Console.Write(text.Replace(' ', '_')); // C#_provides_support_for_OOP.
```

## Format

This method is used to convert variables to strings and insert them into another string.

```csharp
string name = "John";
int age = 32;
string text = String.Format("{0} is {1} years old", name, age);            
Console.Write(text);

// John is 32 years old
```
Python list comprehension
Tags: python, programming
Published: 2021-07-13 17:13:36

Ever use list comprehension in Python?

If not here is very beautiful use of list comprehension in Python which will make your code more neat and readable.

First of all what is list comprehension?

List comprehension is a syntax, list comprehension offer a shorter syntax when you want to create a new list based on the values of an existing list.

Here is the SYNTAX for it
[expression for item in iterable if condition == True]

Below I have shown two examples
One without using list comprehension and another with list comprehension.

Without list comprehension
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37s1w73wak9410i4bn8t.jpg)

With list comprehension
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwx4wuaz39755qegpfmf.jpg)
Identity Proof
Published: 2021-07-13 17:13:21

This is an OpenPGP proof that connects [my OpenPGP key](https://keyoxide.org/0F0B697CCF81BC476D83FFC203B4212ADAF5BC0B) to [this dev.to account](https://dev.to/eliotvonecklie). For details check out https://keyoxide.org/guides/openpgp-proofs

[Verifying my OpenPGP key: openpgp4fpr:0F0B697CCF81BC476D83FFC203B4212ADAF5BC0B]
Let's Learn vcluster with Saiyam Pathak
Published: 2021-07-13 17:06:30

---
title: Let's Learn vcluster with Saiyam Pathak
published: true
description: A look at using virtual Kubernetes clusters, with the open source tool vcluster
tags: 
//cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r21m9rxavasj9wlrkqj3.jpg
canonical_url: https://loft.sh/blog/lets-learn-vcluster/
---

Loft Labs CEO Lukas Gentele joined [Saiyam Pathak](https://twitter.com/SaiyamPathak) on his stream to talk about [vcluster](https://vcluster.com). This video is another great way to get up to speed on vlcuster if you've heard about it and are curious. In the video, Lukas walks Saiyam through the different vcluster features, including the workflow, how to use it with Ingress, and storage considerations.

Saiyam creates a ton of great content about Kubernetes. Check out the other videos [on his YouTube](https://www.youtube.com/channel/UCi-1nnN0eC9nRleXdZA6ncg). He's also hosting a show on [Cloudnative.tv](https://cloudnative.tv) about Kubernetes certifications called Cert Magic, and he's [written a book](https://saiyampathak.gumroad.com/l/cksbook) about the scenarios in the CKS exam.

{% youtube I4mztvnRCjs %}
Quick Sort (JS Example)
Tags: javascript, algorithms, quicksort, faang
Published: 2021-07-13 17:04:43

[![Twitter Follow](https://img.shields.io/twitter/follow/cleancodestudio.svg?style=social)](https://twitter.com/cleancodestudio) 


> _Note: This is not a "professionally written" post. This is a post sharing personal notes I wrote down while preparing for FAANG interviews._

[See all of my Google, Amazon, & Facebook interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

---

## Quicksort Breakdown
- Worst Complexity: n^2
- Average Complexity: n*log(n)
- Best Complexity: n*log(n)
- Method: Partitioning
- Class: Comparison Sort

## Quicksort Explained
Quicksort is an in-place sorting algorithm. Developed by British computer scientist Tony Hoare in 1959 and published in 1961, it is still a commonly used algorithm for sorting. When implemented well, it can be somewhat faster than merge sort and about two or three times faster than heapsort. 

## Quicksort Notes
- Inventor: Tony Hoare
- Unstable Sorting Algorithm
- Quicksort has a better space complexity than merge sort

## Quicksort JavaScript Implementation

```js
/*----------------------------------------------------------
 |   Quick Sort
 *----------------------------------------------------------
 |
 |   Time Complexity 
 |      . Best: O(n log n)
 |      . Aver: O(n log n)
 |      . Worst: O(n^2) 
 | 
 |   Space Complexity
 |      . O(log n)
 |
 |   Divide And Conquer Sort
 |   UnStable Sort
 |
 |   Better Space Complexity Than Merge Sort
 |   Time Complexity Worst Case Is Worse Than Merge Sort
 |   Merge Sort is A Stable Sort While Quick Sort is an Unstable Sort
 |
 */


const QuickSort = (items = [], left = [], right = []) => {
    if (items.length < 2) return items

    let [pivot, ...list] = items
    list.forEach(item => (item < pivot ? left : right).push(item))

    return [...QuickSort(left, [], []), pivot, ...QuickSort(right, [], [])]
}


module.exports = QuickSort
```

--- 
> **FAANG Study Resource: Cracking the Coding Interview**
> (Google Recommended)

<a target="_blank"  href="https://www.amazon.com/gp/product/0984782850/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0984782850&linkCode=as2&tag=ccs0cc-20&linkId=4e21ded6a61b9a202cdc2b9c0bd14025"><img border="0" src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=US&ASIN=0984782850&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL250_&tag=ccs0cc-20" ></a>


---


[My FAANG interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

[Quick Sort Github](https://github.com/zhorton34/data-structures-algorithms-101/blob/master/src/sorts/QuickSort.js)

[Clean Code](https://cleancode.studio/clean-code)
Merge Sort (JS Example)
Tags: javascript, algorithms, faang, sort
Published: 2021-07-13 16:56:08

[![Twitter Follow](https://img.shields.io/twitter/follow/cleancodestudio.svg?style=social)](https://twitter.com/cleancodestudio) 


> _Note: This is not a "professionally written" post. This is a post sharing personal notes I wrote down while preparing for FAANG interviews._

[See all of my Google, Amazon, & Facebook interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

---

## Merge Sort Breakdown
- Worst Complexity: n*log(n)
- Average Complexity: n*log(n)
- Best Complexity: n*log(n)
- Space Complexity: n
- Method: Merging
- Stable: Yes

## Merge Sort Explained
In computer science, merge sort is an efficient, general-purpose, and comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the order of equal elements is the same in the input and output. 

## Merge Sort Notes
- Divide & Conquer sorting algorithm
- Stable sorting algorithm
- Quick sort has a better space complexity than merge sort
- Merge sort is a stable sort while quick sort is unstable
- Merge sort's worst case time complexity is better than quick sorts


## Merge Sort JavaScript Implementation
```js
/*----------------------------------------------------------
 |   Merge Sort
 *----------------------------------------------------------
 |
 |   Time Complexity 
 |      . Best: O(n log n)
 |      . Aver: O(n log n)
 |      . Worst: O(n log n) 
 | 
 |   Space Complexity
 |      . O(n)
 |
 |   Divide And Conquer Sort
 |   Stable Sort
 |   Quick Sort Has A Better Space Complexity Than Merge Sort
 |   Merge Sorts Worst Case Time Complexity Is Better Than Quick Sort
 |   Merge Sort is A Stable Sort While Quick Sort is an Unstable Sort
 */

const merge = (left = [], right = [], merged = []) => {
  let compare = ([a], [b]) => (a ?? b+1) < (b ?? a+1)
  let side = () => compare(left, right) ? left : right

  while (left.length && right.length) merged.push(side().shift())
  while (right.length) merged.push(right.shift())
  while (left.length) merged.push(left.shift())

  return merged
}

const MergeSort = (items = []) => {
  if (items.length <= 1) return items

  const middle = Math.floor(items.length/2)
  

  return merge(
    MergeSort(items.slice(0, middle)),
    MergeSort(items.slice(middle, items.length))
  )
}


module.exports = MergeSort
```
--- 
> **FAANG Study Resource: Cracking the Coding Interview**
> (Google Recommended)

<a target="_blank"  href="https://www.amazon.com/gp/product/0984782850/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0984782850&linkCode=as2&tag=ccs0cc-20&linkId=4e21ded6a61b9a202cdc2b9c0bd14025"><img border="0" src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=US&ASIN=0984782850&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL250_&tag=ccs0cc-20" ></a>


---

[My FAANG interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

[Merge Sort Github](https://github.com/zhorton34/data-structures-algorithms-101/blob/master/src/sorts/MergeSort.js)

[Clean Code](https://cleancode.studio/clean-code)
Selection Sort (JS Example)
Tags: algorithms, selectionsort, javascript, faang
Published: 2021-07-13 16:48:27

[![Twitter Follow](https://img.shields.io/twitter/follow/cleancodestudio.svg?style=social)](https://twitter.com/cleancodestudio) 


> _Note: This is not a "professionally written" post. This is a post sharing personal notes I wrote down while preparing for FAANG interviews._

[See all of my Google, Amazon, & Facebook interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

---


## Selection Sort Breakdown
- Worst Complexity: n^2
- Average Complexity: n^2
- Best Complexity: n^2
- Space Complexity: 1
- Method: Selection
- Stable: No
- Class: Comparison Sort


## Selection Sort Notes
In computer science, selection sort is an in-place comparison sorting algorithm. It has an O(n²) time complexity, which makes it inefficient on large lists, and generally performs worse than the similar insertion sort.


## Selection Sort JavaScript Implementation

```js
/*----------------------------------------------------------
 |   Selection Sort
 *----------------------------------------------------------
 |
 |   Time Complexity 
 |      . Best: O(n^2)
 |      . Aver: O(n^2)
 |      . Worst: O(n^2) 
 | 
 |   Space Complexity
 |      . O(1)
 |
 */

const SelectionSort = (items = []) => {
  for (let passes = 0; passes < items.length; passes++)
  {
    let min = passes

    for (let i = passes; i < items.length; i++)
      if (items[min] > items[i]) 
        min = i
      
    if (min != passes)
    {
      let temporary = items[passes]
      items[passes] = items[min]
      items[min] = temporary
    }
  }

  return items
}


module.exports = SelectionSort
```

---


--- 
> **FAANG Study Resource: Cracking the Coding Interview**
> (Google Recommended)

<a target="_blank"  href="https://www.amazon.com/gp/product/0984782850/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0984782850&linkCode=as2&tag=ccs0cc-20&linkId=4e21ded6a61b9a202cdc2b9c0bd14025"><img border="0" src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=US&ASIN=0984782850&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL250_&tag=ccs0cc-20" ></a>


---


[My FAANG interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

[Selection Sort Github](https://github.com/zhorton34/data-structures-algorithms-101/blob/master/src/sorts/SelectionSort.js)

[Clean Code](https://cleancode.studio/clean-code)
Insertion Sort (JS Example)
Tags: insertionsort, javascript, algorithms, faang
Published: 2021-07-13 16:40:03

[![Twitter Follow](https://img.shields.io/twitter/follow/cleancodestudio.svg?style=social)](https://twitter.com/cleancodestudio) 

> _Note: This is not a "professionally written" post. This is a post sharing personal notes I wrote down while preparing for FAANG interviews._

[See all of my Google, Amazon, & Facebook interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

---

## Insertion Sort Breakdown
- Worst Complexity: n^2
- Average Complexity: n^2
- Best Complexity: n
- Space Complexity: 1
- Method: Insertion
- Stable: Yes

## Insertion Sort Notes

Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. Wikipedia

## Insertion Sort JavaScript Implementation
```js
const InsertionSort = (items = []) => {
    for (let i = 1; i < items.length; i++)
    {
      let index = i-1
      let temporary = items[i]

      while (index >= 0 && items[index] > temporary)
      {          
        items[index + 1] = items[index]
        index--
      }
      items[index + 1] = temporary
    }
    
    return items
}

module.exports = InsertionSort
```
--- 
> **FAANG Study Resource: Cracking the Coding Interview**
> (Google Recommended)

<a target="_blank"  href="https://www.amazon.com/gp/product/0984782850/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0984782850&linkCode=as2&tag=ccs0cc-20&linkId=4e21ded6a61b9a202cdc2b9c0bd14025"><img border="0" src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=US&ASIN=0984782850&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL250_&tag=ccs0cc-20" ></a>


---

[My FAANG interview study notes](https://www.cleancode.studio/notes/faang-interview-notes)

[Insertion Sort Github](https://github.com/zhorton34/data-structures-algorithms-101/blob/master/src/sorts/InsertSort.js)

[Clean Code](https://cleancode.studio/clean-code)