teleren/devto huggingface dataset:
JavaScript arcade machine
Tags: discuss, javascript
Published: 2020-04-04 14:50:15

I want to build a **JavaScript arcade machine** for education purposes. This arcade machine will motivate kids to learn to code.

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

Imagine a coding club having this machine. Kids will develop their own mini-games (using the above mentioned platform) and then they will play them on the arcade machine! Even crafty parents will be able to build this machine for their kids.

The arcade machine will be obviously integrated with the [codeguppy.com](https://codeguppy.com) coding platform. The arcade will show a nice menu with best [codeguppy.com](https://codeguppy.com) programs and will allow users to play them using the joystick and buttons.

The project has 3 main parts:

- the arcade machine cabinet (build instructions, etc.)
- the arcade machine electronics (I've selected Raspberry Pi as a SBC)
- the arcade machine software (HTML5 Based running in full screen Chromium)

I would appreciate if you can provide me suggestions / feedback about the project overall, as well as about the above 3 main parts of this project.

Thanks in advance for your feedback!
What’s your alternative solution? Challenge #11
Tags: challenges, discuss, javascript, codenewbie
Published: 2020-04-04 14:31:50

# About this series

This is series of daily JavaScript coding challenges... for both beginners and advanced users.

Each day I’m gone present you a very simple coding challenge, together with the solution. The solution is intentionally written in a didactic way using classic JavaScript syntax in order to be accessible to coders of all levels.

Solutions are designed with increase level of complexity.

## Today’s coding challenge

```
Calculate the average of the numbers in an array of numbers

```

(scroll down for solution)

## Code newbies

If you are a code newbie, try to work on the solution on your own. After you finish it, or if you need help, please consult the provided solution.

## Advanced developers

Please provide alternative solutions in the comments below. 

You can solve it using functional concepts or solve it using a different algorithm... or just solve it using the latest ES innovations.

By providing a new solution you can show code newbies different ways to solve the same problem.

## Solution

```javascript
// Solution for challenge11

function averageArray(ar)
{
    var n = ar.length;
    var sum = 0;
    
    for(var i = 0; i < n; i++)
    {
        sum += ar[i];
    }
    
    return sum / n;
}

var ar = [1, 3, 9, 15, 90];
var avg = averageArray(ar);

println("Average: ", avg);

```


To quickly verify this solution, copy the code above in this coding [editor](https://codeguppy.com/code.html) and press "Run".

> Note: The solution was originally designed for [codeguppy.com](https://codeguppy.com) environment, and therefore is making use of `println`. This is the almost equivalent of `console.log` in other environments. Please feel free to use your preferred coding playground / environment when implementing your solution.
What is a good rule of thumb to write dependencies in package.json or Gemfile, and semantic versioning
Tags: npm, bundle, gemfile, webdev
Published: 2020-04-04 14:21:22

A good rule of thumb is, specify the version that can pull the latest version, but is backward compatible with earlier versions, so that we get small updates and bug fixes, but not a version that can break our project.

The [version number has a meaning](https://semver.org/).  And it is written by the founder and CEO of GitHub, so we may want to take a look.

In `package.json`:

```js
"react": "^16.14.0",
```

The `^` means "compatible".  In the above case, it means `16.x.x`, but not `17.0.0`, because `17.0` may break our project, and we want to be careful about it. (that's why in the Gemfile case below, the operator is called a "pessimistic operator".)  If a programmer is optimistic, it can be written as

```js
"react": ">=16.14.0",
```

which means `16.14.0` or above, including `17.0` or `23.0`.  That might be "too optimistic".

More reference: [`package.json` dependencies](https://docs.npmjs.com/files/package.json#dependencies).

In a `Gemfile`:

```ruby
gem 'sqlite3', '~> 1.4'
```

The `~>` has 3 names: pessimistic operator, twiddle-wakka, and eating bacon.

Note that the first character is a tilde:

![pessimistic operator](https://dev-to-uploads.s3.amazonaws.com/i/qbpg7n5xdj7rpbdds51y.png)

In some font, it can look like a hyphen.

The above means `1.x.x`, but not `2.0.0`.

Note that we can't write

```ruby
gem 'sqlite3', '~> 1.4.0'
```

to mean the same thing. Because that means in `Gemfile`: "`1.4.x` but not `1.5.0`."

In a `Gemfile`, to achieve what `package.json` is doing, it can be:

```ruby
gem 'sqlite3', '~> 1.4', '>= 1.4.1'
```

meaning at least `1.4.1` **and** `1.x` but not `2.0`.  The reason we want to be specific about `1.4.1` may be due to a bug fix in `1.4.1` or any other reasons.

Reference: [dependencies in `Gemfile`](https://guides.rubygems.org/patterns/#declaring-dependencies).
A quick tip: Compress multiple folders into individual zip files - macOS
Tags: productivity
Published: 2020-04-04 14:03:21

1. Open **Archive Utility.app** with Spotlight or Alfred (`⌘ + spacebar`)
2. Go to `File > Preferences` or press `⌘ + ,`
3. Change the `Use archive format` preference to `Zip archive`
4. Optionally you can move to trash or delete folders with `After archiving` settings
5. Drag and drop the folders into the Archive Utility icon in the dock.

That’s it. I hope that this will help you! Thanks for reading.

This article was originally published on [Medium.com](https://medium.com/@LukasPolak/quick-tip-compress-multiple-folders-into-individual-zip-files-macos-af25603a94a9)
World of WoqlCraft - Ep.2 continue crafting schema
Tags: tutorial, python, query, database
Published: 2020-04-04 13:45:51

---
title: World of WoqlCraft - Ep.2 continue crafting schema
published: true
description: We tried to continue building the schema, only being brutally ended by my poor internet connection.
tags: Tutorial, Python, Query, Database
---
We tried to continue building the schema, only being brutally ended by my poor internet connection.

Find the source code from our [tutorial repo](https://github.com/terminusdb/terminus-tutorials).
How to have an updated desktop background from NASA's pictures
Tags: groovy, nasa, linux
Published: 2020-04-04 13:39:11

NASA has a website (https://apod.nasa.gov/apod/astropix.html) where publishs every day an astronomy picture plus a brief description

I have this url in my bookmark and usually I use the picture to change my Desktop background (they have a lot of great pictures) so I decided to have a cron to change it automatically but after a while I realized that most of the time I didn't know what I was watching so I included the explanation in the picture and now this is how my desktop looks

![venus](https://dev-to-uploads.s3.amazonaws.com/i/af76pot8ng57s6l2fz24.jpg)

## Script

I use a little groovy script to download the json where the url and the explanation are and after downloaded the image I "inject" the explation into it in several lines (as the explanation can be large I take only a few hundreds of chars and split them)

{% gist https://gist.github.com/jagedn/8d7244d0595a27001b2c37fceb631be9 %}

as you can see the script perform this actions:
- parse the current JSON directly from NASA's website
- check if the picture is a valid extension (from time to time it's a video)
- download the image into a `Graphics`
- split the 300 first chars of the explanation into 3 `String`
- paint every string at the top of the picture
- save the picture as $HOME/Pictures/nasa.jpg

## Cron

I use crontab to run this script every hour: 

`crontab -e`

```
0 * * * * JAVA_HOME=$HOME/.sdkman/candidates/java/current $HOME/.sdkman/candidates/groovy/current/bin/groovy $HOME/nasa.groovy 
```

but you can use others approach, for example as an startup program

## Desktop settings

Now it only remains to change my Desktop background as $HOME/Pictures/nasa.jpg and when the NASA update the picture of the day I'll have my desktop updated
Day 1 - Balanced Brackets
Tags: python, hackerrank, discuss
Published: 2020-04-04 12:59:42

---
title: Day 1 - Balanced Brackets
published: true
description: 
tags: #python #hackerrank #discuss
---
Below mentioned problem is not a leetcode problem. This was one of the practice problems on Hackerrank.

Complete the function isBalanced in the editor below. It must return a string: YES if the sequence is balanced or NO if it is not.

isBalanced has the following parameter(s):

s: a string of brackets

**Problem Statement** - https://www.hackerrank.com/challenges/balanced-brackets/problem

**Solution Approach**

1. Iterate over the given string.
2. If you encounter an opening bracket "([{" push it to the stack.
3. If you encounter a closing bracket pop the topmost element from the stack.

```
class Stack:
    def __init__(self):
        self.items = []

    def push(self, element):
        self.items.append(element)
    
    def pop(self):
        return self.items.pop()

    def size(self):
        length = len(self.items)
        return length

    def peek(self):
        return self.items[len(self.items)-1]



def isBalanced(s):
    stack = Stack()
    result = True
    for x in s:
        if (x=='[') or (x=='(') or (x=='{'):
            stack.push(x)
        elif (x == ']') or (x == ')') or (x == '}'):
            if stack.size() > 0:    
                topmost_element = stack.pop()
                if ((topmost_element == '[') and (x != ']')) or ((topmost_element == '(') and (x != ')')) or ((topmost_element == '{') and (x != '}')):
                    result = False
                    break
    if stack.size() == 0 and result:
        return "YES"
    else:
        return "NO"
```

Alternate approaches to optimize the solution are welcome. No code snippets. Just discussion. :)
Quick prototyping Web App / Mobile App
Tags: development, webapp, mobileapp, quickprototyping
Published: 2020-04-04 12:49:00

---
title: Quick prototyping Web App / Mobile App
published: true
description: Thoughts on latest technologies on how to quickly prototype
tags: development, webapp, mobileapp, quickprototyping
---
Hi everyone. I would like to hear your thoughts about the latest technologies you find very easy to quickly prototype a modern web app / mobile app (also considering the learning curve here as well)?
Debug#Host Servers on your localhost
Tags: localhost, customdomain, debugging, hosting
Published: 2020-04-04 12:33:58

Disclaimer: I am author from <a href="https://tunnel.staqlab.com/" target="_blank">Staqlab Tunnel</a>.This blog contains reference to services provided by tunnel-staqlab.
Do give me a thumbs up, if you find this blog useful

One of the major part of coder life is testing.When it comes to stand-alone consoles apps the testing is pretty easy.You just hook up some debug breakpoints in your favourite IDE and hit the debug button and <i>vola</i> you could see all the variables and inspect your code right-in where you placed your breakpoint.

But what if you rely on some external services to get your code working...

As for example, most of the REST/HTTP  applications contains webhook routes from external services as a major part of the workflow.

<b>You just want requests from these services to be forwarded to your localhost!!! But wait what, is this possible?</b>
Can your localhost be connected over to the internet and traffic from web is forwarded to your local machine?

Yes this is possible through principles of <a href="https://www.ssh.com/ssh/tunneling/" target="_blank">SSH Tunneling</a>.
There are already tunnels servers like <a href="https://tunnel.staqlab.com/" target="_blank">Staqlab Tunnel</a> which forwards traffic from web to your localhost.

The guide on staqlab is pretty self-explanatory. However lets discuss step-by-step procedure here also.
I will assume your server is running on localhost:3000
At the end of this tutorial you will be able to get a public url, which points to server running locally on port 3000.<i>Do mind that the port can be any valid port.It doesn't necessarily be 3000</i>

<h3>Step 1:</h3>
Download tunnel client for you pc from https://tunnel.staqlab.com/downloads
<br>
<h3>Step 2:</h3>
Go to your downloads folder and unzip the zip file downloaded
<br>
<h3>Step 3:</h3>
Open terminal and navigate to folder where you have placed the downloaded file. and paste below command
<code>./staqlab-tunnel 3000</code>
if you want to have a custom domain.Look, its also possible.Replace above command with below command.
<code>./staqlab-tunnel 3000 hostname=&lt;your-domain&gt;</code>
e.g
<code>./staqlab-tunnel 3000 hostname=kitty-lovers</code>

After following above steps, you will be greeted with 3 urls on your terminal window.
<img src="https://tunnel.staqlab.com/img/sample-output.png"></img>

First one, is inspector url. Its a powerful tool where you can investigate and replay all the http/https traffic  from/to your server

The second and third url are http and https versions of the the public url which is in this case is   
Just copy this url and paste it in your browser and see the magic, you can 
see response from your pc on the your browser window.
<br>
Share this url with your colleagues, and display your work over the web!!
How would you design the twitter timeline?
Tags: design, architecture, tutorial, codenewbie
Published: 2020-04-04 12:02:29

#### A formidable design problem
All of us use/have used twitter at some point of time in our lives. Part of the reason why **Twitter** is successful, I believe is because the concept is so simple at its core:
- phrase your idea in **280 characters** or less and then with the press of a button, broadcast it to the world.

- And then, whenever someone who ***follows*** you logs in, they will get to see that *tweet* in their **timeline**.

But have you ever imagined the **logistics** behind implementing this **simple** concept? What would happen when people with **millions & millions** of followers send out a tweet and each of their followers expects that tweet to appear in their timeline in real-time?

I created this video which was originally based on this talk by **Raffi Krikorian** who was a senior director at twitter at that time. Although the talk is quite old, it gives us an insight into how designing anything should be approached at the scale of Twitter.

{% youtube 1LcyCbly73U %}

If you were to design it today, how would you do it differently? Let me know your views in the comments section.
E2: Are You New to UX? Here Are The Best 5 Tips (And How To Actually Make Them Work)
Tags: ux, ui, designer, design
Published: 2020-04-04 11:44:55

💪In this video, we will talk about⬇️
1. How to find a mentor
2. The importance of a design portfolio
3. How to overcome perfectionism
4. How to fight the imposter syndrome
5. How to improve your empathy skills

Previous episode [here](https://dev.to/eleftheriabatsou/e1-should-designers-learn-to-code-why-it-s-not-a-good-question-860)!

👋Hello, I' m Eleftheria, an app developer, master student, freelancer, public speaker, and chocolate lover.

This is a new series on my channel and I'm going to be talking about UX and UI.
This is the 2nd episode out of 8.
If you have any feedback, please do share it with me. Thank you.



😎Top 3 list:
- How to stay motivated | A developer's edition | @BatsouElef: https://youtu.be/qMvEtb5OxNo
- How to be a Better Problem Solver | Tips and solutions: https://youtu.be/dELt7yKIxIA
- Simple Tips to Build a Personal Brand as a Developer (+ personal examples): https://youtu.be/7s0o1gi0iP0

🥰If you liked this video please share

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!


**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/eleftheriabatsou/)
How To Add An Empty Directory To A Git Repository — Two Different Use Cases
Tags: git, gitignore, todayilearned, tutorial
Published: 2020-04-04 17:04:26

---
title: How To Add An Empty Directory To A Git Repository — Two Different Use Cases
published: true
date: 2020-04-04 11:43:05 UTC
tags: Git,gitignore,todayilearned,tutorial
canonical_url: https://www.oncrashreboot.com/how-to-add-an-empty-directory-to-a-git-repository
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/j9g12xugcwtr1ffampla.jpg
---

Git lets you only add files to the index. If you want to add a directory, then [Git does not have a builtin solution](https://git.wiki.kernel.org/index.php/Git_FAQ#Can_I_add_empty_directories.3F) for you. Of course, there are ways to work around this issue.

## Add a directory but ignore its contents

If you want to add an empty folder to Git index, but you want Git to omit the present and future contents of the directory. Then, create a `.gitignore` file inside the directory and add these lines to the `.gitignore` file:

```bash
# Disregard this entire folder
*
# Except this .gitignore file
!.gitignore
```

Then add and commit this `.gitignore` file. This solution results in a directory that is present inside Git, but its contents never get added to the Git.

A possible use case scenario of this solution is to add the debug folder of a project to the index. Almost always, you do not want the contents of your debug folder to end up in the Git index. But you may need to keep the debug folder in the index because you have relative paths in your code or you want all your teammates to have the same folder structure.

## Add an empty directory and track its future contents

Say, you want to add a folder to the index. It is currently blank, but you plan to add files to it that Git should track. The only solution is to create a file in the directory and add it to the Git.

Git community has settled on creating an empty file called `.keep` in the directory and adding it to the index.

```bash
mkdir hello
cd hello
touch .keep
git add .keep
git commit -m "add empty directory called hello"
```

`.keep` is not an officially prescribed name by the Git. You can use any other name. You can use "README" or "ABOUT", or even ["Intentionally Blank File"](https://en.wikipedia.org/wiki/Intentionally_blank_page). Your choice. `.keep` is the most preferred filename for this purpose. The `.` is the beginning of its name, ensures that it will stay hidden on Linux and macOS file systems.

A possible use case scenario is if you are creating a boilerplate folder structure, which you want to reuse in all your React projects. You create empty folders for containers, components, API and store. You add these empty folders to the Git repository. You then use the repository as a template for your future projects.

---

Cover Image Attribution: [James Best](https://unsplash.com/@jim_at_jibba)
How do you recover from a job rejection?
Tags: webdev, javascript, codenewbie, hiring
Published: 2020-04-04 11:00:15


Not long ago I’ve encountered this question from a connection I have on Twitter. 
It’s hard to deal with a “no” from a company you applied. It’s harder when the refusal comes from several companies for several weeks. I know it because I’ve been there.
But that’s not the end. 


In the following reading, I don’t pretend to know all about job hunting, I just want to share my own experience while I was seeking a job and I can tell you it’s difficult to find one with 40+ years. I’ll summarize it in 4 points. 

##The struggle is real.
I always admitted that a circumstance is something real. So the struggle is real, the frustration and the fear of tomorrow are real as well. I learn to cope with it by looking at the future, focusing on the present situation and use what I have in my hands and at hand. 

##Have a mental escape plan!
After almost one month of refusals I needed to accept that my brain, emotions and focus were about to crush. My self-confidence was shaken, my focusing to work on the small projects was almost lost, so I did something out of normal, for me at least it was uncommon: I stopped the job hunting!
I start focusing on my family, giving them a more special place in my attention and make it my safe place. Not the feelings I was dealing with after receiving the refusals. Which brings me to the third point of my story. 

##What you feel is real! What you are is different!
A lot of birds are flying over, not all of them has to have a nest on your head. The feelings you have doesn’t tell who you are. If you feel uncomfortable for not coding a day that doesn’t make you a bad developer. It’s just a day without coding. Period. *What you feel is not who you are.* It’s not a smart decision to allow a circumstance to dictate what you should feel and *we shouldn’t let people validate who we are!*

##You design your future. 
The last thing I want to share with you is about planning. No! It’s not a schedule and I promise, I won’t ask you a thing. 
After pausing all the thoughts about job hunting and just be with my family, all the bad feelings were gone. All the questions of what I was doing bad disappeared. I had the strength to look forward and I stopped imagine scenarios of the past interviews where all went bad. 
I rewrote the Resume and start applying... again. 
At the end of this story, I want to tell you something: you are on your own in this journey. What I mean by this is nobody will do the job hunting for you. Your future is designed by your decisions. Choose wise! Oh... and I lied! I said I won’t ask anything. I do: please apply! To as many companies you can. 

Stay strong, stay focused and stay blessed!
Luc.

######*I am Luc a 40+ age junior developer, if you would like to be part of my journey, you can follow me [here](https://twitter.com/accolades_dev) on Twitter.*
Twiliohackathon Project - COVID-19 - Social networking app
Tags: twiliohackathon, react, django
Published: 2020-04-04 10:54:53

---
title: Twiliohackathon Project - COVID-19 - Social networking app 
published: true
description: COVID-19 Social Networking app for the people stuck in lockdown
tags: #twiliohackathon #reactjs #django
---

COVID-19 Social Networking app for the people stuck in lockdown

 **What I want to build?**
 I will be building a social networking app through which users can communicate and help the people stuck in lockdown. Users can share and post how they are contributing and helping those how are in need.

***Demo link***
coming soon

***Project Link***
coming soon

***How I built it (what's the stack? did I run into issues or discover something new along the way?***
coming soon.

***Additional Resources/Info***
COVID-19 is a pandemic that has affected every aspect of lives across the globe. Many countries have announced a lockdown due which many are stuck in foreign countries and don't have enough resources.

***Hackathon Home Page***
https://dev.to/devteam/announcing-the-twilio-hackathon-on-dev-2lh8
So many Types of Probability distributions
Published: 2020-04-04 10:54:52

Today in my Nanodegree course, I got to be aware of some of the different types of probability distributions
The common ones are 
 - the continuous probability distribution(CPD) and 
 - the discrete probability distribution (DPD)

CPD in terms of  Normal Distribution( Gaussian distribution)
DPD in terms of  Binomial Distribution 

I guess for CPD, the random variable ( variable in question) can be any range of number while fo the DPD, the random variable are discrete( integers) only

Some questions that popped up to my minds are
1. What are the other PDs?
2. How are the Bernoulli and multinominal different? 
3. And when do you use each in naive Bayes

I also have to know how to build the gaussian distribution and any other distribution from scratch.