teleren/devto huggingface dataset:
Javascript operators (part 1)
Tags: javascript, beginners
Published: 2021-06-23 01:55:00

Operators in Javascript has three categories:

1- unary operators 
One operand
    X

2- binary operators

Two operands
   X  Y

3- ternary operators 
Three operands
   X  Y  Z 
_____________________________
unary operators : 
increment
X++
decrement
X--
Keep in mind
prefix ++X
postfix X++


binary operators :

- arthimatic operators :
X+Y  
X-Y
X*Y
X/Y
X%Y
- assignment operators :
    X+=y ➡️ X=X+Y
    (-=)(*=)(+=)(/=)(%=)

- comparison operators :
    (==) ( > ) ( < )
Crop Craze: Farming Simulator
Tags: csharp, unity3d, vr
Published: 2021-06-23 01:02:19

Over the last year, I have been developing a farming simulator for Virtual Reality headsets like the Oculus Quest. I am an indie developer and would love to share my game with you! It is available on the Oculus Store for Rift and Quest (through App Labs) in addition to itch.io for SteamVR headsets.

Oculus Rift URL: https://www.oculus.com/experiences/rift/3175397299175194/
Oculus Quest Store URL: https://www.oculus.com/experiences/quest/5617270104965437/
Itch.io: https://picoplanetdev.itch.io/vr-farm-game

I would love it if you gave Crop Craze a try!
Learning Log
Published: 2021-06-23 00:14:36

Dear Diary, 
Today I implemented the creation of subclasses in the pseudoclassical style, got practice in the use of JQuery and css keyframes. 
The main problem that I encountered was the use of bind in implementation of setTimeout. 
I am getting more comfortable with the problem solving process and using the Chrome debugger tool.

Hackreactor SEI W1D2 more to come XD
Mono-repository with typescript and yarn workspaces
Tags: typescript, monorepository, yarn, workspaces
Published: 2021-06-23 00:02:35

Monoliths have their place in many systems. Usually, they stem from the ease of use, allowing cross-cutting changes to be completed in a single pull request. They also have a lot of downsides, but that’s a whole other can of worms.

Here are the main points we had trouble with in our monolith:

1. How do you share code between sub-projects?
2. How do you manage typescript compilation for dependant projects? E.g. if a depends on b and I make a change to a, I want b to be compiled as well with the latest version of a.

This was an example of my repository structure:

```
projectA/
projectB/
projectC/
packages/
```

Inside my packages/ directory, I had some core shared libraries, like types / shared utils, etc.

Ok — so how do you get it all to work together?

Since we were already using yarn, it seemed like yarn workspaces would be an ideal fit. If I can get the same thing done with the same tools that's a big win.

- Add a root tsconfig.json

```
{
  "compilerOptions": {
    "noImplicitAny": true,
  },
  "exclude": [
    "**/node_modules",
    "**/.*/",
    "**/jest.config.js",
    "**/.build"
  ],
}
```

- In your root package.json add your ‘packages’

```
{
  ...
  "private": true,
  "workspaces": {
    "packages": [
      "packages/*",
      "projectA",
      "projectB",
      "projectC",
    ]
  },
}
```

- in each of your projects + packages, you need to give them the correct name in their respective package.json files e.g. in projectA/package.json

```
{
  "name": "@company/projectA",
  ...
  "scripts": {
    "watch": "tsc -b -w --preserveWatchOutput",
    ...
  },
  "dependancies": {
    "@company/types",
    "@company/logging",
    "@company/clients"
  }
}
```

- Now run yarn install at the root, and then at each package.

- Now is a very important part. You need to add a tsconfig.json file for each of the projects. This is to assist typescript with the dependency tree. Below is an example of projectA as it depends on 3 packages — clients, types, and logging. This tells typescript to recompile if it senses any changes in the parent package.

```
{
  "extends": "../tsconfig",
  "compilerOptions": {
    "outDir": ".build"
  },
  "rootDir": ".",
  "references": [
    {
      "path": "../packages/clients"
    },
    {
      "path": "../packages/types"
    },
    {
      "path": "../packages/logging"
    },
  ],
}
```

- Now, along with the correct tsc options provided (primarily -b) any changes to projectA will recompile the dependencies if required and also compile the project itself.

