teleren/devto huggingface dataset:
TIL: String.prototype.replace supports replacement patterns
Tags: javascript
Published: 2019-07-31 09:12:37

---
title: TIL: String.prototype.replace supports replacement patterns
published: true
tags: javascript
canonical_url: https://www.stefanjudis.com/today-i-learned/string-prototype-replace-supports-replacement-patterns/
---

Today I came across [a blog post](https://www.peterkroener.de/string-prototype-replace-ist-eine-falle/) (it's in German though) written by [Peter Kröner](https://twitter.com/sir_pepe) and learned something very astonishing.

The article describes the not so well known behaviors of the method `String.prototype.replace`. Using this method is usually very straight forward. It supports regular expressions if you need to, but for most cases, it's defining a matching string and a replacing string.

That's at least what I thought... 🙈 

It turns out that second argument is a string (it can also be a function) and includes specific character sequences like `$&` or `$'` "replacer magic" appears. 

```javascript
const msg = 'This is a great message';

msg.replace('great', 'wonderful'); 
// "This is a wonderful message"
//
// -> 'great' is replaced by 'wonderful'

msg.replace('great', '$&-$&');
// "This is a great-great message"
// '$&' represents the matched substring
//
// -> 'great' is replaced by 'great-great'

msg.replace('great', '$`');
// "This is a This is a  message"
// '$`' represents the string before the matched string
//
// -> 'great' is replaced by 'This is a '

msg.replace('great', `$'`)
// "This is a  message message"
// `$'` represents the string after the matched string
//
// -> 'great' is replaced by ' message'
```

Oh my..., this behavior can lead to very hard to spot bugs!

If you want to read more about it, have a look at [the `replace` docs on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter).
Error lens extension in Visual Code for C#
Tags: csharp, visualcode, errorlens
Published: 2019-07-30 23:25:25

---
title: Error lens extension in Visual Code for C#
published: true
description: how "Error lens" extension works in Visual code for C# 
tags: CSharp, C#, Visual Code, Error lens 
---

Error lens is an amazing extension in Visual Code that shows you all the errors and warnings in realtime when you working on a file or you open a new project. 


First, just to clarify, this extension is available for many programming languages an technologies. Even though you are not a C# developer you can try this extension out with Javascript, Python, etc...


![](https://thepracticaldev.s3.amazonaws.com/i/i897dqjd0mz8eevohgs7.png)

After installing Error lens, you only need to open or edit a file to see the effect and the validations of this extension in real-time.

The following is a list of common errors and warning in C# detected by Error lens  

1. Unnecessary using:
![](https://thepracticaldev.s3.amazonaws.com/i/rh7ievx69r6cy8gwnaoq.png)

2. End of Line:
![](https://thepracticaldev.s3.amazonaws.com/i/3wl27k8e3o8d3osfnwt0.png)

3. Namespace missing:
![](https://thepracticaldev.s3.amazonaws.com/i/wdmfga63q9gezut89o1n.png)

4. Misspell:
![](https://thepracticaldev.s3.amazonaws.com/i/et1ek6g4u8v50r4yca6u.png)


Error lens also has a configuration settings section. You can set a delay to show the errors and change the colors for each type of error.

![](https://thepracticaldev.s3.amazonaws.com/i/zmkz91dow31krh9phmd7.png)

  

The official repository in git: 
https://github.com/phindle/error-lens

Try it out!!
Is WPMerge.io The Best Solution For Automated Database Merges?
Tags: discuss, wordpress
Published: 2019-07-30 23:21:36

---
title: Is WPMerge.io The Best Solution For Automated Database Merges?
published: true
description: What's your best method for seamlessly merging WordPress databases?
tags: #Discussion #WordPress
cover_image: https://thepracticaldev.s3.amazonaws.com/i/4zm6y1hv1y3tvdwlleg7.jpg
---

Currently, I have no solution for seamlessly merging changes on a staging site onto a production site. WPMerge.io is one of the only automated solutions I've discovered. 

I'd like to know if there are better methods or platforms. I'm curious as to how other developers have adapted their workflow to overcome this issue. Let me know your opinions on WPMerge.io and how you've dealt with pushing changes from staging to production.


![alt text](https://thepracticaldev.s3.amazonaws.com/i/yji1ex17eho4ivie6fhq.png)
Using Hasura in Production
Tags: discuss, graphql
Published: 2019-07-30 22:47:32

I have recently been playing around and am planning on using [Hasura](https://hasura.io) for a web app. Hasura is an open-source project which allows for instant realtime GraphQL on top of a Postgres database. Pretty sweet project if I am being completely honest.

Has anyone had experience with using Hasura in a production website or app? What are the pros and cons of using the services?

It provides a quick setup with Heroku, however it allows for setup on other services as well; Docker, Google Cloud etc. If you are using it on a production website, which service are you using?
ntl@4.0.0
Tags: node, npm, javascript, cli
Published: 2019-07-30 22:25:04

---
title: ntl@4.0.0
published: true
description: Npm Task List v4.0.0
tags: node, npm, javascript, cli
---

Just released a new version of **ntl** (Npm Task List: Interactive cli menu to list and run npm tasks) that finally ships one of the most requested features recently: the ability to use a custom runner (such as yarn or pnpm).

![ntl demo gif](http://i.imgur.com/ZjjQ7Vi.gif?1)

---

You can get the latest version using npm:

```sh
npm install -g ntl
```

and participate at the Github repo:

https://github.com/ruyadorno/ntl

---

The complete list of change is the following:

- **Breaking change:** Missing descriptions when using `--descriptions` option now only throws a warning instead of an error msg + exit
- Added `npm-tasklist` as a longhand command alternative ([#48](https://github.com/ruyadorno/ntl/pull/48)) thanks [@wgolledge](https://github.com/wgolledge) 🎉 
- Added `runner` options ([#45](https://github.com/ruyadorno/ntl/pull/45) and [#49](https://github.com/ruyadorno/ntl/pull/49)) thanks [@Mehdi-Hp](https://github.com/Mehdi-Hp) 🎉 
- Updated dependencies
The peeps
Published: 2019-07-30 21:20:36

Hey peeps, this is gonna be my 2nd blog post and as I said I find it weird to write about yourself so I'm going to talk about other people. Like.. Omg.. Gossip...

Actually I want to talk about how incredibly awesome the dev community is and I'm sure you've heard that before & maybe even roll your eyes like "yeah dude, sure..." but my perspective here is of that of an outsider so to speak. I mean I like to think I'm part of the community now but I'm still learning the basics, still in school, and still looking for my 1st dev position.

As a chef there was this constant air of competition, which at times was healthy, but mostly destructive. Everyone thought their level of experience was greater than the next person and that their experience in xyz kitchen was at a higher level than someone who came from ABC kitchen. There was a story of this famous chef Grant Achatz from Alinea in Chicago who in his younger days went looking for a job at The French Laundry run by Chef Thomas Keller. Grant walks in, sees a guy sweeping the floors and asks to speak to the chef. Turns out the guy sweeping the floor was the chef, he never felt he was too good to help out with the lesser duties. It's a philosophy I've sort of adopted into my own life, a "we're all in this together" mentality.

It's that mentality that I've been seeing in the dev community. I kind of expected a lot of pushback initially being a stranger in a strange land, a sort unwelcoming to outsiders view. So far though the response is overwhelmingly positive, there's been a troll here or there but such is life & after being screamed at kitchens or had my food thrown at me or in the garbage I've grown a rather thick skin.

Honestly, from the moment I started talking about my journey on social media I've had several people reach out to me trying to help me along. I actually have a large list of names of folks that have gone above and beyond to help me in various ways and once I get that first dev job I'm going to do a giant shout out to them as gratitude. It's a bit weird... Growing in New Jersey, not exactly the friendliest state, usually when someone is being nice to you they want something from you but the dev community is just generally nice, they seem to want to mentor, grow the community and share their success. So... Thank you, all of you. Even if we've never spoken, thank you for helping others, for helping each other and for continually striving to better the community as a whole.
Deploy a Gatsby Blog to the AWS Amplify Console
Tags: gatsby, hosting, awsamplify
Published: 2019-07-30 22:21:33

---
title: Deploy a Gatsby Blog to the AWS Amplify Console
published: true
description: Learn how to deploy a Gatsby blog to AWS using the Amplify Console.
tags: gatsby, hosting, aws amplify
---

The Amplify Console provides easy to set up hosting including CI/CD with features like feature branch deployments, automatic HTTPS, password protection, and atomic deployments.

In this 56 second video you will learn how to get started with the Amplify console by deploying a Gatsby blog.
Making A Bunch of Requests from a Node Server?  Try Promise.all!
Tags: node, async, javascript, promise
Published: 2019-07-30 22:14:36

---
title: Making A Bunch of Requests from a Node Server?  Try Promise.all!
published: true
description: Quickly turn a large amount of node http requests into an asynchronous Promise to sensibly handle your request/response cycle.
tags: Node, Async, JavaScript, Promise,
---

Sometimes you find yourself needing to make a ton of http requests.  For the most part this a bad idea, and you should really be abstracting your requests and not hammering a REST API since that's how you break things on the internet.

Buuuuuut for testing purposes or just trying to get something to friggin' work, we might be feeling a lil' hacky.  We are developers ya know, and girls just want to have fun!

![hack-a-lackin](https://i.makeagif.com/media/10-24-2015/KP9C6v.gif)


## Disclaimer:
>Please don't use this on any existing REST service that you don't control.  This will possibly break any rate restrictions that service has put in place, and worse case could overload their servers.

I found myself in one of these scenarios while testing a bunch of mock spreadsheet data, where I wanted to make hundreds of requests to some server routes our team was building.  Thus, the advent of this Node code you see below you.

Before continuing, this hack expects some knowledge around JS Promises, ES6 Syntax, and Node Modules.  With that out of the way let's look at this solution and break it down:

{% gist https://gist.github.com/JacobKnaack/badf33f8472d1c49e82c7f74cbd646c9 %}


#### Our Solution

This module doesn't do anything super fancy.  But it does utilize some super fancy built in javascript Objects. 
- It formats an array of promises that we can feed into `Promise.all`.
- When those asynchronously resolve we get a big happy bundle (an array for those strictly typed folks) of response objects :).

#### How do we Achieve this?

We leverage a handy Array prototype `.map` method to turn our array of request options, into new array containing promises:

```js
const promiseArray = reqArray.map(req => new Promise(
  // things our Promise should do
));
```

Each Promise will *resolve* result of the request or *reject* the error if the request fails, asynchronously of course: 

```js
async (resolve, reject) => {
  try {
    resolve(await httpPromise(req));
  } catch (err) {
    reject(err);
  }
}
```

finally we just return the result of `Promise.all` which we pass our newly created array of Promises, or console an error if we get errors in those requests.

```js
return Promise.all(promiseArray)
  .then((responses) => responses)
  .catch(err => {
    return { "message": "bulk request failed", "error": err }
  });
```

Hope this helps with whatever crazy asynchronous actions you're trying to accomplish.  This can easily be refactored for use in other environments besides Node and can be used with other events (Database queries, Cloud Resource Interactions) that you want Javascript to handle only upon completion.

Happy Hacking :)
Godot Engine: TSCN
Tags: gamedev, godot
Published: 2019-07-30 20:58:20

In this series I want to share a few things that I love about the [Godot Game Engine](https://godotengine.org/). Today I will write about the TSCN file format.

In fact this post is not only about the TSCN format. It is about the fact that most file formats in godot are human readable text formats.

## What is TSCN?

TSCN is the file format used by godot to store scene files. The format is explained very well in the official [documentation](https://docs.godotengine.org/en/3.1/development/file_formats/tscn.html). I will not cover these details here.

It basically is a text file specifying the contents of a scene. It contains the complete node tree of the scene and can also contain subresources.

## Other files stored as text format

Most things in godot are stored (or can be stored) in plain text:

- Resources (`.tres` files)
- Project Settings (`project.godot` file)
- Import Settings (`.import` files)
- Scene files exported by other applications (`.escn` files)
- probably some more that I have missed

## Performance

The TSCN files are stored as binary `.scn` files in the internal `.import` folder. This way they load very fast. 

## Why I love the text files

I use git for all my projects. The text file format works perfectly with git. Every change I do in my scenes can be tracked by git. While every little change in the scene can be tracked this can also be too much. I like to group logically connected changes together to not clutter my git history too much.

Another point I love is that I can search for things easily. Forgot in which file the enemy named "KlingonShip01" was? Simply search in all files in the project directory! As everything is stored in plain sight it is very easy to find things.

Last but not least I love the simple structure of these files. It is not only easy to read, it is also easy to generate. For my current space game I wrote a small python script that generates scenes. It looks up the positions of planets and stars in an online database. Based on this gathered data it generates godot scene files.

## Thank you for reading! :sparkles:

This is the second post in my series "Things I love about Godot". I will probably cover the editor interface and more in the following posts. If you have any questions or suggestions please let me know!
Right person + Right task + Right tool= SUCCESS
Tags: management, leadership, team
Published: 2019-07-30 20:38:31

---
title: Right person + Right task + Right tool= SUCCESS
published: true
description: 
tags: Management, Leadership, Team
---

Did your project fail? It happens. The important thing is to reflect and learn; to figure out how to avoid the same result next time. Was it bad luck? Not the right timing? Did your people have a bad day? Possible, but not likely. Most likely it's your failure (the leader) to learn from. Or the requirement didn't fit the team…

Entire article: https://medium.com/front10/when-failure-is-not-an-option-de8b5ef71855?source=friends_link&sk=e9987fac8991475af420513d5154a6e7
JS map(), filter() & reduce() explained!
Tags: javascript, webdev
Published: 2019-07-30 20:28:27

---
title: JS map(), filter() & reduce() explained!
published: true
description: A simple meme to understand map, filter & reduce javascript functions for good.
tags: javascript, webdev
---

Just [found this](https://www.facebook.com/JavaScriptSquad) on the Internet. Worth a share /w you.

![](https://thepracticaldev.s3.amazonaws.com/i/3158n4nhe7gt24wvl2u4.png)
The Best Java Training
Tags: conferences, training, courses, java
Published: 2019-07-30 20:10:09

---
title: The Best Java Training
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/j93tspyuvxf7hjkrbaz1.png
description: Attending an expert-led course is the best way to boost Java skills. I manually collected the ultimate list of training courses offered by different European training providers and individuals. This is the list of all Java courses I am aware of. All the information here has been compiled correctly to the best of my knowledge. If some great Java training is missing, let me know.

tags: conferences, training, courses, java
---

Attending an expert-led course is the best way to boost Java skills. I manually collected the ultimate list of training courses offered by different European training providers and individuals. This is the list of all Java courses I am aware of. All the information here has been compiled correctly to the best of my knowledge. If some great Java training is missing, let me know.


---

## Effective Java Software Design 🚀

**Audience**: java developers and architects · **Location:** Riga, Latvia · **Date**: 26 September

[![Training](https://sizovs.net/images/awesome-java.png)](https://devchampions.com/training/effective-java-software-design/)

During **[Effective Java Software Design](https://devchampions.com/training/effective-java-software-design/)** workshop you will learn how to develop modern, clean and maintainable applications using the latest Java best practices, frameworks and libraries. The course is designed for Java developers who want to expand their knowledge beyond basic and easy-to-google concepts. **You will be equipped with practical solutions to your daily coding, design and architecture challenges.**


👉 **[See the full list](https://sizovs.net/training/the-ultimate-list-of-java-courses/)**
What's the most pragmatic way to start a self-hosted blog? 
Tags: help, blog, react
Published: 2019-07-30 19:14:11

---
title: What's the most pragmatic way to start a self-hosted blog? 
published: true
tags: help, blog, react
---
Hey DT community, I need your help and expertise. 

## My Background
I'm an experienced full-stack software engineer, with a strong background in React, React Native, & Ruby on Rails. 

## My Problem
I've been having trouble figuring out a good service, library, or template to use to create a self-hosted blog for my business. I'm imagining something similar to the [Auth0 Blog](https://auth0.com/blog/).

## Other Thoughts
- I haven't seen an easy way to create this type of thing in React without building it from scratch, which I'd rather not spend a lot of my time doing. 
- My customers aren't necessarily developers and I'm not a big fan of Medium, so I'd like it to be hosted along with the business site.
- I'm not opposed to a hosted service, but I would need it to look professional since it's for my business.
- I know Wordpress is a popular choice but I’ve never used it so I hesitate to pick it for the time it may take to learn it and have it integrate into my react app.
- I've heard others mention Gatsby, but from what I could tell, my non-engineer partners couldn't write posts without me translating it into code. (I could be wrong about this. I don't know much about Gatsby).

Thank you in advance!



Edit: An earlier version of this question mentioned WordPress in passing without elaboration. I’ve updated it to clarify my thoughts.
What is causing `command "clipboard.paste" not found` error in vscode?
Tags: vscode, help
Published: 2019-07-30 18:57:23

This error occasionally pops up which disables my copying ability (very frustrating)

![](https://cl.ly/f60883cdae4c/Image%202019-07-30%20at%202.55.22%20PM.png)

I'm honestly not sure where to start debugging this in VS Code.
First Gantt Chart Web Component
Tags: gantt, webcomponents, ganttchart, ganttcustomelement
Published: 2019-07-30 18:26:31

---
title: First Gantt Chart Web Component
published: true
description: Gantt Chart by Smart Web Compomemts
tags: gantt, web components, gantt chart, gantt custom element
---

Ideal for project management:
https://www.htmlelements.com/demos/gantt/overview/index.htm
What are your benefits like?
Tags: discuss, career
Published: 2019-07-30 18:22:39

What are the benefits like in your industry and local town?

![Make it rain with money gif](https://media.giphy.com/media/VTxmwaCEwSlZm/200.gif)

In Berlin, Germany where I am currently based, by law for all employees we have 
1. **unlimited** sick leave
2. paid parental leave
3. **minimum** of 20 vacation days for 40-hour workweek 
 

Typically the probation period is 6 months, which means you can be fired with a two week notice period for any reason. However, afterwards, it's much harder, and you're entitled to warnings for most violations and a 3 month notice period. 

In addition, many software engineering jobs in Berlin offer additional vacation and small benefits like free drinks such as club mate. ![Photo of various types of Club Mate drinks](https://thepracticaldev.s3.amazonaws.com/i/9gikojitx8dil2dpq7hp.jpeg) 

 and _Tischtennis_ (table tennis) as you can see from my tweet below! 

{% twitter 1105034431444803585 %}
About Codeland
Tags: codeland, codenewbie, webdev, speaking
Published: 2019-07-30 18:00:57

---
title: "About Codeland"
published: true
description: My Codeland experience as a speaker.
tags: codeland, codenewbie, webdev, speaking
cover_image: https://thepracticaldev.s3.amazonaws.com/i/giobzro3a8sa2mmj94ck.jpg
---


<p>I was a speaker at <a href="https://codelandconf.com/speakers/jo-wayne-josephs/">CodelandConf </a> this year and although it was pretty nerve-wracking to deliver my first talk in front of a big audience, I am so glad I did.</p>
<p>Going into the talk, I had some fears. Would the audience relate to me as a speaker? Or would they think the subject matter was boring, or worse yet, that I was boring? In preparation for my talk I recorded myself so I could listen and critique it. I fell asleep in the middle of my own speech, and then woke up frantic. I had bored myself to sleep. I panicked a little, then realized that anyone would probably be bored with their own life story, having lived it.</p>

<h1>Why CodeLand?</h1>
<p>I decided to submit a proposal to give a talk at Codeland because I decided that my story was worth telling. As an asylee, this is a crucial time to speak up for the voiceless. As a member of several minority groups, I knew my story could resonate with lots of people, and possibly spur action. I won't rehash my talk, but I will update this post once the talks are released.</p>

<h1>The Application Process </h1>
<p>I sent in my talk proposal, which was basically a timeline of my immigration and tech journey and how they affected and influenced each other. The talk was accepted and then I worked with Saron in getting the talk and slides organized. This was the most important step, and Saron was very thorough and direct in her critiques, which I appreciated. I made lots of notes and redid the slides about 5 times until I was satisfied with the content and organization. I would take breaks at work and walk around the park reading the talk to myself, possibly looking like a crazy person.

<h1>The Codeland Experience </h1>
<p>The Codeland Experience was amazing. I fell in love with New York. The audience was so receptive to my talk, the response was was quite overwhelming. I definitely encourage Codeland to new speakers, as you won't find a more receptive and supportive audience.</p>

{% twitter 1153449859313258496 %}

<p>The CodeNewbie community is a rather unique one in the world of tech. It is possibly one of the only tech conferences you can attend where you will see so many people of color. Black women in particular account for less than 2% of the tech community so an image like the one below is quite a treasure: </p>
{% twitter 1153445968806850566 %}

#Why Should You Apply to Speak at Codeland?
<p>Your voice matters. Your story matters, and you don't know who you might inspire by simply sharing it. Being a developer isn't just about writing code (it can be, if you choose to make it so) but it can be so much more than that. Speaking, writing, developing content allows you to enrich the community, and allows you to grow as a developer and a human</p>