teleren/devto huggingface dataset:
Adventures in Readability
Published: 2020-05-17 05:45:39

Take for example, this block of code that takes info from a COVID api & organizes it.
```
processData = (results) => {
		let states = {};
		for (const result in results){
			const info = results[result];
			const state = info.Province
			const city = info.City
			if (Object.keys(states).includes(state)) {
				if (Object.keys(states[state]).includes(city)) {
					states[state][city].push({
						date: info.Date,
						cases: info.Cases
					})
				} else {
					states[state][city] = []
					states[state][city].push({
						date: info.Date,
						cases: info.Cases
					})
				}
			} else {
				states[state] = {}
				states[state][city] = []
				states[state][city].push({
					date: info.Date,
					cases: info.Cases
				})
			}
			
		}
		return states;
	}
```
The results are given to this function and sorted into a new object, organized by State and City.  During iteration we check to see if the new object being created already has certain keys.  Adding to those keys if they exist and creating them if not.  But how does this look?  Readability-wise I'd say it leaves something to be desired.  By separating some concerns we can make this a little easier to look at.
```
    provinceInStates = (entry) => {
		const { states } = this.state
		return Object.keys(states).includes(entry.Province)
	}

	countyInState = (entry) => {
		const { states } = this.state
		return Object.keys(states[entry["Province"]]).includes(entry.City)
	}
	addEntryToState = (entry) => {
		const { Province, City } = entry;
		let newStates = this.state.states
		newStates[Province][City].push(entry) 
	}
	createEntryInState = (entry) => {
		const { Province, City } = entry
		let newStates = this.state.states
		newStates[Province] = {}
		newStates[Province][City] = []
		newStates[Province][City].push(entry);
		this.setState({ states: newStates })
	}
	createCountyInState = (entry) => {
		const { Province, City } = entry;
		let newStates = this.state.states;
		newStates[Province][City] = []
		newStates[Province][City].push(entry)
		this.setState({ states: newStates })
	}

	sortDataToStates = (data) => {
		const {
			provinceInStates, countyInState, addEntryToState, 
			createCountyInState, createEntryInState 
		} = this;
		
		for (const info in data) {
			const entry = data[info];
			if (provinceInStates(entry)) {
				countyInState(entry) ? 
					addEntryToState(entry) 
				: 
					createCountyInState(entry);
			} else {
				createEntryInState(entry);
			}
		}
	}
```
This last function, sortDataToStates, looks a bit easier to read.  The logic to determine if the appropriate keys have been added to the final result have been separated out.  This in turn has made reading the if condition that much smoother.
Learn the art of managing time
Published: 2020-05-17 05:38:33

Every person struggles in managing time and work activities at some point in their life. This is why here we have shared some useful information with the help of which you can make an impactful work plan or schedule for accomplishing your work goals and objectives.

Plan your Week Ahead: Okay, so the first thing you need to do is to simply plan your week in advance. For example, if your week starts on Monday, then plan the entire week on Sunday only. Having a work plan ready for the week keeps you more focused and also removes all those problems which could have happened due to lack of planning.

Use Printable Calendar: There are numerous tools and software available these days, but most of them are paid and you need to learn how to use them. So why not using the printable calendar templates for managing or planning your work. If you are planning to use calendars then do check out http://scheduleidea.com/  they provide free editable calendar templates.

Here are links to download monthly calendars;

http://scheduleidea.com/august-calendar/
http://scheduleidea.com/september-calendar/
http://scheduleidea.com/october-calendar/
http://scheduleidea.com/november-calendar/
http://scheduleidea.com/december-calendar/
http://scheduleidea.com/employee-attendance-sheet/
React Drive - An all-in-one react wrapper around Google's drive file picker. Supports direct downloads & blob exports.

Tags: react, javascript, webdev, opensource
Published: 2020-05-17 04:44:23

https://github.com/alexgurr/react-drive

https://developers.google.com/drive/api/v3/picker

I made this library to try and solve a bit more of the file picker flow, while providing a bit more simplicity with use. React drive can automatically pull down any selected files as blobs or download them directly to the user's machine (as well as passing the drive docs if needed).