Now while running in the context of projectA you will be able to make changes to the packages it depends on e.g. /packages/types and it will recompile and display errors if there are any, along with being able to change things in projectA as normal.
How to remove all the non-alphanumeric characters from a string using JavaScript?
Tags: javascript
Published: 2021-06-23 00:00:00

---
  title: How to remove all the non-alphanumeric characters from a string using JavaScript?
  published: true
  tags: JavaScript
  date: Wed Jun 23 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/remove-all-non-alphanumeric-characters-string-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-3ec7c03e33597b1d0b369480cc3ec692.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/remove-all-non-alphanumeric-characters-string-javascript)
  
To remove all the non-alphanumeric characters from a string, we can use a regex expression that matches all the characters except a number or an alphabet in JavaScript.

### TL;DR

```js
// a string
const str = "#HelloWorld123$%";

// regex expression to match all
// non-alphanumeric characters in string
const regex = /[^A-Za-z0-9]/g;

// use replace() method to
// match and remove all the
// non-alphanumeric characters
const newStr = str.replace(regex, "");

console.log(newStr); // HelloWorld123
```

For example, lets' say we have a string like this `#HelloWorld123$%`,

```js
// a string
const str = "#HelloWorld123$%";
```

As we can see from the above string there are some characters like `#$%` which is not a number or an alphabet. So here we can define a regex expression to first match all the non-alphanumeric characters in the string.

It can be done like this,

```js
// a string
const str = "#HelloWorld123$%";

// regex expression to match all
// non-alphanumeric characters in string
const regex = /[^A-Za-z0-9]/g;
```

Now we can use the `replace()` string method and :

- pass the `regex` expression as the first argument to the method
- and also pass an empty string `''` as the second argument to the method
- the method returns a new `string`

This will remove all the non-alphanumeric characters from the string and replaces it with an empty string.

It can be done like this,

```js
// a string
const str = "#HelloWorld123$%";

// regex expression to match all
// non-alphanumeric characters in string
const regex = /[^A-Za-z0-9]/g;

// use replace() method to
// match and remove all the
// non-alphanumeric characters
const newStr = str.replace(regex, "");

console.log(newStr); // HelloWorld123
```

As you can see the `newStr` contains a new string with all the non-alphanumeric characters removed.

