teleren/devto huggingface dataset:
How to price a service that saves hundreds of engineering hours?
Tags: startup, testing, sideprojects
Published: 2022-08-13 19:35:36

I've built a Cypress test runner that completes all tests (no matter how many you've got) in less than a minute. In contrast, based on my experience, a medium-size Cypress test suite takes about 15 minutes to complete.

The only catch is that individual tests have to be under 30 seconds.

The idea came out of frustration running Cypress in my previous company, where it was taking 10 minutes+ to run all Cypress tests while parallelizing across 30 VMs and costing us in excess of USD 2k/month.

In order to achieve this, I have effectively built a new Cypress test runner from the ground up. It understands Cypress syntax, but otherwise have nothing in common with how Cypress works. The way it achieves this performance is by splitting each spec into individual tests and starting all of the tests at once, i.e. if you have 10 specs with 5 tests each, this program will start 50 VMs to run your tests.

I have two companies trialing this at the moment and the feedback has been incredibly positive, saying that it is saving _hundreds_ of engineering hours.

I am trying to establish how to price this. The challenge is that this model is profitable at scale, but losing money if there is not high density of clients. This is because it costs me USD ~0.15 to run a VM for 1 hour and I need to spin up enough VMs to complete all tests, and I am charged in increments of an hour.

My thinking is to charge 2 cents per a test-minute, i.e. Using previous example of 10 specs with 5 tests each, it would cost USD 1 to run all tests once. If you run integration tests 100 times per day, that's USD 100/day.

This may sound much. However, if prior to using this you were waiting 15 minutes to run all tests, that is 14 minutes saved. If avg. engineer in your company is earning USD 60/hour, you are saving USD 14 by having engineers get immediate results rather than waiting for them. If positioned that way, it doesn't sound expensive.

I am currently targeting companies with 30-50 engineers (existing customers are series A and series B companies). At this size, they don't have crazy amount of tests, so I can deliver on the 1 minute promise, and they care a lot about moving fast.

What sounds reasonable?
Be Separate From Crowd (Freelance Web Dev)
Tags: webdev, career, opensource, freelancer
Published: 2022-08-13 19:23:00