Examples and docs in the readme. Feel free to add any issues/feature requests in the repo.

There's only one existing library that's similar to this and it doesn't really have any smarts around post-file selection. It also exposes a lot of props that really aren't needed in my opinion.
Docker: configure tzdata and timezone during build
Tags: docker, automation
Published: 2020-05-17 05:03:33

---
title: Docker: configure tzdata and timezone during build
published: true
date: 2020-05-17 03:50:05 UTC
tags: Docker,automation
canonical_url: https://rtfm.co.ua/en/docker-configure-tzdata-and-timezone-during-build/
---

![](https://rtfm.co.ua/wp-content/uploads/2015/09/docker_lxc-1.png)During a Docker image build – it stops asking to configure the `tzdata`.

`Dockerfile` at this moment is the next:

```
FROM ubuntu:18.04
RUN apt update && apt install -y python-pip python-dev ssh python-boto3
RUN pip install ansible==2.4.3.0
```

Let’s reproduce – run the build:

```
admin@jenkins-production:~$ docker build -t proj/proj-ansible:1.1 .
Sending build context to Docker daemon  29.62MB
Step 1/3 : FROM ubuntu:18.04
---> 113a43faa138
Step 2/3 : RUN apt update && apt install -y python-pip python-dev ssh python-boto3
...
Setting up tzdata (2018d-1) ...
...
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration questions will narrow this down by presenting a list of cities, representing the time zones in which they are located.
1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
2. America     5. Arctic     8. Europe    11. SystemV
3. Antarctica  6. Asia       9. Indian    12. US
Geographic area:
```
And here it hangs waiting for us enter data, and even after you’ll enter a region – the process will not resume.

To avoid this data-enter request, especially when such build is running on CI like Jenkins – you can configure `tzdata` directly in the `Dockerfile` so it will be set during the `docker build`.

To do so, create a variable called `$TZ` which will hold our timezone, and the create a `/etc/timezone` file:

```
FROM ubuntu:18.04
ENV TZ=Europe/Kiev
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y python-pip python-dev ssh python-boto3
RUN pip  install ansible==2.4.3.0
```

Build again:

```
admin@jenkins-production:~$ docker build -t proj/proj-ansible:1.1 .
Sending build context to Docker daemon  29.62MB
Step 1/5 : FROM ubuntu:18.04
---> 113a43faa138
Step 2/5 : ENV TZ=Europe/Kiev
---> d2debbbd9f86
Step 3/5 : RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
...
---> 0d2422a01f56
Successfully built 0d2422a01f56
Successfully tagged proj/proj-ansible:1.1
```

Done.

### Similar posts
 
- <small>02/24/2020</small> [Linux: PHP-FPM, Docker, STDOUT and STDERR – no an application’s error logs](https://rtfm.co.ua/en/linux-php-fpm-docker-stdout-and-stderr-no-an-applications-error-logs/)
- <small>02/15/2019</small> [Docker: RabbitMQ: exec(): Unable to fork, Prometheus node\_exporter и Docker limits](https://rtfm.co.ua/docker-rabbitmq-exec-unable-to-fork-prometheus-node_exporter-i-docker-limits/)
How to turn your idea into more than just a thought.
Published: 2020-05-17 03:46:32

# *Blog-O-Matic* is the app that removes all excuses that prevent you from creating your "personal brand" online! 

So many people with great ideas and dreams, small and large, never even begin their journey to see if it could become a reality! 

## WHY? 

I think nobody wants that "fantasy" lifestyle of being self-employed and making money while doing something they actually love to fail. So much of our history has restricted the current generation of young people from believing in themselves. 

I teach my kids what I wish people in my life should have preached to me:

> "Fail soon, and don't worry. "

I force my kids to build their silliest ideas, and even serious ones. I want them to truly know if they would even enjoy whatever it is they want to do. And if they create a product or service, I encourage them to go shoe the internet world.

Nobody would have ever thought you would be able to play video games and have people *PAY* go watch it.

But where do you start? It's simple. 
> Publish content about whatever you think showcases your "idea"

### This is why Blog-O-Matic is being created.

* You don't know how to build a website to publish your stuff? 
* You don't know how to buy or use a domain name? 
* What's a CMS? 
* You don't want to use "another app". 

The best feature takes care of: 

> "But I don't want to type, or find images, or even make it look nice... I just want to write like it's an SMS TEXT, and hit send!"

**Guess who has you covered. No more excuses.**

Send a message to find out more.
[Email](nick@musthavdskill.com)
So I made a blog.
Published: 2020-05-17 03:46:08

So, I made a blog using the [Stackbit](https://stackbit.com) integration here on Dev. I chose [Gatsby](https://www.gatsbyjs.org/), well because it's Gatsby. 

The main reason I am writing this post is to see if it is pushing from here. And later I will edit this to see if an edit pushes. 

So, lets see how it goes. 

## So this is the edit to see if it pushes here on the next day.
Get Free 3D Models in MS Paint 3D then Add it to BabylonJS Project
Tags: webxr, babylonjs, 3d, javascript
Published: 2020-05-17 03:36:21

---
title: Get Free 3D Models in MS Paint 3D then Add it to BabylonJS Project
published: true
description: 
tags: webXR, babylonjs, 3d, javascript
---

<a href="https://www.youtube.com/watch?v=u5j-yKAbiKI" target="_blank">
<img src="https://dev-to-uploads.s3.amazonaws.com/i/0788ljte7haitcapg9eu.png"></img>
</a>

1. Open Paint 3D
2. Click 3D Library
3. Search for the model you want
4. Select the model to add it to the canvas
5. `Menu` -> `Save As` -> `3D Model`
6. BOOM you have a free GLB 3D model to use in your game!

# Add it to BabylonJS

1. Copy GLB model file to the assets file in your project
2. Import the model into the scene:
```javascript
  SceneLoader.ImportMesh("", "/assets/", "grapes.babylon", scene, function (
    grapes
  ) {
    // Set the target of the camera to the first imported mesh
    camera.target = grapes[0];
  });
```
Happy game building!
Styling your RN app, easily
Tags: reactnative, javascript
Published: 2020-05-17 03:17:53

Recently i've published [Consistencss](https://consistencss.now.sh/), an utility first style toolkit for React Native, inspired by [tailwindcss](https://tailwindcss.com/).

---

Consistencss has not css at all, but is a JS library used to style your RN apps. how it works ?

Consistencss generates a dynamic object of styles like this:

`C.m4` -> returns { margin: 16 }, 

and so:

## Usage

```js
import { View } from 'react-native';
import C, { apply } from 'consistencss';

const App = () => {
  return (
    <View style={apply(C.m4, C.p2, C.bgRed)}>
      <Text style={C.textRed}></Text>
      <Text style={[C.textBlue, C.m6]}></Text>
      <Text style={styles.subtitle}></Text>
    </View>
  );
};

// apply also accepts strings
const styles = {
  title: apply(C.font6, C.uppercase),
  subtitle: apply('capitalize', C.mt2),
};
```

Take a look !
Test localhost on Oculus Quest with Remote Debugging in Firefox
Tags: oculus, webxr, javascript, vr
Published: 2020-05-17 03:15:10

---
title: Test localhost on Oculus Quest with Remote Debugging in Firefox
published: true
description: 
tags: oculus, webXR, javascript, VR
---

Here are some quick steps to help with debugging for WebXR. These things are LIFE CHANGING for WebXR development! Note: the steps are specific to Windows OS.

### Install Firefox and Android Debug Bridge (adb)
- Install [Firefox](https://www.mozilla.org/en-US/firefox/new/) on both the Oculus and your PC
- Install [Android Debug Bridge (adb)](https://developer.android.com/studio/command-line/adb)

### Add Android Debug Bridge (adb) to Path
 - Type `path` in the windows search and hit enter on `Edit the system environment variables`
 - Click `Environment Variables`
 - Select `Path` and click `Edit`
 - Select `New`
 - Paste the location of adb.exe. The location should be something like this `C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools`
 - Restart your computer

### Run the project locally and connect to remote debugging
- Open your WebXR Project (Starter Template for BabylonJS [Here](https://github.com/cassieview/babylonjs-webpack-typescript-starter-project))
- Run the project `npm start`
- Open Firefox on PC
- Connect to Oculus Quest to PC with USB
- Click the menu on the right of the Firefox browser
- Then select `Web Developer` -> `Remote Debugging`
- Click `Connect` on device

### Reverse the Ports to make `localhost` available
- Open cmd or windows terminal
- List connected devices: `adb devices`
- Set the reverse device id: `adb reverse -s <ID from device attached above>` 
- Reverse the port and update to the port you are using: `adb reverse tcp:8080 tcp:8080`
- If it gets disconnected (sometimes it does) just rerun the last cmd to reconnect.
- On the Oculus headset go to `localhost:8080` (update `8080` to your port)


That's it! You are now running localhost on your VR headset and the debug output on your PC.
I'm just some dude trying to Decentralize the Modern Internet
Tags: javascript, npm, blockchain, devops
Published: 2020-05-17 02:40:39

First off, allow me to introduce myself. My name is Andrew. Enough about me and more about what you actually came here to read. The internet as it stands has alot of problems. These problems include the selling of your personal data, censored opinions, lack of intellectual diversity and a seemingly more closed rather than open society. Many of the things that the internet was meant to do, solve and fix are now the same problems it is causing.

This lead me to [create an SDK](https://github.com/Lonero-Team/Decentralized-Internet) for building decentralized internet and distributed computing projects. Now, keep in mind this is still in beta and actively being developed. Also keep in mind I have about 125 hours worth of work I do each week, and a large sum of those hours are dedicated to a project that isn't too popular and has very few GitHub stars. That still doesn't stop me from coding something I know could be the future and am passionate about. Half these articles are just documentation of my journey getting there.

That being said, it isn't just me who is actively trying to fix the problems with the current internet. Many software engineers, developers, and startup founders seem to be on a similar boat mission-wise. If you go to NPM, you can find tons of torrent projects. Many lightweight decentralization SDKs are also built in Javascript. You have tons of protocols trying to change not just the way the internet works, but how computers communicate. Anyways, I know this seems like just a rant, but I really hope the future is drastically changed for the better as a result of this seemingly second dotcom boom. Even the [guy who created JavaScript](https://thenextweb.com/hardfork/2018/11/23/brave-blockchain-cryptocurrency-browser/) or the Web's [Tim Berners-Lee](https://www.theguardian.com/technology/2019/mar/12/tim-berners-lee-on-30-years-of-the-web-if-we-dream-a-little-we-can-get-the-web-we-want) seem to think this current internet got out of hand.
Erlang Run Time System Book
Tags: erlang, elixir, beam, erts
Published: 2020-05-17 03:12:55

I just finished reading The Erlang Run-Time System Book. The most awesome book that I got to read 😍. Hats off to the contributors 🎩. If you wish to get started with Erlang or Elixir, highly recommended to read. And please be kind to contribute. If you are a beginner, there are some typos that you can help with 💪.

Find the book here : https://blog.stenmans.org/theBeamBook/
If I could bring one thing back to the internet....
Published: 2020-05-17 03:00:36

This article is trending at #1 on hacker news right now:
[Read post here...](http://tttthis.com/blog/if-i-could-bring-one-thing-back-to-the-internet-it-would-be-blogs)

*I find it to be a sad truth that blogging is no longer about publishing content that reaches a specific audience*.
 <br />
**It is monetized by companies now and diminishes quality content if not cross-pulishdx or copied over to that platform** .

I love Blog-O-Matic, because it creates custom articles to try and allow the viewers to relate to the bloggers style. And the app doesn't force users to publish on a singular platform, but creates a custom website and URL BY DEFAULT!

Maybe I'm on to something here... I started this journey to give my kids a way to start creating a public profile to learn about "personal branding" (my 16 year old had turned his DJ/music producer hobby into something more "professional"), and now I can see the value in my approach. 

If you can leave a comment, could you tell me if you have started creating your own "public online profile"? Why did you start? If not, are you not for a reason? Maybe you see value in having content published while looking a job. Maybe you have a service you want to provide and you want to create articles promoting that. Let me know please?
Coding blogs to follow
Tags: coding, codepen, code, blog
Published: 2020-05-17 02:34:41

obviously https://dev.to 
https://scotch.io
https://css-tricks.com/
https://medium.com/
https://zerotomastery.io/
https://programmingwithmosh.com/
https://overreacted.io/
and last and must be one of the best
-Learn to code at home.
-Build projects.
-Earn certifications.
https://www.freecodecamp.org/
I hope you will pay me for the promotion or help me by sharing my [blog](https://codecarlosblog.netlify.app/) or visiting and donating!

like and comment if you have any other option and if you can share
Support API versioning with Lambda function and API gateway
Tags: aws, lambda, apigateway
Published: 2020-05-17 02:14:07

When you introduce breaking change to your API and you want to support existing clients at the same time, usually you need to provide multiple API versions. It is very easy to setup API versioning for lambda function and API gateway.

# Setup lambda function

Let’s say we have a lambda function called `my-hello-world`. This is how it looks like. (This is the sample code from AWS)

```javascript
exports.handler = async (event) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    };
    return response;
};
```

Before we update our source code, we need to publish a version and create an alias first.

```bash
aws lambda publish-version --function-name my-hello-world
```

We have created our version `1`. Next step is to create alias `version1`.

```bash
aws lambda create-alias \
  --function-name my-hello-world \
  --name version1 \
  --function-version 1
```

We have created our alias `version1`, so we can now update our source code. Make sure the version is selected as `$Latest`.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/urqhwciops0idho7qcs9.png)


Here is the source code. Only message is updated.

```javascript
exports.handler = async (event) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Franz!'),
    };
    return response;
};
```

Press `Save` button to save.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ekrxl9zmv3nj8gl0vgdw.png)

We can now publish new version `2` and create alias `version2`.

```bash
aws lambda publish-version --function-name my-hello-world
aws lambda create-alias \
  --function-name my-hello-world \
  --name version2 \
  --function-version 2
```

# Setup API gateway

Let’s create a new API. I called it `my-hello-world-api`.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zmrg7gmq6qb6s8c9es3d.png)

Under `/`, create `2` resources `v1` and `v2`.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/019ire0ajvc070gxy4qw.png)

Under `v1` and `v2`, create `GET` method. Make sure you put `my-hello-world:version1` for `v1`’s `GET` and `my-hello-world:version2` for `v2`’s `GET`.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/la4m8u9oc788bmm5osu3.png)

AWS will help you to create the required permission. Just press `OK`.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0jdv6j67j0yglpcx7xpz.png)

It is how it looks like.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/k0hc1xvh11iu55szhzvr.png)

We have completed the setup. Now we can test our API.

I tried `v1` and `v2`. You can see the messages in the responses are different.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3rmm4s11802rap26eklw.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/n0yxdqq06cm3nm3bqiyh.png)
How to turn your smartphone into a webcam for your pc
Tags: webcam, videoconference, tips
Published: 2020-06-15 14:53:35

---
title: How to turn your smartphone into a webcam for your pc
published: true
date: 2020-05-17 01:23:42 UTC
tags: webcam, videoconference, tips
canonical_url: https://www.ma-no.org/en/software/multimedia/how-to-turn-your-smartphone-into-a-webcam-for-your-pc
---

With the propagation of Covid-19 we all had to adapt to a new quarantine situation at home, and since the human being needs to communicate constantly, we used the internet channel to make group calls, be it between friends or business meetings.This has led to a rapid expansion of online videoconferencing platforms, we now have them for all tastes, and there are those who have created thematic platforms to interact with their clients, such as our collaborator Ilaria Cellura who has created an on-demand software that allows users to follow her Yoga, Pilates, etc. classes.Others have thrown themselves on social… !


Read on [📖!](https://www.ma-no.org/en/software/multimedia/how-to-turn-your-smartphone-into-a-webcam-for-your-pc)