teleren/devto huggingface dataset:
Um .env para todos workspaces
Tags: javascript, yarnworkspaces, braziliandevs
Published: 2021-06-05 23:24:49

---
title: Um .env para todos workspaces
published: true
description: Como usar um .env para todos os seus yarn workspaces Imagem da [Vox](https://www.vox.com/2016/10/3/13149670/google-new-os-andromeda-operating-system-chrome-android)
tags:
  - javascript
  - yarnworkspaces
  - braziliandevs
cover_image: https://giovanisleite.dev/static/cf6abb5d2dd9cd3713c08af7eb355215/a7c53/one-ring.webp
canonical_url: https://giovanisleite.dev/um-env-multiplos-workspaces
---

A feature do Yarn Workspaces é bastante útil quando você quer ter várias aplicações ou bibliotecas
no mesmo repositório. Um famigerado monorepo. O [Roberto Achar](https://twitter.com/robertoachar) fez [um post sobre como configurar um monorepo utilizando o Yarn Workspaces](https://robertoachar.dev/blog/yarn-workspaces). A [biblioteca do Material-UI para React](https://github.com/mui-org/material-ui) é um exemplo de repositório que tem múltiplos pacotes juntos e usa Yarn Workspaces.

São várias as organizações que podemos fazer nesse esquema, podemos ter aplicações independentes, uma lib que é usada por todas as outras, várias independentes e uma que usa todas elas e etc. Nesse mundo de aplicações, durante o desenvolvimento, ter um .env para cada uma pode não fazer sentido ou simplesmente ser chato demais por ter que ficar cada hora mudando em um lugar diferente, copiando de um pro outro e etc.

Um comando e uma alteração nos seus scripts pode resolver isso:

1. Instale a biblioteca [`dotenv-cli`](https://github.com/entropitor/dotenv-cli)

```bash
yarn add --dev dotenv-cli
```

<br/>

2. Adicione `dotenv -e .env` antes do seu comando que irá iniciar a aplicação/lib, por exemplo:
```json
//package.json
"scripts": {
    "start-frontend": "dotent -e yarn workspace frontend start"
}
```

Assim, sua aplicação vai poder acessar as váriaveis que você configurou no seu `.env` da raiz 🎉
Technically speaking
Published: 2021-06-05 22:47:13

<p>
Technical interviews: the scourge of up and coming software engineers, the great assessor. Technical interviews can be scary and after my first I figured I'd lay out some tips for your next nail-biting experience. 
The goal of technical interviews is to test your prowess at coding and to get a sense of how you code. Are you naming your functions in a concise way? Do you write your code using the necessary layout? Are you pseudo-coding and commenting and how much?? Something to keep in mind is your personality while coding as well. These people want someone who they are comfortable with and who knows their stuff, so be friendly, communicative and an active listener.
A huge take away from my own recent interview is **read the directions and read the DOCS!** I know it sounds like a given, but I signed off on my interview realizing I didn't take the time to educate myself about the challenge and my performance suffered because of it.
Next, locate and define the key components of the code you are looking at. Are you working with an array? An object? Do you need to use bracket notation or dot notation? Where are the functions and what are they doing? Take 15 minutes and read the whole code over so you have a clear picture of where you are and where you need to go.
Finally, keep testing. Coding in my experience is about 70% research and testing and 30% actually typing. If you want to see something work, keep running that code and watch your changes. At the end of the day, you'll want to talk about what you want to happen, giving you a chance to speak in code and give the interviewers the chance to see you in action. 
Take heart in yourself and your abilities. These interviews are intimidating, and sometimes very tough. Even if it doesn't go well, you can walk away with a good idea of what you need to work on and how to improve your practice. 
Good luck, and happy coding!
</p>
What I Learned This Week: Database Constraints
Tags: postgres, database, sql
Published: 2021-06-05 22:25:45

Ruby on Rails is an excellent framework to use. It utilizes object oriented programming, it's flexible, and reads very close to plain old English. One of the great benefits of Rails is that it offers us ActiveRecord for our models (the M in MVC). ActiveRecord is an ORM which allows objects to be mapped to a database. Now that you have a quick overview of what ActiveRecord is I can tell you, we can also add validations to our model because of it. I know, how cool! However, what if I told you, there is another way to limit what data is allowed in? Introducing, **DATABASE CONSTRAINTS**!

_As a heads up, I have been mostly dealing with Postgres as a database so this blog will revolve mostly around Postgres constraints._

Now, back to our regularly scheduled program!

Database constraints are rules you give the database to follow which will allow (or not allow) certain data to be saved or passed through. Constraints can be applied anywhere from the whole schema to one row in a certain table. Listed below are constraints that you can add to your database and why may want to include them your next project or ticket.  

* CHECK: is given an expression and checks it as a boolean. Must not return false.
* NOT-NULL: values in the column should **not** evaluate to NULL.
* UNIQUE: each value in the column with this constraint must be unique.
* PRIMARY KEYS: values in the column must not evaluate to null and be unique. Remember, primary keys are generally used to identify a record.
* FOREIGN KEYS: values in the column must reference an existing record in another table (should reference a primary key or a unique constraint).
* EXCLUSION: any 2 rows compared in column will have at least one return false or null.

Database constraints help to maintain the integrity of your database by helping to keep the data consistent. I read a StackOverflow answer (saved somewhere deep in my bookmarks) that made comparing model validations and database constraints a bit easier to understand, "Database constraints are law; application logic constraints are advice." I hope this blog helps you understand constraints a little bit more!

References:
* https://www.postgresql.org/docs/9.4/ddl-constraints.html
Patented Nevod technology for text search is now open source and available on GitHub
Tags: showdev, opensource, nlp, datascience
Published: 2021-06-05 22:15:34

How often does a newly patented technology become free and open-source? Not often, right? Well, here is the case. We’ve made our patented **Nevod** technology free and open-source. It’s hosted on GitHub: https://github.com/nezaboodka/nevod.

## What is Nevod?

Nevod is a language and engine for **pattern-based text search**. It is specially aimed to rapidly reveal entities and their relationships in texts written in the natural language.

You can try Nevod yourself on the official [Nevod Web site](https://nevod.io/#/playground). There is a language tutorial and a language reference at your disposal.

The Nevod Web site is also an open-source project, hosted on GitLab: https://gitlab.com/nezaboodka/nevod.web.public

## License

The Nevod project, as well as the Nevod Web site, are licensed under Apache 2.0 License, which includes the patent license. Cool, isn’t it?
Find your specialty by being a T-shaped person.
Tags: softskill, specialty, tshaped, developer
Published: 2021-06-05 22:09:18

The technology industry has many possible areas of work: software development, computer security, data science, AI and many more ... In addition, each area triggers a whole series of sub-areas to specialize. The job possibilities are immense, but that can also be overwhelming for some people who have yet to find what to specialize in.

## Do I need a specialization?

In general, large companies are looking for people with skills in very specific areas, who have a deep command of a tool, a programming language. This happens because there are not enough professionals or people with the necessary experience to cover the high demand that the industry requires.

## T-shaped person

Also known as T-shaped developer, T-shaped professional. It is a profile of a person that has been defined by various industries, where the person learns, at least the basics, about the different areas or sub-areas that are transversal to their more specific skills:

![T-shaped person image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9azev4ouwh7wkfh1uoqe.png)

## But ... I don't know what to specialize in!

My recommendation is to focus on the horizontal part of that T. Experience different areas of the industry of your interest, do not stay only with the first thing you learn. The time will come when you find some area, sub-area, tool, programming language, that you are more passionate about than everything else that you have already learned and place that passion in the vertical part of that T and learn it in depth.

The invitation is not to neglect that horizontal part of the T, when you find your specialty. The advantages of working on both parts of the T will lead you to:

- Improve your analytical ability to solve problems.
- Best outlook in the industry.
- Opportunities for personal and professional growth.

Never stop learning!
Live Stream: Writing a Programming Language from Scratch
Tags: programming, rust, interpreter
Published: 2021-06-05 22:03:57

At 17:00 GMT tomorrow (June 6) I'll be be streaming a coding session from [Twitch](https://www.twitch.tv/ezanmoto), where I'll be implementing an interpreter for a custom programming language. This may be interesting to those who want to learn the basics of how programming languages are implemented, or for those who already know but haven't yet implemented one themselves. I'll also be providing commentary and answering any questions that may come up during the session.

**Edit:** The stream is now available at <https://www.twitch.tv/videos/1047868433>.

The Target Language
-------------------

The language I'll be developing will be a custom C-style interpreted language. I intend to use this custom language as a skeleton for playing around with different syntaxes/styles for a further programming language project that I plan to work on.

The language itself will be a fairly typical C-like language consisting of a number of common features from modern languages:

* Basic types: Booleans, integers and strings
* Complex types: Lists, objects (maps) and functions/methods
* Python-like strong, runtime typing, with optional typing in future
* Python-like string/list access
* Python-like built-in functions like `len`, `keys`, etc.
* Rust-like control flow syntax (e.g. `if true { ... }` and `for x in xs { ... }`)
* Rust/JS-like array/object composition (spreading) and decomposition
* Go-like error handling

Here are some example snippets:

```
x = 1
if x < 2 {
	print('T')
} else {
	print('F')
}

# Output:
#
# T
```

```
i = 0;
while i < 3 {
	print(i);
	i += 1;
}

# Output:
#
# 0
# 1
# 2
```

```
xs = ['b', 'c'];
ys = [xs.., 'a', xs..];
[_, _, ..zs] = ys
for z in zs {
	print(z);
}

# Output:
#
# a
# b
# c
```

```
fn half(n) {
	return n / 2
}

fn map(f, xs) {
	for i in 0..len(xs) {
		xs[i] = f(xs[i])
	}
}

print(map(half, [4, 5, 6]))

# Output:
#
# [2, 2, 3]
```

The Source Language
-------------------

I'll be writing the interpreter in Rust using LALRPOP. The data structuring and pattern matching capabilities of Rust make it a perfect fit for building and walking ASTs.

Finally
-------

Please feel free to join me and ask questions. Also, please let me know in the comments here if there's anything that you'd like to see and I'll do my best to cover it.
Small "side gig" type freelance?
Tags: discuss
Published: 2021-06-05 21:36:06

Hi,

Has anyone had good success going freelance work on the side while maintaining a full-time job? Personally I have extensive database knowledge as well as being very competent with Linux shell scripting and Python. I like the idea of "side gig" freelance work but how does one find small enough projects where the client doesn't expect you to be on hand for 30/35hrs per week (since I would be doing my full-time job).
5 Skills You Need To Become A Developer
Tags: beginners, codenewbie, devrel, programming
Published: 2021-06-05 21:35:42

Before I got my start developing programs. I gained interest in development and quickly wondering what skills would be necessary to be successful. After experience I am able to provide the 5 most important skills needed to become a developer. 

### Problem solving 

The number one skill to cultivate is problem solving. Development is filled with opportunities to solve real-world or business logic with programming tools like languages. This is the practice of recognizing all parts of a problem to develop a creative solution to apply the problem.

### Logical thinking

Logical thinking is another important skill to develop. The development of computers and software operates are based in logic. Learning to think in these ways makes it much easier to reason about code and write great code. 

### Attention to detail 

This is a skill that will be most valuable as your a developing code. This will key to understanding any mistakes or missing parts in programs. This is a skill that will be cultivated daily and a little of this skill goes a long ways. 

### Teamwork 

Contrary to prior beliefs, Mostly all production code happens in a team environment, so it will be very valuable if you know how to work on a team. You can succeed by learning to share your progress, ideas and pair-programming with others. 

### Written and verbal communication

This a skill that is important provide effective communication to coworkers in both technical and non-technical roles. Demonstrating you can explain your ideas, plans, and progress to all stakeholders can be an indicator that your grow into decison-making roles.  

#### Let's chat about skills
The great part is you may have developed these skills in other activities, passions, or careers and you can put them to use right away. If you enjoyed this post feel free to leave a comment about these skills and others that make a good developer.

Happy Coding,
Terry Threatt
❣️The Cute Weekend Guide to Phaser.js🐻
Tags: phaser, javascript, web, games
Published: 2021-06-05 21:32:44


### Just some weekend learning fun 
![The Cute Weekend Guide to Phaser.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mg3se9e6td43k3szkdoq.jpg)

![The Cute Weekend Guide to Phaser.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i52osnz8ey7ybl0js26h.jpg)

![The Cute Weekend Guide to Phaser.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hlk05kvkpvsd0zua3i08.jpg)

![The Cute Weekend Guide to Phaser.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/veidm2dh9d3d6hsr3wns.jpg)

![The Cute Weekend Guide to Phaser.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvqzg4cga0d04l0rrj7l.jpg)

![The Cute Weekend Guide to Phaser.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o09ebfyl4t4ggwt4mfc1.jpg)
Zoom in Image.html
Tags: javascript, css, html, ios
Published: 2021-06-05 21:23:26

In this post, we'll see how to create an image zoomer which allows users to zoom an image using a range slider. Here is the structure of the elements:

![carbon (2)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qe6zelydozhythzqevpf.png)

Prepare the image container
The image will be displayed at the center of its container. In case users zoom in the image to the level which makes the image bigger than its container, then we'll hide the outside parts.

Having that imagination, the container could be styled as below: 

![carbon (3)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0mz6gzkbdf12uf51t5ts.png)

Calculate the initial scale
Initially, we want the image to be fit within its container. To do that, we clone the image and handle the load event to determine the size of image:

![carbon (4)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vw2l9ed4i0y38mvr6pfe.png)

The initial scale can be determined based on the widths of container and image:

![carbon (5)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7b88g5ebtkzeeqffq7zm.png)

Now we scale the image to that value by setting the transform style:

![carbon (6)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x13lyonujvbnhhlbtnxo.png)

Create the range slider
You can take a look at the Create a range slider post for more details. Initially, we want to set the slider range based on the scale calculated in the previous section.

First, we define the minimum and maximum scales and calculate the range step:

![carbon (7)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3rg7yvtu61zu87fuofx.png)

It's also possible to set the lower and upper values based on the initial scale. I set constant values to make this post simple.

The slider can update the value via the width of left part:

![carbon (8)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhjgknp466r9r79r2a0v.png)

Scale the image when sliding the range
In the previous section, we set the initial value for the slider based on the scale. It's the time to do the other part, update the scale based on the slider's value.

It happens when user drags the knob:

![carbon (9)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5q8h0y0bno4avarsb5d8.png)

Enjoy the demo!       

{% codepen https://codepen.io/luisenriquecorona/pen/poeVpKG %}
Multi-Constructor on JavaScript
Tags: javascript, programming, productivity
Published: 2021-06-05 21:19:22

### Hope you like it!
Hi guys i would like to share with you my point of view how i define **multi-constructors** on **Javascript**.

```
class Car {
  constructor(brand, year = '', owner = '') { // assign default value
    this.carname = brand;
    this.year = year;
    this.owner = owner;
  }
  presentCarName() {
    return 'I have a ' + this.carname;
  }
  presentCarNameAndYear() {
    return 'I have a ' + this.carname + ' year: ' + this.year;
  }
}

let myCar = new Car("Ford");
console.log(myCar.presentCarName());
myCar = new Car("Ford", 1996);
console.log(myCar.presentCarNameAndYear());
```

on [stackoverflow](https://stackoverflow.com/a/67853929/15487484)

hope you like it!
Github Pages unable to show all html files
Published: 2021-06-05 20:43:37

Hi im sort of a new developer and im having trouble publishing a projects on github pages. Unfortunately the full project is not able to be shown and im not sure why. 

this is the repository https://github.com/tgriff21/familyguy-game

Ive tried putting it in the docs folder and even tried transferring the project to react. thank you
Hello World !
Tags: python, javascript, programming, beginners
Published: 2021-06-05 20:02:59

### Python
```
print('Hello World!')
```

### PHP
```
<?php echo "Hello World!"; ?>
```

### JavaScript
```
document.write('Hello World!');
```

### TypeScript
```
console.log("Hello World!");
```

### C#
```
using System;
class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello World!");
    }
}
```

### C
```
#include 
 
int main(void)
{
    puts("Hello World!");
}
```

### C++
```
#include 
 
int main()
{
    std::cout << "Hello World!
";
    return 0;
}
```

### Java
```
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Prints the string to the console.
    }
}
```

### Bash
```
echo "Hello World!"
```

### MatLab
```
disp('Hello World!')
```

### R
```
cat('Hello World!
')
```

### Ruby
```
puts "Hello World!"
```

### Swift
```
println("Hello World!")
```

### Assembly
```
    global  _main
    extern  _printf

    section .text
_main:
    push    message
    call    _printf
    add     esp, 4
    ret
message:
    db  'Hello, World', 10, 0
```

### Go
```
package main

import "fmt"

func main() {
    fmt.Println("Hello, World")
}
```

### Objective-C
```
#import <Foundation/Foundation.h>
 
int main() {
    @autoreleasepool {
        NSLog(@"Hello, World!");
    }
}
```

#### That's all for my First Post !
Hope, you enjoyed experiencing Greetings from the World of programming.

I love the way YOU Smile😊
Top methods to download torrents on the cloud for free
Tags: cloud, torrent, free, seedr
Published: 2021-06-05 19:59:00

Downloading torrent without a bit-torrent client installed in your computer regardless of the platform is not easier than ever. I will start with the easier and the faster option.

# Option 1

**Seedr**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rc025ilbhlv0ezjebu4t.jpg)

Seedr is a cloud torrent website among the most cloud torrent websites and the most beneficial tool when compared. The reason being with seedr we can upgrade the cloud storage space up to 5GB by performing few simple tasks that will help seedr to grow. WIN-WIN right!

Step 1:Go to the [seedr.cc](https://seedr.cc) and register using your email or facebook and once you are done with the registration by confirming your email address.

Step 2:Go to the [Earn free space](https://www.seedr.cc/dynamic/get_space) menu option to perform the before said tasks to earn extra the free storage space.

Seedr gives you multiple options to earn extra space.

* Invite Four referrals to sign up with seedr with your referral link.
* Post a review on twitter
* Post a review on pinterence
* Do a quick blog article on seedr like this one.

Again WIN-WIN ! 

Also their paid subscriptions are much better when compared with similar services which you can expand the download storage up to 1TB if you are a heavy torrent downloader. 

# Option 2

**Cloud torrent**

If you are more tech savvy then there is another option for you, but this one is a hassle. 
Cloud torrent is an open source software solution that can be installed on any ubuntu/centos environment on the cloud. We can use a freely provided instance from Oracle to install our cloud torrent service. Let me briefly explain the steps.

Step 1:Go to [Oracle Cloud](https://www.oracle.com/cloud/free/) and register for a free tier instance. (You can use any other cloud service provider of your preference)

Step 2:Go to Git Hub Link [Cloud Torrent](https://github.com/jpillora/cloud-torrent) and follow the instructions there to setup you cloud torrent service.

After this you will have your entire Instance space (approximately 20GB on a free oracle instance) to download your torrents. This one is not easy at all but worthwhile if you can make it happen. So give it a shot.

But there is a catch, **You cannot download copyright infringed content from this second option (Cloud torrent)**. In simple terms no illegal/pirated torrents. If you do so, you oracle instance will be banned from the cloud service provider by a DMCA Complaint.

**Conclusion**

Above are the best two freely available options I use for downloading torrents. Generally most torrent are less than 5GB of size, Hence my personal opinion is to go for the easier and safer option of using [seedr.cc](https://seedr.cc) But if you are hungry for a challenge and crave for more storage space for free, you can also try the cloud-torrent option.

Good luck with torrenting!