Hi, _Gurpreet kait_ this side again with some new stuff. I have been working as a freelancer for 2 years. And I have also seen a lot of developers on freelance sites like Fiverr and Upwork. Each & everyone is fighting on prices and for their services as well. Because of the supply and demand rule, every person is selling their services at low prices.
This was the pain and main point that I noticed there. But consider one thing ever. Assume there are 100% developers who code applications. But there are 10–15% of developers/Programmers who code applications in the right way. It means in the way they should be.
People are fighting over prices clients are happy to pay them. I worked with clients who said that they wanted to work with the person who will be responsible for their work. But maximum coders out there deliver temporary solutions.
**Including me, I also did some bad jobs in starting but then I learned I will be responsible for my mistakes, why the client or anybody else**
## Things that I have learned and implemented right now
1. Be a good programmer and be a part of the community. Be a programmer who will be appreciated because of his fantastic work.
2. Learn how things work, I mean be curious about new updates in your field.
3. Always provide value, don't compromise on value.
4. Network with amazing people in your field and learn from them how they started.
5. Start contributing to the community and leave an impact.
6. Start sharing knowledge and put value in front of other people. Who are new to the same career.
7. Be active/productive.
8. Build your impact for good career growth. 
9. Learn from pro players. who are already there, where you want to be.
10. And Don't make your life shit in front of your computer all day. Be a good family person and live with nature.
If you are a developer who believes in learning each day, I usually put the same content on my [website](https://larachamp.com/). Take a look at there also.
Thanks
How to write an if conditional statement in Golang or Go?
Tags: go
Published: 2022-08-13 19:05:10

---
  title: How to write an if conditional statement in Golang or Go?
  published: true
  tags: go
  date: Sun Aug 14 2022 00:35:10 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/write-if-condition-statement-in-golang
  cover_image: https://melvingeorge.me/_next/static/images/main-274d2e9e01021ef50b86d4993eaa9f52.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/write-if-condition-statement-in-golang)
  
To write an `if` conditional statement in Golang/Go, you have to write the keyword `if` followed by the condition you want to check and then the opening and closing curly brackets symbol (`{}`). Inside the curly brackets, you can write the code to run for that specific condition.

For example, let's write an if conditional statement where it checks if the number `3` is less than the number `5`.

It can be done like this,

```go
package main
import "fmt"

func main() {
    // this is the if conditional statement
    if 3 < 5 {
        fmt.Printf("I'm inside the if block!")
    }
}
```

As you can see from the above code, we have written the `if` keyword followed by the condition which is `3 < 5` and then the opening and closing curly brackets symbol (`{}`).

Inside the `if` block we are just printing the text `I'm inside the if block!`.

We have successfully made an `if` conditional statement in Golang. Yay 🥳!

See the above code live in [The Go Playground](https://go.dev/play/p/jekUCKyAI_C).

That's all 😃!

### Feel free to share if you found this helpful 😃.

---
How to create a slice or a dynamic array in Golang or Go?
Tags: go
Published: 2022-08-13 19:04:10

---
  title: How to create a slice or a dynamic array in Golang or Go?
  published: true
  tags: go
  date: Sun Aug 14 2022 00:34:10 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/create-dynamic-array-or-slice-in-golang-or-go
  cover_image: https://melvingeorge.me/_next/static/images/main-3ea48f4be51240c71d9bfd53438f7df0.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/create-dynamic-array-or-slice-in-golang-or-go)
  
To create a dynamic array or a slice in Golang or Go, we can use the `[]` symbol (opening and closing square brackets) and then write the value type of the contents that should be in the dynamic array followed by the `{}` symbol (opening and closing curly brackets) and finally inside `{}` symbol we can write the values separated by the `,` symbol (comma).

### TL;DR

```golang
package main

import "fmt"

func main() {
	// a simple slice or dynamic array that can
	// hold `string` type values in go
    myArr := []string{
        "John", "Lily", "Roy",
    }

    // print the `myArr` silce
    // values to the console
    fmt.Print(myArr) // [John Lily Roy]
}
```

For example, let's say we need to make a dynamic array called `myArr` of `string` type value.

It can be done like this,

```golang
package main

func main(){
	// a simple slice or dynamic array that can
	// hold `string` type values in go
    myArr := []string{}
}
```

Now let's put some `string` type values inside the slice. The values are separated by the `,` symbol (comma).

It can be done like this,

```golang
package main

func main(){
	// a simple slice or dynamic array that can
	// hold `string` type values in go
    myArr := []string{
        "John", "Lily", "Roy",
    }
}
```

### NOTE: You may have to add the comma for the last value in the slice, or the Golang compiler might throw you an error. In our case, we have added a comma `,` after the value of `Roy` in the slice.

Finally, let's print the values in the `myArr` slice using the `Print()` method from the `fmt` module like this,

```golang
package main

import "fmt"

func main() {
	// a simple slice or dynamic array that can
	// hold `string` type values in go
    myArr := []string{
        "John", "Lily", "Roy",
    }

    // print the `myArr` silce
    // values to the console
    fmt.Print(myArr) // [John Lily Roy]
}
```

We have successfully created a silce or a dynamic array in Golang. Yay 🥳.

See the above code live in [The Go Playground](https://go.dev/play/p/7CkVFGX6CzC).

That's all 😃!

### Feel free to share if you found this helpful 😃.

---
How to import a single package in Go or Golang?
Tags: go
Published: 2022-08-13 19:02:26

---
  title: How to import a single package in Go or Golang?
  published: true
  tags: go
  date: Sun Aug 14 2022 00:32:26 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/import-single-package-go-golang
  cover_image: https://melvingeorge.me/_next/static/images/main-be60a91b84f2c46db72b41e1cea9a924.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/import-single-package-go-golang)
  
To import a package in Go or Golang, we can use the `import` keyword followed by the name of the package. The package imports should be at the top of the file but after the `package` name.

For example, let's say we need to get the current time. To do that we need the `time` package and then we need to use the `Now()` method to get the current time.

To use the `time` package we have to import it first.

It can be done like this,

```golang
package main

// we are importing the `time` package here
import "time"

func main(){
    // to get the current time we can use the
    // `Now()` method from the `time` package
    time.Now()
}
```

We have successfully imported a single package in the Go language. Yay 🥳!

See the above code live in [The Go Playground](https://go.dev/play/p/Xm0FkACenky).

That's all 😃!

### Feel free to share if you found this useful 😃.

---
How to import more than one package in Go or Golang?
Tags: go
Published: 2022-08-13 19:00:28

---
  title: How to import more than one package in Go or Golang?
  published: true
  tags: go
  date: Sun Aug 14 2022 00:30:28 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/import-more-than-one-package-go-golang
  cover_image: https://melvingeorge.me/_next/static/images/main-ebf6fbffb30958af654c82f77a6e85f2.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/import-more-than-one-package-go-golang)
  
To import more than one package in Go or Golang, you need to write the `import` keyword followed by the `()` symbol (opening and closing brackets), and inside the brackets, you can write the name of the package in `""` symbol (double quotation) separated by the space.

### TL;DR

```golang
package main

// import the `time` and `fmt` package
import (
    "fmt"
    "time"
)

func main() {
    // get the current time
    // and store it in a variable
    currentTime := time.Now()

    // show the current time to
    // the user in the console
    fmt.Println(currentTime)
}
```

For example, let's say we need to show the current time to the user. To do that first we need to import 2 packages namely `time` and `fmt`.

The `fmt` package is used to show the output written to the console and the `time` package is used to work with time.

First, let's import the 2 packages.

It can be done like this,

```golang
package main

// import the `time` and `fmt` package
import (
    "time"
    "fmt"
)
```

Now let's use the `Now()` method from the `time` package to get the current time and store it in a variable like this,

```golang
package main

// import the `time` and `fmt` package
import (
    "time"
    "fmt"
)

func main(){
    // get the current time
    // and store it in a variable
    currentTime := time.Now()
}
```

Finally, let's show the current time to the user in the console using the `Println()` method from the `fmt` package.

it can be done like this,

```golang
package main

// import the `time` and `fmt` package
import (
    "fmt"
    "time"
)

func main() {
    // get the current time
    // and store it in a variable
    currentTime := time.Now()

    // show the current time to
    // the user in the console
    fmt.Println(currentTime)
}
```

We have successfully imported more than one package in Golang. Yay 🥳.

See the above code live in [The Go Playground](https://go.dev/play/p/vO33Q7Spn4U).

That's all 😃!

### Feel free to share if you found this useful 😃.

---
How to make variables without assigning values in Go or Golang?
Tags: go
Published: 2022-08-13 18:57:34

---
  title: How to make variables without assigning values in Go or Golang?
  published: true
  tags: go
  date: Sun Aug 14 2022 00:27:34 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/make-variables-without-assigning-values-go-golang
  cover_image: https://melvingeorge.me/_next/static/images/main-82116807dbf6d82bce3358db32927584.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/make-variables-without-assigning-values-go-golang)
  
To make variables without assigning values in Golang, you can use the `var` keyword followed by the variable name you wish to give and then the type of the value that you wish to hold in the variable.

### TL;DR

```go
package main

import "fmt"

// make a variable but do
// not assign a value now
var name string

func main() {
    // assign a value to the `name`
    // variable using the `=` operator
    name = "John Doe"

    // log the `name` variable
    // value to console
    fmt.Print(name) // John Doe
}
```

For example, let's say we need to make a variable called `name` but we do not need to assign a value to it right away.

It can be done like this,

```go
package main

// make a variable but do
// not assign a value now
var name string
```

Now to assign a value to it we can use the `=` operator (equal symbol) after the variable name, in our case it is `name` and then after the `=` symbol, we can write the value that needs to be assigned to it.

It can be done like this,

```go
package main

// make a variable but do
// not assign a value now
var name string

func main() {
    // assign a value to the `name`
    // variable using the `=` operator
    name = "John Doe"
}
```

**NOTE: When assigning a value to a variable in Go, you need to make sure it is inside a function or it will throw an error**

Finally, let's print the variable `name` value to the console using the `Print()` method from the `fmt` standard package in Go like this,

```go
package main

import "fmt"

// make a variable but do
// not assign a value now
var name string

func main() {
    // assign a value to the `name`
    // variable using the `=` operator
    name = "John Doe"

    // log the `name` variable
    // value to console
    fmt.Print(name) // John Doe
}
```

We have successfully made a variable without assigning a value in Go. Yay 🥳!

See the above code live in [The Go Playground](https://go.dev/play/p/jB9rR887Gn_I).

That's all 😃.

### Feel free to share if you found this useful 😃.

---
How to copy/paste files/directories into non-existent destination path
Tags: copy, paste, directory, path
Published: 2022-08-13 18:24:40

---
title: How to copy/paste files/directories into non-existent destination path
published: true
description: Using an alias function to create recursivelly a directory and copy into it
tags: copy, paste, directory, path
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/isx7mwantsuypfu45uez.jpg
# Use a ratio of 100:42 for best results.
---

Have you ever tried to copy some file(s) or directory(ies) to a destination that doesn't exist yet ? It's possible with a smart bash function !

![How doe's it work](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z0sss3wj3yqs2xeuyiu0.jpeg)

## HOW ?

How to obtain that ?
Using this bash script function :
```bash
cpd(){
    mkdir -p "$(dirname ${@: -1})"
    cp -r $@
}
```

- First, we create recursively the destination folder by getting the dir name of the last argument passed to the function.
- And we copy recursively depending on the array of arguments passed to the function.

As the final step, You just have to add it in your `.bashrc`, `source ~/.bashrc` and you're good to go !

## DEMO ?

![Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wi18vln6ol2yxuqa9mp9.gif)

Thanks for reading, feel free to like and/or subscribe for more 🐼.
A guide for technical writers on JavaScript Testing Libraries
Tags: testing, javascript, writing
Published: 2022-08-13 18:08:00

Although I would have liked to choose a different topic, but the importance of developing test suites cannot be overstated. After all, the idea behind writing test cases is to ensure that your application's different features and parts are performing as expected and to confirm that the application satisfies all related standards and customer requirements.

> Quality is not an act, it is a habit. -Aristotle

However, when the necessary guide isn't clearly stated or presented, testing JavaScript applications can be hard to understand and hit developers in the head on a number of different levels. They end up jumping from article to article, wasting time that could be used for other tasks. When creating a technical guide, you must take into account that it will be read by thousands of readers with varying levels of expertise, some of whom will be able to tell you when you bootstrap and others who will probably need you to point it out.

Here are a couple of test libraries you should probably write about:

- [Jest](https://jestjs.io/)

- [Cypress](https://www.cypress.io/)

- [Storybook](https://storybook.js.org/)

- [Puppeteer](https://pptr.dev/)

- [MochaJS](https://mochajs.org/)

- [NightWatchJS](https://nightwatchjs.org/)

- [Karma](https://karma-runner.github.io/latest/index.html)

- And yeah  [React Testing Library (RTL)](https://testing-library.com/docs/react-testing-library/intro/)

For developers looking to learn any of the aforementioned technologies, it is thought appropriate for top-notch articles to be provided on them because they are the best at writing tests.

**Your content should cover areas such as:**

- What is a JavaScript testing framework?

- Why are test suites necessary? - After all, manual testing of my program shows good performance.

- Developing test cases

- Choosing which things to test and which to leave out

- An overview of the selected testing framework (whichever one you are discussing)

- An easy-to-follow practical setup guide

- The framework's benefits and drawbacks

- Reference to the official documentation of the framework

I’d love to see your article. Kindly buzz me on Twitter [@ismailobadimu](https://twitter.com/ismailobadimu)
Game Of Life in Python
Tags: python, gamedev, programming, tutorial
Published: 2022-08-13 17:41:00

Hey!
Let me show you, how to code Game OF Life simulation in my favorite language: Python.
At first, I did not fully understand what Game Of Life was all about, from multiple resources - not only wikipedia 😄- I gathered the idea, and step by step, the whole concept was revealed: Evolution!

Please subscribe to my channel, I post a video per week, trying to share what I know without talking, just coding in silence.

The code is below 🙂
{%youtube nCcAz1LHz9k %}


```python
''This is Game Of Life (Thrones 😄) 
   simulation coded in Python '''

from random import choice
from turtle import *
import turtle
from freegames import square

cells = {}

# 1 Initialization function
def initialize():
    '''Here, we will randomly initialize the cells'''
    for x in range( -200, 200, 10):
        for y in range( -200, 200, 10):
            cells[x,y] = False
    
    for x in range(-50, 50, 10):
        for y in range(-50, 50 ,10):
            cells[x,y] = choice([True, False])

# 2 Step function
def step():
    '''Here, we will compute one step in the game of life.'''
    neighbors = {}

    for x in range(-190, 190, 10):
        for y in range(-190, 190, 10):
            count = -cells[x,y]
            for h in [-10, 0, 10]:
                for v in [-10, 0, 10]:
                    count += cells[ x + h, y + v ]
            neighbors[x,y] = count
        
    for cell, count in neighbors.items():
        if cells[cell]:
            if count < 2 or count > 3:
                cells[cell] = False 
        elif count == 3:
            cells[cell] = True


# 3 The drawing function
def draw():
    '''Here, we are going to draw all the green squares, i choose green to match the channel's theme 😄'''
    step()
    clear()
    for (x,y), alive in cells.items():
        color = 'green' if alive else 'black'
        square(x,y,10,color)
    update()
    ontimer(draw, 100)

'''Setting up the turtle window'''
turtle.title("Game of life")
setup(420, 420, 370, 0)
hideturtle()
tracer(False)
initialize()
draw()
done() 
```
How to change the meta title of the WooCommerce shop page using the Rank Math plugin
Tags: seo, woocommerce, wordpress
Published: 2022-08-27 16:37:16

---
title: How to change the meta title of the WooCommerce shop page using the Rank Math plugin
published: true
date: 2022-08-13 17:28:11 UTC
tags: SEO,WooCommerce,WordPress,seo
canonical_url: https://davidloor.com/2022/08/13/how-to-change-the-meta-title-of-the-woocommerce-shop-page-using-the-rank-math-plugin/
---

In a WooCommerce site that I am working on, I tried to update the meta title of the default shop page from the Rank Math configuration page and for some weird reason I was not able to accomplish it. So, at the end, I needed to use the following snippet to make it happen:

```
/**
 * Filter to change the meta title for the shop page.
 *
 * @param string $title
 */
add_filter( 'rank_math/frontend/title', function( $title ) {
	if ( is_shop() ) {
		return 'My nice meta title for the shop page';
	}
	return $title;
});

```

If you are curious about what other hooks are available in the Rank Math plugin, you can check the following link: [https://rankmath.com/kb/filters-hooks-api-developer/](https://rankmath.com/kb/filters-hooks-api-developer/)
How to fix 'zsh: command not found: python'
Tags: python, beginners, webdev
Published: 2022-08-13 17:15:06

When trying to run python from terminal, it is possible to run into the following issue:
```
zsh: command not found: python
```

This can happen on any system, but does occur slightly more commonly on MacOS since they removed native python support in MacOS 12.3. Fortunately this issue is easy to fix.

### Step 1: make sure Python is installed
The first thing you should check is that python is installed. You can install python from terminal if you have `brew` installed by simply typing:
```
brew install python
```

[You can also download the executable directly from the Python website](https://www.python.org/) to install it. Once `python` is installed, try running `python` from terminal again. If you still face the same issue, move to step 2.

### Step 2: add python to zsh
The next step is to add `python` to zsh so that it will run upon typing the `python` command. You can do this by running the following in terminal:
```
echo "alias python=/usr/bin/python3" >> ~/.zshrc
```

This will configure your zsh profile to run `/usr/bin/python3` when `python` is run. If you are still facing issues, ensure that `python=$` where the $ sign should equal the path `python` is installed on.

### Step 3: restart terminal
Now that you've done that, simply restart your terminal. When you open it again, your `python` command should work successfully.