teleren/devto huggingface dataset:
Managing Git credentials the easy way
Tags: git, github, python, credentials
Published: 2021-07-31 07:31:02

## Introduction

Credential management in Git should not be difficult to use or configure, but (unfortunately) looking at the existing tools, it is difficult to even think about it, let alone configure them without errors.

**NOT. ANY. MORE!**

Presenting `git-credential-netconf`, an easy yet powerful way to manage your Git credentials by harnessing the power of **GnuPG!**

## Getting Started

The following guide assumes you have a GPG key.

### 0. Installing `git-credential-netconf`

```bash
pip install git-credential-netconf
```

[Visit the project page.](https://git.io/JBKgb)

### 1. Create a `.netconf` file in your home directory

```bash
touch ~/.netconf
```

### 2. Start by filling in your username and password

```ini
[conf]
login = yourname
password = very-secret-password
```

**The `.netconf` file uses configuration file format.**

[Learn more about `.netconf` file.](https://github.com/arunanshub/git-credential-netconf#about-netconf-file)

### 3. Encrypt your `.netconf` file with `gpg`

```bash
gpg --recipient yourname@example.com --output ~/.netconf.gpg \
    --encrypt --sign ~/.netconf
```

And remove your original `.netconf` for security:

```bash
shred -u ~/.netconf
```

### 4. Tell Git to use it

**⚠️ Make sure that `~/.local/bin` is in `$PATH`**

```bash
git config --global credential.helper 'netconf --debug'
```

### 5. Now use git without hassle!

```bash
git push
```

This will prompt `git-credential-netconf` to decrypt the `~/.netconf.gpg` file using `GPG` and fetch the `username` and `password`, among other values.

You'll be asked for the password to `GPG` private key when decrypting.

## Conclusion

I hope this article helps you in managing your precious credentials a bit better.

Questions? Comments? Concerns? Please put them down below and I'd be happy to help you.

Image Source: Manjaro's /usr/share/backgrounds folder 😃
2021 Angular Interview Questions Beginners to Advanced
Tags: angular, beginners, devops, react
Published: 2021-07-31 07:25:41

##top new and frequently asked in 2021

Q1. Differentiate between Angular and AngularJS

Q2. What is Angular?

Q3. What are the advantages of using Angular?

Q4. What is Angular mainly used for?

Q5. What are Angular expressions?

Q6. What are templates in Angular?

Q7. In Angular what is string interpolation?

Q8. What is the difference between an Annotation and a Decorator in Angular?

Q9. What do you understand by controllers in Angular?

Q10. What is scope in Angular?
How to save your UpWork connects? What kind of job should you ignore in Upwork?
Published: 2021-07-31 06:44:18

https://www.geeksread.com/how-to-save-your-upwork-connects
If you are in Upwork you will be familiar with connects. Freelancers need connects to apply for freelance jobs. Upwork Connects are just like coins that are necessary to submit job proposals. Upwork Connects also limit the number of jobs a freelancer can apply for in a month. Up to now, freelancers get 60 connects free each month but the Upwork connects policy has been changed and the connects are paid. Details of their pricing are given in their community blog. Freelance jobs are of 1 to 6 connects depending on the scope of the job. Now freelancers have to buy Upwork connects for 0.15$ each. A freelancer will lose his connects if he applies for a freelance job and the client hires another freelancer. But if the client doesn’t hire anyone then he will get his connects back. So, freelancers have to think more than once before applying for a freelance job.

In this article, we will discuss the points which you have to keep in mind before applying for the job if you want to save Upwork connects. So read carefully and keep the points in mind.
Day 6 - Recover Binary Search Tree
Published: 2021-07-31 06:07:43

###Day 6 - Recover Binary Search Tree

Problem and my solution can be found in my GitHub repo along with all other problems I have solved till date.

[Leetcode problem](https://leetcode.com/problems/recover-binary-search-tree/)
[GitHub link to problem and solution](https://github.com/abh1navv/leet-code/tree/master/recover-binary-search-tree)


You can connect with me at &nbsp;
[LinkedIn](https://www.linkedin.com/in/abh1navv)
[Twitter/@abh1navv]
(https://www.twitter.com/abh1navv)
Python Type Hinting : Eliminating ImportError Due to Circular Imports
Tags: python, django
Published: 2021-07-31 06:01:20

We all face sometimes `ImportError` due to having a circular import that is occurred only for type hinting. There is a simple way to handle this kind of problem.
Let’s take we have two files like following:
```python
#book_manager.py
from django.db import models

class BookManager(models.Manager):
    def create_new_version_of_book(self, old_book_object, version):
        return self.create(name=old_book_object.name, version=version)
      
```
The another file:
```python
from django.db import models

from library.models import BookManager

class Book(models.Model):
    name = models.CharField(max_length=200)
    version = models.CharField(max_length=50)

    objects = BookManager()

```
These two files will work fine as we did not added any type hinting. Only the `BookManager` is imported in `book_model.py` file. But if we add type hint to the `create_new_version_of_book` method from `BookManager`, then it will be as follows:
```python
from django.db import models

from library.models import Book


class BookManager(models.Manager):

    def create_new_version_of_book(self, old_book_object: Book, version: str) -> Book:
        return self.create(name=old_book_object.name, version=version)

```
Here now we will get an `ImportError` due to circular import and we will get something like the below message when we want to run the project/files:
```
ImportError: cannot import name 'BookManager' from partially initialized module 'library.models' (most likely due to a circular import)
```
The solution is using `typing.TYPE_CHECKING` constant as below:
```python
from __future__ import annotations

from typing import TYPE_CHECKING

from django.db import models

if TYPE_CHECKING:
    from library.models import Book


class BookManager(models.Manager):

    def create_new_version_of_book(self, old_book_object: Book, version: str) -> Book:
        return self.create(name=old_book_object.name, version=version)

```
**Line 1:** We have imported annotations. `__future__.annotations` is not default in Python now; but it will become the default in Python 3.11. For details, you have a look into PEP 563. If you don’t import it, you can use type hints as string. In our case, it will be `old_book_object: ‘Book’`.

**Line 3:** We have imported `typing.TYPE_CHECKING` special constant. The value of the constant is always False, but set to True by any type checkers, such as Mypy. We have used the this constant to make our import conditional.

**Line 7–8:** We have imported the model with a condition, so it will only be imported when the TYPE_CHECKING variable is True.

Hope, this will help. :)
My javascript / tech / web development newsletter for 2021-07-31 is out!
Tags: javascript, tech, webdev, discuss
Published: 2021-07-31 05:53:56

---
title: My javascript / tech / web development newsletter for 2021-07-31 is out!
published: true
description: A roundup of all the best javascript, tech and web development links posted to my linkblog in the past week
tags: javascript, tech, webdev, discuss
---
In this week’s edition:

10 year anniversary special - Short wave radio, Vim, 808, EDM, RVing, Digital Nomadism, Pilgrimages in Japan, Individualism in the USA, Web Components, Free Speech, Cloud Native Deployments, History

https://markjgsmith.substack.com/p/mark-smiths-newsletter-31-07-2021

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Visual Studio Code Tips & Tricks 
Tags: productivity, vscode
Published: 2021-07-31 05:28:10

Visual Studio Code is a popular code editor used by many devs since it is powerful, minimal, and open source. 

Here is a list of VS code tricks & tips.<br>

### Command Palette
- Open the command palette by combining ctrl + shift + p.
- The Command Palette allows you to access various available commands just by typing a keyword instead of navigating through menus.

### Launching VS Code from Command Line
- Open the command palette (ctrl + shift + p) and type **shell command** and Install 'code' command in PATH command.
- Now open your preferred terminal and type **code** in any folder and start editing!

### Split View 
- If you are working on two different files of the same project then split view is a lot helpful here.
- Split View can be customized based on your preference.
- You can enable this by selecting **View > Editor Layout > Split Up**

### Edit multiple lines simultaneously
- In VS Code you can edit multiple lines by adding cursor to a different location. This is very useful if you are gonna edit the same code in different lines.

### Integrated Terminal
- VS Code has an integrated terminal that is accessible by combining **ctrl + shift + `**

### Plugins & Themes
- VS Code has a rich plugin API that enables users to build cool plugins
- You can install them from VS code marketplace link [here](https://marketplace.visualstudio.com/search?target=VSCode&category=Themes&sortBy=Relevance)

# Top 5 VS Code plugins

**Prettier**

Prettier is an opinionated code formatter, supports multiple languages, and integrates with most editors.
If you wanna keep your code clean then this is a must!

**Live Server**

Live Server launches a development local Server with live reload feature for static & dynamic pages when running javascript

**Debugger for Chrome**

A VS Code extension to debug your JavaScript code in the Google Chrome browser, or other targets that support the Chrome DevTools Protocol.

**Bracket Pair Colorizer**

This extension allows matching brackets to be identified with colors. The user can define which characters to match, and which colors to use.

**TODO Highlight v2**

Highlight TODO, FIXME: and any other annotations you wish within your code in VSCode. This extension helps you to stay productive and stay organized.

If I missed something, or you want to show me something else, feel free to write a comment.
Happy coding!
How to use the webcam with Svelte JS
Tags: svelte, javascript, getusermedia, nelsoncode
Published: 2021-07-31 05:23:00

For this we use the binding property called this allows you to obtain a reference to the rendered elements such as Canva, Video, etc.

```javascript
<script>
  let videoSource = null;
  let loading = false;
  const obtenerVideoCamara = async () => {
    try {
      loading = true;
      const stream = await navigator.mediaDevices.getUserMedia({
        video: true,
      });
      videoSource.srcObject = stream;
      videoSource.play();
      loading = false;
    } catch (error) {
      console.log(error);
    }
  };
</script>

<div>
  {#if loading}
    <h1>LOADING</h1>
  {/if}
  <!-- svelte-ignore a11y-media-has-caption -->
  <video bind:this={videoSource} />
  <button on:click={obtenerVideoCamara}>CLICK</button>
</div>
```
GitHub

https://github.com/NelsonCode/webcam-svelte
useComponentWillUnmount - React hook
Tags: codesandbox, react, webdev, frontend
Published: 2021-07-31 05:11:33

This is a series of tying out the custom hooks introduced in the really good article by [team] (https://thesmartcoder.dev/author/team/) about useful React custom hooks.

[8 Awesome React Hooks](https://thesmartcoder.dev/awesome-react-hooks/)

### useComponentWillUnmount

Console.log when the box will unmount

{% codesandbox esxst %}
Why should you use Redux
Tags: react, redux, webdev
Published: 2021-07-31 04:58:03

You may find react's state and props system useful but  here are some reasons for you to use redux instead.

## React seperates things
React is made on the core fundamenatals of separation of concerns.
React thinks that the Header component needs not know  what is going on in the footer. It should better mind its own business.
That means if you are using react, and are currently in the header component you should not be knowing what is there in the footer. Well there are a few ways to know what is going on in the footer like event emitters and all those hectic stuff, but you should better use Redux
## React is component based
React manages things on a component level. If you are using react for say a blog application provided that each blog is a single component and it fetches some data from a backend api and displays it to the user. After the user has read the blog you want to show him some content related to the blog. You will again call some api and fetch the content in this blog. Let's say he clicks on some other blogs and the same thing happpens you would notice that the api is being called again and again, because the component is getting re rendered with updated values. 
You can deal with this code reuse if you had a large heap of data where everything is stored and take it out everytime the blog re-renders. That would do the same thing but consume less data.
Level Up Your Commit Messages With These Tips!
Published: 2021-07-31 04:52:59


At some point, we’ve all come across a commit message we don’t understand. Let’s rectify that commit by commit:

###1. Specify the type of comment
* feat: for feature addition
* fix: for bug fixes
* refactor: for changing the way a code block is written without changing the final result
* style: for style changes(CSS/Sass etc)
* test: anything and everything about testing
* docs: documentation addition/updates
* chore: code maintenance


> Do not restrict yourself to these types, feel free to add more types of comments but be consistent across the code base.


###2. Never assume another developer understands the original problem i.e. the reason for the commit

I recently started working on an existing codebase along with 3 developers. Me and another dev just started working on the codebase. On the second day, when I woke up to pull the latest code to my database I see this:

```
fix: bug inside the StudentList screen regarding the list
// … some irrelevant details about the new solution
```

When I looked at it, I had no idea what the problem was. After about 15 minutes of chatting back and forth, I finally understood the original problem.

Just a single paragraph, that’s all I ask. One paragraph describing the problem containing 2–3 lines. It will help you too in the future, when you come back later trying to fix a bug.

###3. Limit the subject line to 50 characters
50 characters is not a hard limit, just a rule of thumb. Keeping subject lines at this length ensures that they are readable, and forces the author to think for a moment about the most concise way to explain what’s going on.

> Github will truncate commit messages over 72 characters


Checkout the remaining article [here] (https://medium.com/@akash.shyam2008/level-up-your-commit-messages-with-these-tips-7e66ea34470d). I've saved the best for the last!
useComponentDidMount - React hook
Tags: codesandbox, react, webdev, frontend
Published: 2021-07-31 04:49:22

This is a series of tying out the custom hooks introduced in the really good article by [team] (https://thesmartcoder.dev/author/team/) about useful React custom hooks.

[8 Awesome React Hooks](https://thesmartcoder.dev/awesome-react-hooks/)

### useComponentDidMount

Console.log on mount

{% codesandbox mldtr %}
My Space Engineers Master Pack mod on mod.io reaches 1,000 subs!
Tags: spaceengineers, modding, steam, patreon
Published: 2021-07-31 03:32:51

My #SpaceEngineers Master Pack mod I uploaded to mod.io has reached 1,000 subscribers!

I don't play SE, if you want me to update my mods & create new ones I need y'all to show me you want it. While I'd love to do that for free, I can't.

https://www.patreon.com/posts/54325951
Create your mini CSS framework.
Published: 2021-07-31 02:44:35

As developers, we want to write less and cleaner code. In this post i will show you a method that we can use in CSS for modular and cleaner code.

> These codes are written with SCSS.
```scss
// Create variables
$red:                 #ff0000;
$blue:                #0000ff;
$green:               #008000;

// Create variables map
$colors: (
  "red":              $red,
  "blue":             $blue,
  "green":            $green
);

// And loop for all variables
@each $name, $value in $colors {
  .color-#{$name}      { color: $value };
  .background-#{$name} { background: $value };
}

// Output
.color-red       { color: red};
.color-blue      { color: blue};
.background-red  { background: red};
.background-blue { background: blue};
etc.
```
You can expand it according to your needs.

#### If you want to see the expanded version, look at this [Repository](https://github.com/enesskilic/automatic-train)
It's more than coding
Tags: opensource
Published: 2021-07-31 02:01:58

I made a [contribution](https://github.com/exercism/ruby/issues/1055)!

It is quite intimidating when first contributing to an open-source project, especially if you're beginner. Where do you even begin? What if your first PR is rejected (it probably is) and you would get laughed at (you probably wouldn't)? The trick is to find projects that needed help and find the smallest things you can do. It could be reporting a bug, continue a discussion, or suggest closing an issue. 

**It's more than coding** 
(ofc it's more satisfying contributing this way :p)
PyLadies Dublin July Meetup: FastAPI, Lambdas, PyTest and other cool things
Tags: pyladies, meetup, video
Published: 2021-07-31 01:37:21

![Thank you](https://media.giphy.com/media/RRBg6Y26JpU9G/giphy.gif)

Thanks to all for your interest and attending [our event this month](https://www.meetup.com/PyLadiesDublin/events/277651743/), if you missed it or want to re-watch it here or via https://youtu.be/34UoXruU5-8

🦄 Big thanks to [Bojan](https://www.linkedin.com/in/boyan-miletic/) who shared his insights on FastAPI, Lambdas, PyTest and other cool things, and he's happy to talk about this all all things Python and startup-related. He also presented at EuroPython this week, you can find his sessions along with others via https://ep2021.europython.eu/events/sessions/ (for those who didn't attend EuroPython, they will put up videos in the coming weeks at [their Youtube channel](https://www.youtube.com/channel/UC98CzaYuFNAA_gOINFB0e4Q)

🌈 A quick shout out to our community partners, [Two Scoops Press](https://twitter.com/twoscoopspress) and [Imagilabs](https://imagilabs.com/).

🙌 Of course I can't do this without [Lei](https://twitter.com/Lei_Shao1) and [Mick](https://twitter.com/micktwomey)'s help each month.

## 👏 Winners of our live raffle
![congrats](https://media.giphy.com/media/KFhv3T1seYSJuak8TN/giphy.gif)
Congrats to our two* winners of US$50 Discount for Two Scoops Press book(s), Teri and Laura! Enjoy the book(s)! 
*(last min change of plans as we only had two entrants to the live raffle and instead of giving away 1 discount, I decided to give both away!)*

![announcements](https://media.giphy.com/media/T87BZ7cyOH7TwDBgwy/giphy.gif)
📰 Announcements can be found here: https://cryptpad.fr/pad/#/2/pad/view/P9cM1Fblepsxm9EJDsFR7AJn+V9nYgZm16jZV9ZnfWU/

---

## 🗓 Next PyLadies Dublin
We are delighted to have speakers from Optum at our next event

* Tue Aug 17, 18:30 - 19:30
* Talk 1: Text Classification using HuggingFace Transformers by Olga Minguett
* Talk 2: PySpark 101: Tips and Tricks by Sahana Hegde
* Live Raffle

##### RSVP: https://www.meetup.com/PyLadiesDublin/events/279318562/

---

## 📢 Call for speakers (From Oct onwards)
![want to present?](https://media.giphy.com/media/Y07ArMKOAHJhimZdFn/giphy.gif)
Interested in speaking or know someone who has something awesome to show at our upcoming meetups, send them on via https://pyladiesdublin.typeform.com/to/VvW3iME6

![any ideas, email us](https://media.giphy.com/media/1HKaikaFqDt7i/giphy.gif)
If you have ideas for talks, workshops, something we haven't done before, or general questions of any kind, drop us an email at dublin@pyladies.com.

![thank you](https://media.giphy.com/media/IvTIFDvulINIA/giphy.gif)
Again, I would like to thank everyone for your interest and attending our live-streams, please like and subscribe to our [Youtube channel])https://www.youtube.com/channel/UCMunGHeQPceOWhNSqlmYWPg_ and hit that 🔔 to be notified when we schedule our next live-stream.

![See you next at next meetup](https://media.giphy.com/media/J2aYPy0Fd8oPNITB6u/giphy.gif)

Have a great bank holiday weekend!
The three A’s of Unit Testing
Tags: webdev, testing, testdev, javascript
Published: 2021-07-31 01:27:12

Testing is an essential part of building Software. When it comes to production-ready applications we need to have reliable and well-tested code with as few bugs as possible. There are many methods available for testing your code. In this article, I’ll go over one of the most popular methods, Unit-testing. Unit-testing involves the testing of specific modules or pieces of code within your app. When writing tests you probably want to follow some sort of pattern to write well structured, readable tests. This is where the AAA pattern comes in. The AAA stands for Arrange, Act, and Assert. This is a great way to make sure we’re covering all aspects of testing a module of code.

**A**rrange the state of the data to set it up for testing.

**A**ct on the data through some method that performs an action.

**A**ssert that the result from acting on that data is what we expect it to be.

This is the basic flow for using the AAA pattern with any testing framework. To break each of these down using a code example we’ll be using Javascript's [Jasmine](https://en.wikipedia.org/wiki/Jasmine_(JavaScript_testing_framework)) testing framework. If you’ve not heard of Jasmine before, it’s similar to other testing frameworks you might be familiar with such as RSpec and JSpec. Now let’s write some tests!

## Implementing the AAA pattern

For our example, we’ll be testing a User model in Javascript. Our User class constructor will receive a full name object to set its first name, middle initial, and last name properties.

{% gist https://gist.github.com/CoderJay06/29582c6ed7393e0f5f91a162b6e411f6 %}

Our User class contains a method `getFullName()` that should return the user’s full name. So how do we check that this method does what it says it does? We can write a unit test to make sure we’re getting the correct values. the following code does just that!

{% gist https://gist.github.com/CoderJay06/1ee207a175a974c9aabe6d2f21571313.js %}
So the first part of our test suite is the `describe` method. The `describe` just groups together the code that we’re testing. Then the `it` part of our test is saying what this specific piece of code should actually do. In this case, it should return the full name. Inside of the body of the `it` is where we implement the arrange, act, and assert, giving each part a specific responsibility. The arrange is creating a new instance of User class while act performs the action with the `getFullName()` method we’re testing. Assert then assures us if the evaluated result from invoking `getFullName()` on our user is exactly what we need it to be.

## Conclusion

The AAA pattern gives us simple but effective steps for testing our code. Each step to this pattern has its own job to do. The arrange step sets up our data while the act step performs the actions needed to test it, and the assert will determine if the result from acting on that data is what we expected it to be.