teleren/devto huggingface dataset:
ts-node, lendo arquivos TypeScript com Node.js
Published: 2022-04-18 23:17:43

Toda linguagem de programação necessita de alguma ferramenta que leia o que está sendo pedido em seus comandos e assim como qualquer linguagem, o [JavaScript](https://www.javascript.com/) tem seu próprio interpretador, o [Node.js](https://nodejs.org/).

Porém, para usuários mais avançados em [JavaScript](https://www.javascript.com/), muitas vezes eles preferem migrar para a utilização de seu superset, o [TypeScript](https://www.typescriptlang.org/), que por sua vez não é interpretado diretamente pelo [Node.js](https://nodejs.org/). Apesar de atualmente ter o seu próprio interpretador, o Deno, muitas vezes é preferivel usar o [Node.js](https://nodejs.org/).

Com essa necessidade de interpretar os códigos escritos em [TypeScript](https://www.typescriptlang.org/) pelo próprio [Node.js](https://nodejs.org/), foi desenvolvido um pacote chamado ts-node, que faz o papel de compilar os arquivos em [TypeScript](https://www.typescriptlang.org/) para [JavaScript](https://www.javascript.com/) e interpretar esses arquivos.

## Instalação
Primeiramente é importante criar um arquivo de package.json em seu projeto:

```
npm init -y
```

Em seus projetos instale o pacote do ts-node:

```sh
npm install ts-node
# ou
yarn add ts-node
```

Após a instalação do ts-node, vamos ver esse projeto teste para exemplificar como utilizar

![project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kehqgm4hurnqwzn6wwag.png) 

Com isso você já tem o ts-node pronto para ser executado em seu projeto digitando o seguinte comando no terminal:

```
ts-node index.ts
```

E o resultado será

![tsnode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iv71hd242ct20dp75aci.png)

Agora basta criar um script em seu package.json para que ele seja executado no terminal de forma mais rápida.

Para isso será necessário mais alguns pacotes, como o typescript e o @types/node, instale eles:

```sh
npm install @types/node -D
npm install typescript
# ou
yarn add @types/node --save-dev
yarn add typescript
```

Seu package.json vai ficar mais ou menos assim:

```json
{

  "name": "ts-node-test",

  "version": "1.0.0",

  "description": "",

  "main": "index.js",

  "scripts": {

    "start": "ts-node index.ts"

  },

  "keywords": [],

  "author": "",

  "license": "ISC",

  "dependencies": {

    "ts-node": "^10.7.0",

    "typescript": "^4.6.3"

  },

  "devDependencies": {

    "@types/node": "^17.0.25"

  }

}
```

Agora basta executar o seguinte comando em seu terminal:

```
npm start
```

E o resultado será

![npmstart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5zepv3862rfue84w0ek.png)

Após feito esses processos, qualquer aplicação em [TypeScript](https://www.typescriptlang.org/) poderá ser lida a partir do [Node.js](https://nodejs.org/), sem necessitar a instalação do Deno ou qualquer outro programa, o que facilita bastante na hora de fazer seus setups de aplicações que necessitam do ts-node.
Day 10: I did it! my first tutorial article
Tags: productivity, beginners
Published: 2022-04-18 22:32:42

Hi!
So I did it after a week of procrastination :). I have written my first tutorial article which is INSANE for me! it was a new topic for me which was not that complicated really (now that I know how to do it) but it took me a lot of time and research 
I wanted to add more explanations and proofread it properly but I'm really tired and I couldn't wait to share it to the world :) I guess I will edit it tomorrow but for now I go to sleep accomplished something cool!

tomorrow I will start looking into setting up tailwind and creating a Trello board for this project we will see how it comes along

signing off...
Build an Alien Shooter Game in AR
Tags: tutorial, unity3d, augmentedreality, 3d
Published: 2022-04-18 22:29:54

<center>Designed by [vectorpocket / Freepik](http://www.freepik.com") </center>
<br>

Here's a simple alien shooter game demo created with Unity, AR Foundation and [**echo3D**](http://www.echo3d.co/). The full demo can also be found on echo3D's [GitHub](https://github.com/echo3Dco/Unity-ARFoundation-echo3D-demo-Alien-Game).

Register
========

Don't have an API key? Make sure to register for FREE at [echo3D](https://console.echo3d.co/#/auth/register).

Setup
=====

*   Clone [this](https://github.com/echo3Dco/Unity-ARFoundation-echo3D-demo-Alien-Game) project and open in Unity
*   Load the AlienGame scene from the Scenes folder in Unity
*   Set your echo3D API key in the echo3D prefab
*   Add the model from the [Models](https://github.com/echo3Dco/Unity-ARFoundation-echo3D-demo-Alien-Game/blob/master/Models) folder to the echo3D console
*   Add the metadata from the [Metadata](https://github.com/echo3Dco/Unity-ARFoundation-echo3D-demo-Alien-Game/blob/master/Metadata) folder to the model on the echo3D console

Run
===

[Build and run the AR application](https://docs.echo3d.co/unity/adding-ar-capabilities#4-build-and-run-the-ar-application).

Learn more
==========

Refer to our [documentation](https://docs.echo3d.co/unity/) to learn more about how to use Unity and echo3D.

Support
=======

Feel free to reach out at [support@echo3D.co](mailto:support@echo3D.co) or join our [support channel on Slack](https://go.echo3d.co/join).

Screenshots
===========

![](https://miro.medium.com/max/1400/0*TCrLUEscIpvUVRpC.png)![](https://miro.medium.com/max/1400/0*pFRqZQd53johwInc.png)![](https://miro.medium.com/max/1184/1*QZ-VgYHp-YptwdUFMe_owg.gif)

***

>_**echo3D** ([www.echo3D.co](http://www.echo3d.co/); Techstars 19') is a cloud platform for 3D/AR/VR that provides tools and network infrastructure to help developers & companies quickly build and deploy 3D apps, games, and content.
![](https://miro.medium.com/max/1400/0*TkpqdE8TLaXW7CiV.png)_
Easter Greeting in AR (Shareable)
Tags: augmentedreality, 3d, discuss, tutorial
Published: 2022-04-18 22:20:10

![](https://miro.medium.com/max/1400/1*ydLGG_vJC_O-hlTJybfbUg.png)

Easter is a meaningful holiday for many. We hope you are enjoying this holiday if you celebrate it!

To share this Easter greeting in AR with your friends and family, scan this QR code or share this link: [**https://go.echo3d.co/GVqg**](https://go.echo3d.co/GVqg)

<center> ![](https://miro.medium.com/max/664/1*ozDh8fPWTnBGUc7bk2LjWw.gif)![](https://miro.medium.com/max/1156/1*LT0vf64njRfv2bFCNsv_nQ.png) </center>

To learn more about creating AR apps without code, visit the [echo3D docs](https://docs.echo3d.co/).

To make your own, sign up for echo3D for free [here](https://console.echo3d.co/#/auth/register).

To recreate this, follow this [short tutorial](https://medium.com/echo3d/create-an-ar-experience-and-share-with-a-qr-code-link-f02e63114bbb).

**More Tutorials**

*   [Make a Valentine's Day Slideshow in AR](https://medium.com/echo3d/make-a-valentines-day-slideshow-in-ar-free-and-no-code-c1e35a4206d4)
*   [Get a Quarantine Dog in AR!](https://medium.com/echo3d/get-a-quarantine-dog-in-ar-8383ea55376b)
*   [How to Create 3D Content and See it in AR (FREE & NO CODING REQUIRED)](https://medium.com/echo3d/how-to-create-3d-content-and-see-it-in-ar-free-no-coding-required-369e5b4a4b3e)

***

>_**echo3D** ([www.echo3D.co](http://www.echo3d.co/); Techstars '19) is a cloud platform for 3D/AR/VR that provides tools and network infrastructure to help developers & companies quickly build and deploy 3D apps, games, and content._

![](https://miro.medium.com/max/1400/1*reboYATrmutXxC4D9AsTWA.png)
React server taking too long to start up and unable to edit without shutting down server
Tags: react, beginners, programming, webdev
Published: 2022-04-18 21:53:18

I'm having an issue with npm start, it takes almost 2 minutes before the server starts and opens the page on my browser. Then whenever I make changes to my code then save it and reload the page, the server does not update the page with the new changes, thus forcing me to stop the server and restart it. I've look for solutions on stack overflow but was unable to solve my issue. Any support would be greatly appreciated.
Empleos en Data y Analytics LATAM — Abr 2022 - III
Published: 2022-04-18 21:49:26

Te compartimos las ofertas laborales del mes para áreas de Data, Analytics y Cloud 👨‍💻👩‍💻.

✅[Data Analyst- PwC (Perú, Lima)]
(https://pe.indeed.com/viewjob?jk=8efa190ff7e0fb3c&tk=1g0va12kipvup801&from=serp&vjs=3)
✅[Data Engineer- Inchcape Digital (Colombia, Bogotá)]
(https://co.indeed.com/viewjob?jk=243c09d0c5a48a1b&tk=1g0va2if8k26g800&from=serp&vjs=3)
✅[Data Scientist - The Nature Conservancy (Ecuador, Quito)]
(https://ec.indeed.com/viewjob?jk=686fbb0e798977d1&tk=1g0va3ku9mfrk803&from=serp&vjs=3)
✅[Machine Learning Analyst - Soc Comercial (Chile, Santiago de Chile)]
(https://cl.indeed.com/viewjob?jk=be1dad373c0806e6&tk=1g0va4u9pq6rd800&from=serp&vjs=3)
✅[Data Analyst - EATON (Mexico, Ciudad de México)]
(https://mx.indeed.com/viewjob?jk=277784978206a731&tk=1g0va6ggut59r802&from=serp&vjs=3)
✅[Data Engineer- Dell Technologies (Bolivia, Santa Cruz)]
(https://www.linkedin.com/jobs/view/3030693967/?eBP=NotAvailableFromMidTier&recommendedFlavor=ACTIVELY_HIRING_COMPANY&refId=qezHsaBTe%2B6zdb0FeiW9yQ%3D%3D&trackingId=yhH5jotVVWP%2FUmzvOsdfjg%3D%3D&trk=flagship3_search_srp_jobs)
✅[Data Scientist - JPMorgan Chase Bank, N.A. (Argentina, Buenos Aires)]
(https://ar.indeed.com/viewjob?jk=22d44d8f093b92e6&tk=1g0vaalkgjoqu800&from=serp&vjs=3)
✅[Machine Learning - Canonical - Jobs (Venezuela, Caracas)]
(https://ve.indeed.com/viewjob?jk=128f36353b17cd3b&tk=1g0vabtbqgri8801&from=serp&vjs=3)


Aprende, aplica y crece en proyectos de Data y Analytics en Cloud.

Visita nuestra página:
👉🌐 datahack.la
Rust - I Need Your Help !
Tags: rust, beginners, help
Published: 2022-04-18 21:23:39

I Know this title is a bit confusing, you'll understand.

As a Rust beginner I want to learn the language the right way and as you may know, the best way for learning something is to practicing what you are actually learning. 
So I'm looking for some ressource or exercise to learn rust effectively.
Of course I've tried exercism (site that some rusty recommend) or something like that but that's no efficient (for me) and that's complicated to understand the concept.
That's a bit hard as beginner in rust to find some exercise and ressource convenient for my level (I've finished the half of the rust book). I need basic project in rust to use what I learn in the rust book and applicate that's new skills by creating something "real".
Hope you can help me to become more rusty 😉
React Native Reanimated 2 Layout Animation Example
Tags: reactnative, reanimated, animation, layout
Published: 2022-04-18 21:14:16

[Layout Animations](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/layout_animations) are the easiest way to animate entering, exiting and change layout of your React Native components with [Reanimated 2](https://docs.swmansion.com/react-native-reanimated/) library.

![Layout Cards Animation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nmmrqyz1hb08xmdj4isl.gif)

Looks good, right? And it super easy to implement! 🎉

> **TLDR** You can find the source code on [reanimated-cards-layout](https://github.com/vladimir-vovk/reanimated-cards-layout) repo.

## Setup

First, we need to [create](https://dev.to/vladimirvovk/starting-a-react-native-project-in-2022-31m7) a new React Native project. Then we will need to install `react-native-reanimated` library and `reanimated` babel plugin. Please follow the [documentation](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation) to do that.

## Layout Animation

Imaging we have a "child" `Card` component:

```tsx
const Card = ({ image, title }) => (
  <View style={styles.container}>
    <Image source={image} />
    <Text>{title}</Text>
  </View>
)
```

And a parent component which renders the list of cards:

```tsx
<View style={styles.row}>
  {cards.map(({ image, title }) => (
     <Card
       image={image}
       title={title}
     />
  ))}
</View>
```

Now, to be able to animate cards entering, exiting and layout changes, all we need to do is slightly change the `Card` component:
- Switch from the `View` to `Animated.View` component.
- Add `entering`, `exiting` and `layout` props to it.

```tsx
import Animated, { FadeOutDown, FadeInUp, Layout, Easing } from 'react-native-reanimated'

const Card = ({ image, title }) => (
  <Animated.View 
    style={styles.container}
    layout={Layout.duration(200).delay(200)}
    entering={FadeInUp}
    exiting={FadeOutDown}
  >
    <Image source={image} />
    <Text>{title}</Text>
  </Animated.View>
)
```

That's all! 🥳

We can use predefined [entering](https://docs.swmansion.com/react-native-reanimated/docs/api/LayoutAnimations/entryAnimations), [exiting](https://docs.swmansion.com/react-native-reanimated/docs/api/LayoutAnimations/exitAnimations) and [layout transitions](https://docs.swmansion.com/react-native-reanimated/docs/api/LayoutAnimations/layoutTransitions). Or create a [custom animation](https://docs.swmansion.com/react-native-reanimated/docs/api/LayoutAnimations/customAnimations).


If you have any questions, please post them in comments, press 💖 button and happy hacking! 🙌🏻

## Credits

Photo by [Pixabay](https://www.pexels.com/photo/gray-standard-color-book-near-green-eraser-159045/).
Installing NodeJs on Linux
Tags: linux, node, webdev
Published: 2022-04-18 20:52:12

OK so you've got Linux installed and want to start developing on an Node environment, But when you run the installer via `apt` for example, you aren't getting the latest version. Well that's because Linux distribution (in my case Ubutunu) package manager doesn't have the latest version.


## Step 1 - Getting the latest version:

Download the latest `tar` file from [here](https://nodejs.org/en/).


## Step 2 -  Finding the file

Open up your terminal of choice and navigate to where you downloaded the `tar` file. For me this was `Downloads`

so I'd have written:
```
cd Downloads
```

## Step 3 - Update System Packages

Make sure your system is using the latest packages before installing new packages

```
sudo apt update
```

## Step 4 - Install XZ Utilities:
> XZ Utils is a set of free software command-line lossless data compressors, including lzma and xz. In essence these are some powerful tools for file / compression manipulation.

```
sudo apt install xz-utils
```


## Step 5 - "Install" Node JS `tar` file:

You can either extract the `tar` file by opening in Linux and clicking the extract button at the top, or you can use the terminal (my preferred method - as gets you more familiar with the terminal).

To extract with the terminal run the following command:

```
sudo tar -xvf name_of_file
```
-x: sets the tar command to extracting
-v: sets the output to verbose outputting all the filenames in the tar.
-f is a flag for specifying a filename

## Step 6 - Extracted - Now Install to Directory

So now we have the extracted contents, let's move this contents to our installation folder, using the command:

```
sudo cp -r directory_name/{bin,include,lib,share} /usr/
```

Explanation:
`cp`: copy files command
`-r`: copy all directories / copy a directory
{bin,include,lib,share}: tells the copy command to copy these matching directories

to the `/usr/` folder.

## Step 7 - Check the node version installed

Run `node --version` in the terminal, and it'll tell you what version of node you have installed. If this is successful, you should see the version of Node you downloaded in Step 1.
My iOS app.. a few weeks later
Tags: ios, mobile, discuss, beginners
Published: 2022-04-18 20:49:09

As you may have seen the other day I posted about my app and about it getting released onto the App Store. 

Here’s a little update for you. Since making the post I have seen an increase in users in another six countries. So thank you all who downloaded it and used it! 

So now, that’s a total of twelve countries with the highest users in the UK & USA. 

I know to most this is a small achievement but to me it’s something special so thank you all.

If you wish to check it out here us the App Store link. [Download Notie App](https://apps.apple.com/gb/app/notie/id1617517158)

Let me hear about your app successes and fails … 

Thank you!
Django
Published: 2022-04-18 20:48:42

NoReverseMatch at / Reverse for 'profile' with arguments '('',)' not found. 1 pattern(s) tried: ['profile/(?P[^/]+)/$']

It's means something missing in database thats you are working for in loops .Django won't be able to properly construct the url if somthing is blank. First go to the Django admit panel and find whats are missing.Example:Author,User,Admin etc.
my experience with blazor
Tags: blazor
Published: 2022-04-18 20:42:00

When I wrote my first [project](https://github.com/3mam/PolySnake) in this year, I don't even planed to used blazor. But my childlike curiosity directed me on that path. 
I wanted to know, haw hard will be port game from desktop to web browser in .net. And I found out is not that hard.
But I have experience with similar tools before. I used [gopherjs](https://github.com/gopherjs/gopherjs) and [emscripten](https://emscripten.org).
Thanks to that I know what must to do, to communicate c# with javasrcipt.
I made working blazor port pretty fast. Not only server side but webassembly to.
Of curs create port for different platform always generate some problems.
Most weird problem I have in blazor is how floating point number behave.
I received in some cases NaN values. This problem I resolve adding value like **0.0001** in calculation.

Blazor server work differently then wasm. But I don't expected that server version will be cause game to flickering.

![game flickering](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58q4h0r3yqejsbpve6ty.gif)

This is happen when server don't have enough cpu power.


Now when I know pros and cons of blazor for creating game, I start thinking about next game.
But I focus only on wasm version and smartphones. This will be challenge, I do not doubt that. 
Maybe blazor is not perfect tool for this task. But I see some potential, and is nice to use c# in web browser.
CarbonAPI - Track Your Carbon Footprint Using Our UI And API
Tags: programming, api, algorithms, javascript
Published: 2022-04-18 20:41:31

CarbonAPI provides a simple, efficient way to calculate the carbon footprint of your industry and you will get the CO2 data in Kg. This platform is easy to use because it has a user interface (UI) and also use an API, developers will find it useful because it allows them to simply incorporate all of the data into a platform or application.

CarbonAPI's Functionalities:

- Easy to integrate
- Calculate the emissions in real-time
- Transparent Reporting
- API Access

We help your industry achieve climate goals and impulse social responsibility in your company. According to research, businesses that embrace sustainability are more commercially viable.


You can try out our API for free https://www.trycarbonapi.com/
My week so far
Tags: discuss, javascript, discord
Published: 2022-04-18 20:34:26

Anyone else work really hard on a feature, then just give up after a while and find a new solution... That was me just now, tried adding a notification system to my Discord bot only for me to give up 2 hours in, and switch to it DMing said user about something they submitted being approved.

On another note, I reached out to Discord to request the message intent, and to my surprise was responded to in under 24 hours, best support I've received from them so far!

Bot also gained quite a few servers overnight, so I'm excited about that, feeling really good about this bot now, maybe it can be a full time job once I start monetizing it? Who knows!

I expect to do a Live Q&A for said bot in a few weeks or so, that'll be fun as well, engaging with users is key to a successful product!
How to set cookie using ExpressJS response.
Tags: cookie, express, node, httplonly
Published: 2022-04-18 20:03:38

## What is cookie?

Cookies is simple key value pair stored by web server on clients browser to store/maintain user’s state.

## How it is different from Localstorage?

Locastorage can also be used to store user’s state, but cookies has more advanced configurations like — expiration time, same site, secure flag, Httponly, etc. By using these advanced configurations we can programatically manage user’s state. It is considered that cookies are more secure than Localstorage in terms of handling user session or secret values like authentication tokens.

## What is Httponly cookie?
A Httponly cookie is a simple cookie which is set by server with httponly flag as true which cannot be accessed by client side javascript.

## Example
{% embed https://gist.github.com/mybytecode/d4a2dd5d85b701dc1e7fb5adff0d3f64 %}

If you want to learn more, reach out to me at — https://twitter.com/akshay_nocode
Using s3 commands with aws cli
Published: 2022-04-18 19:51:27

This write up describes some of the commands you can use to manage your s3 buckets and objects using aws s3 command line interface.

<u>__create a bucket__</u>

To create an s3 bucket with the command line, we use __s3 mb__.
Note that the name given to an s3 bucket must be globally unique. It can contain letter or number, and cannot contain a period next to a hyphen or another period.

__syntax__
$ aws s3 mb <target> [--options]

__example__
aws s3 mb s3://bucket-name

<u>__2. list buckets and objects__</u>

$ aws s3 ls
Using this command without an option attached list all buckets.

__To list the object contained in specific folder(prefix)__
$ aws ls s3://bucket-name/example/

__3. Delete bucket__

$ aws s3 rb s3://bucket-name

By default, AWS does not allow you delete a bucket that is not empty. In order to by pass that, you must add __--force__ option. However, if versioning is enabled in the bucket, then even this option won't work.

__4. Move objects__

To move a folder in an s3 bucket to another s3 bucket, use:
   $ aws s3 mv s3://bucket-name/example s3://my-bucket/

To move a  local file from your current working directory to the Amazon S3 bucket:
    aws s3 mv filename.txt s3://bucket-name

To move a file from your Amazon S3 bucket to your current working directory:
  aws s3 mv s3://bucket-name/filename.txt ./

__5. Copy objects__
To copy objects in an s3 bucket to another:

   $ aws s3 cp s3://bucket-name/example s3://my-bucket/

To copy a local file from your current working directory to the Amazon S3 bucket:
  $ aws s3 cp filename.txt s3://bucket-name