See the above code live in [JSBin](https://jsbin.com/zumocakanu/2/edit?js,console).

That's all 😃!

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

---
What to look for when hiring an engineer
Tags: career, jobs, skills, practices
Published: 2021-06-25 08:46:00

---
title: What to look for when hiring an engineer
published: true
date: 2021-06-23 00:00:00 UTC
tags: career,jobs,skills,practices
canonical_url: https://jhall.io/archive/2021/06/23/what-to-look-for-when-hiring-an-engineer/
---

In one of my group chats, we were recently posed the following question: **What qualities/skills do you think are most important for a developer to have?**

Below is my answer:

When I’m interviewing developers, the main things I look for are, roughly in this order:

- **An ability, willingness, and eagerness to learn**. This doesn’t mean they’re learning a new framework every week, but it does mean they’ll use google or ask for help when they need it, instead of admitting defeat.
- **Humility.** They don’t act as though they’re always right (even when they are), but are willing to listen to other perspectives.
- **Good communication skills.** Programming is 100% about communicating. Obviously it’s about communicating with a computer, but more important, it’s about communicating with people (via code, and outside of code). The best programmers are able to communicate their ideas to other people—including those with less experience, and sometimes via formal or informal mentorship.
- **Abstract reasoning skills.** Some people just have a really hard time understanding foreign key relationships, pointers, and how an OAuth2 flow works. This can sometimes be overcome with a strong drive and learning ability (see above), but it can also often be a deal breaker.
- **Coding ability.** Just about the last thing I really care about is someone’s actual ability to code. Although this depends on the project. If it’s a short-term project, this jumps to the top of the list. If it’s a long-term role, it stays at the bottom, because I believe with the above skills, anyone can learn to be a better coder.

What would you add to, or remove from my list?

* * *

And don’t forget, if you have any young potential developers in your life, say below the age of 10, then today’s free **Live Tech Story-Telling Workshop** is for you! We’ll be streaming live on YouTube at 17:00 GMT+2. [Read more about it](https://jhall.io/story/).

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
CodeCast: New Software Update!
Tags: software, update, codecast, windows
Published: 2021-06-22 23:42:45



With the release of Windows and Linux, users can simply head over to our downloads page to get started! 🎉

We hope you enjoy these updates and stay tuned for more exciting features coming to CodeCast soon!


Click Here: https://info.codecast.io/

CodeCast - Learn, Engage & Code Interactively 💻📈
Deploy a Multi-Node Kubernetes Cluster with Vagrant
Tags: kubernetes, vagrant, devops, k8s
Published: 2021-06-22 23:35:40

Deploying a Kubernetes cluster is a time consuming and boring job so I created a project for solving this issue.

Here is the project: https://github.com/ridvanaltun/kubernetes-vagrant

Just follow the below steps:

```bash
# Install the plugin for Vagrant to ability to use environment files.
$ vagrant plugin install vagrant-env

# Clone the project.
$ git clone https://github.com/ridvanaltun/kubernetes-vagrant.git 

# Go into it.
$ cd kubernetes-vagrant

# Don't forget to customize your own environment file.
$ cp .env.example .env

# Up one master and two worker node.
# This takes approximately ~15 minutes if you using first time.
$ vagrant up m n1 n2

# Connect to master node over SSH.
$ vagrant ssh m

# You can do everything you want, an example, list nodes.
$ kubectl get nodes
```

It is simple like that.
The one about backend - WEEK 4 
Tags: javascript, beginners, codenewbie, backend
Published: 2021-06-22 23:20:20

WEEK 4 

Week 4 opened the side door to the land of backend. Was I worried ? No. I had no idea what back end meant, unlike some of my cohort friends who knew what was to come. Ignorance is bliss...sometimes. 

I was just happy, I made it this far. Information overload ?, maybe just a little but it is a bootcamp after all. We covered Aysncronous code. It took me some time to understand the concept but on the course, thankfully, the topics are revisited a number of times. 

I had a dabble in API’s and Promises. Northcoders provide notes as a reference which is super super helpful.
開発環境の mautic に plugin を入れてみる
Published: 2021-06-22 23:13:43

ddev を使い、かつ mautic は 3.3 の branch を使っている。

## mautic-plugin-creator を使っての新規追加

https://dev.to/dany1468/composer-autoload-case-sensitive-4pac
先日の記事で書いた通り、ddev の環境だとさっと動作しなかった。

```
> ddev ssh
$ php vendor/aviboy2006/mautic-plugin-creator/src/test.php
```

上記で以下のようなファイルが出来上がる。
![2021-06-23_08h08_16](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6n1sgneacbei3hega1vs.png)

```
$ php bin/console cache:clear

 // Clearing the cache for the prod environment with debug false


 [OK] Cache for the "prod" environment (debug=false) was successfully cleared.
```

上記で cache をクリアし、プラグイン画面で「Install/Upgrade Plugins」をクリックすると、一覧に表示される。
![2021-06-23_08h09_54](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xuwv67340wddh7g5491h.png)

## mautic/plugin-helloworld を入れてみる

そのまま git で入れる。

```
> git clone git@github.com:mautic/plugin-helloworld.git HelloWorldBundle
```
当然ながら以下のようになる。
![2021-06-23_08h12_08](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mli7er2ntdgj25xlwt27.png)
同様に cache をクリアし、読み込むと一覧に出てくる。
![2021-06-23_08h12_58](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7gh5yv6xcehkt8wdwey8.png)
次はこの辺の設定画面の作り方とかを見ていきたい。
The one about Pikachu - WEEK 3
Tags: javascript, beginners, codenewbie
Published: 2021-06-22 23:09:05

WEEK 3

Recusion, recursion, recursion, recursion.
It has bad reputation but there is no smoke without fire I guess. Theory wise, it is as simple as ‘a function that calls itself. Watch this space...

This week’s project was based on a Pokemon project. Admittedly, apart from the yellow monster, I know nothing about Pokemon. Creating a Pokemon game was a challenge, however I was lucky that my partner was clued up on pokemon. Pokemon GO, well they had been there, done that, got the T-shirt and I was so grateful for that. It was one less thing to worry about.
Nobody needs your library
Tags: webdev, opensource, watercooler
Published: 2021-06-22 22:42:31

I don't have much use for a grid system these days, actually it's rare that I write any CSS at all, but today like most days, I think back to all the cool stuff I have wrote in my years of development.

One thing that stuck, I once read an article with the heading "nobody needs your grid system"... I will let that sink in... strong stuff right? This statement is about as true as any library ♎ but also a sad fact, once somebody made the tool we technically don't need your spin on it, unless it is "better", I use the airquotes here because who is measuring?

I think that adoption is seen as the true metric for success, yet it doesn't actually mean that some less well known library isn't technically; better, faster, harder, stronger. So that's the crux of why we duplicate efforts?

Well we do, and we don't, the fork concept is supposed to allow you to take some code and sprinkle yourself all over it, modernise it, make it "better", make it inadvertently "worse", again, who's measuring? It's a highly subjective matter of opinion.

Speed of technology, Its fast but not always, sometimes it takes years for innovation to drop. In my day we used floats and display hacks, you kids and your flexible boxes and grids 👴... Haha okay I'm kidding, I waited a few years then when browser support was good, I dropped floats and learned flex, then grid (a bit), as time goes on my efforts to understand 100% of the specification have tapered off, because Google, my point here is all of my libraries from back then apart from a few exceptions, well they became defunct.

Your library will become defunct, and your efforts to write that library will be large! Even if done to a standard that can be used by others. So why bother?

### Why bother?
Because you learn stuff and the key thing is "we don't need your library", "we like your library", alot, it's great, keep going at it.

So back to the point, today I wrote a library, a grid system of all things, with a million to choose from and flexbox around, why did I do that? Because I'm forgetting how to do basic stuff in CSS and I think I can take the old float method and sprinkle some modern features onto it, CSS variable as I have said in the past *can be nested in calc, calc can also be nested in calc*, so it's actually now trivial to write a grid system that is calculated at run-time, kind of interesting to set a single variable at each breakpoint to resize everything, or just dynamically change the number of grid columns on the fly.

In conclusion, it's fun, you learn stuff, scratch itches and gain confidence. Don't do it for fame, do it for you.
Python Quiz 1 Answers
Tags: python
Published: 2021-06-22 22:31:30

These are the quiz answers from my latest youtube video. The video covers what I've learned so far and how i've been approaching my studies. Watch the video, take the quiz at the end, and come back here to see how you did. 

<a href="http://www.youtube.com/watch?feature=player_embedded&v=32LWDBJQaag
" target="_blank"><img src="http://img.youtube.com/vi/32LWDBJQaag/0.jpg" alt="pythonbasics" width="240"/></a>

- print("i'm learning python")
- Sets are an unordered collection of unique elements.
- if singer = 'beyonce', what does singer[3] ? o 
- beyKids = {'blue':1, 'sir':2, 'rumi':3}

- while loop code
```count = 0
      while (count<10):
          print("python")
          count= count +1;```

- 10, 1.5 (these numbers can vary, just needs to be an integer and a decimal number)

- list code

```myList = [ "apple","banana","orange" ]``` 

(fruit names can vary, variable assignment and list syntax should be similar though)

- for loop code

```for num in range(1,18):
          if num % 2 != 0:
              print(num)```

- python firstProgram.py
- .keys()
The one about JS fundamentals -  WEEK 1
Tags: javascript, github, beginners, vscode
Published: 2021-06-22 22:29:51

WEEK 1 

Shock to the system. All in all, there was probably 30 minutes worth of info that I was comfortable with..everything else was all new territory. Excitement, fear, self questioning, tears, self gratification....every emotion on the planet was experienced this week. I was struggling to find my feet. 

Exposure to Github, collaborating with others, using Vscode, RegEx and Array methods were the main topics covered. www.w3schools.com was my best friend resource. 

My first unforgettable experience was the first time I did pair programming. I was a nervous wreak as its something I had never experienced before. We ended up having to call in a tutor, not for coding issues but how to even get zoom going. Neither one of us knew how to screen share. Embarrassing but funny. Well, you’ve got to start somewhere I  guess and my partner was super super nice. 

Also I've had to make peace with the fact that its expected (for myself anyway) that the first hurdle is always going to be a setup issue.
New: Exercises on Simple Dev!
Tags: html, css, markdown, javascript
Published: 2021-06-22 22:24:40

We recently created downloadable exercises to go along with the tutorials on Simple Dev. We created exercises for the [HTML](https://simpledev.io/html/html-basics/), [Markdown](https://simpledev.io/markdown/markdown-basics/), [CSS](https://simpledev.io/css/css-basics/), [Bootstrap 4](https://simpledev.io/bootstrap/bootstrap-4-grid-basics/), and [JavaScript](https://simpledev.io/javascript/javascript-basics/) sections. The goal here is to let users practice coding skills inside their text editor.

You can find the exercises by visiting the Topic pages above. You can find a link to download the exercises in the Summary section.

The exercises are hosted on GitHub. You can download them by clicking the green **Code** button and selecting **Download ZIP**. You can then extract the files into a new folder and then open that folder in your favorite text editor.

Each tutorial has its own exercise folder, and the exercise folders are grouped into sections. Each exercise folder has its own README file that contains the instructions for what to do.

This is still a new feature on Simple Dev, so we'd appreciate any feedback you have. You can fill out our [feedback form](https://simpledev.io/feedback/) if you have comments, questions, or suggestions on this feature.
The one about the Entry Challenge
Published: 2021-06-22 22:14:20

APPLYING TO NORTHCODERS

Before sitting the Entry Challenge, Northcoders sent some prep material such as FreeCodeCamp to get a feel of what it's all about. I found it fun and interesting as I’ve no exposure beforehand. I found myself coming back to it everyday, no matter how soul destroying the previous day was. Tutors held drop in sessions to help with prep material and got support via the Northcoders Slack Channel. 

THE ENTRY CHALLENGE

I studied relentlessly from 8am to 9pm everyday. Life was on hold. Sitting in my children's bedroom on their study desk with a dodgy chair...the backaches were the start of many things to come. 

It was the month of Ramadan too, tethering on the verge of a heatwave, the struggle was real. The Entry Challenge day arrived, 3 days before the start date of the course. There was a time limit during the challenge but no one watching over me so it was relaxed. I  even called a tutor via zoom to help me when I got stuck. I was lucky, I did it !

I had a basic understanding of variables, loops, arrays, objects and indirect debugging. I even got my head around nested arrays..ish ! I played around on CodeWars 8kyu and soon enough learnt that its better to have 10 lines of code that makes sense than a one liner that isn’t self explanatory. 

I had three days, courtesy of a Bank Holiday, to get a new operating system installed on my current laptop alongside a load of apps I had never heard of. Embarrassingly, I only knew of Windows OS so to install Ubuntu OS was terrifying. Of course it failed to install first time round...a sign of many things to come.
PiHole on Docker
Tags: docker, pihole, raspberrypi, infrastructure
Published: 2021-06-22 22:11:38

This article is my follow-up article to [Up and running with RaspberryPi with Docker](https://gsin.in/blog/up-and-running-with-raspberrypi-with-docker.html). In the previous article, I showed how you can configure docker and docker-compose on your RaspberryPi.

In this article, I will show how you can restrict external traffic from your RaspberryPi with [PiHole](https://hub.docker.com/r/pihole/pihole) using docker and docker-compose.

## Installation

The first step to defining a place where you want to install PiHole. In my case, I am going to keep it under the `~` path.

```bash
$ cd ~
$ mkdir pihole
$ cd pihole
$ touch docker-compose.yml
```

Once you create the _docker-compose.yml_ file inside the _pihole_ directory, add the following code into it.

```bash
$ nano docker-compose.yml
```

```yml
version: "3"

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
    environment:
      TZ: "America/Chicago"
      WEBPASSWORD: "strongPassword"
    volumes:
      - "./etc-pihole/:/etc/pihole/"
      - "./etc-dnsmasq.d/:/etc/dnsmasq.d/"
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
```

After saving the _docker-compose.yml_ file, you can run the following command to bring your PiHole server up and running.

```bash
$ docker-compose up --detach
```

> Initial run will take some time since it will download the PiHole image from docker.

After a successful run, you can check PiHole instance is running on RaspberryPi as a docker service.

```bash
# Try following commands to check PiHole service

$ docker ps
# To check the list of running containers

$ docker images
# To check PiHole image
```

If you have static IP defined [configure in my previous article](/up-and-running-with-raspberrypi-with-docker#assign-static-ip) then you can access PiHole, at [http://192.168.0.4/admin](http://192.168.0.4/admin)

## Configure devices

After the installation of PiHole now we need to map other devices to use PiHole as the default gateway. For that, you can go to the network/Wifi settings of your individual devices and add **192.168.0.4** IP address to the DNS list (should be on top). See the example below:
![Network settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sv5hxjzfgw0pydlgm2r3.png)

Thanks for following the tutorial, happy coding!