teleren/devto huggingface dataset:
How to use the Ruby minmax_by Method
Tags: ruby, beginners
Published: 2020-05-20 20:58:24

#Intro
Hey, if you're a beginner in ruby or a senior developer, the minmax_by method is probably going to save you some time and thinking.

#Its uses are...?
Well, since you asked, its uses are pretty much straight forward. It returns the smallest and largest value in an iterable corresponding to the condition in the given block; without a block it returns an enumerator. So, it's used for strings, arrays, hash keys, etc., but its best use is making the lines and lines of code you may have written using the max() and min() methods utter trash! ![Trash](https://slator.com/assets/2019/12/BLEU_irrelevant-1.png)

#Syntax
The syntax for this method is quite simple and you're probably thinking 
![Probably not](https://media1.tenor.com/images/d86b45b718ad3deab6d69ecb1c61ac6d/tenor.gif?itemid=13496786)
but it's true. 
Without a block it looks like this:
{% replit @OreOlad2/ruby-tests %}
With a block you can do things like this:
{% replit @OreOlad2/ruby-minmax %}

####P.S. Creativity is Key
Be *creative* in your use of the method, it *really* helps.

#When to use it?
Not everyone, especially beginners, know when and why a specific method or function is a better option than what they're currently using. Questions like, why use map instead of each or the standard for statement, why puts instead of print, or why minmax_by instead of our old buddies max() and min(). The answer is simple, what do you need? If you're looking to get the maximum and minimum values from an iterable under specific circumstances, then yeah, minmax_by is your guy(unintended rhyme); if not then your more likely options are max() or min(), maybe even minmax (I know, another one). Like I said, creativity really helps. Be creative in your thought process, it'll make you proficient in ruby.

# #Knowledge
![Brain Power Picture: Floating Dude](https://i2.wp.com/www.thegraceinmylife.com/wp-content/uploads/2018/11/5014d5bc-68b4-4e49-9364-12feafa16bb5.jpg?resize=1080%2C1364&ssl=1)
Knowledge, or as I like to say #Knowledge, is the only thing standing in the way of you and creativity. You need creativity, so learn other ways to apply the minmax_by method.

#It's the End of the World !
![It's the end of the world as we know it!](https://images.penguinrandomhouse.com/cover/9780735228016)
If you got all the way to the end that's great. If you skipped some parts, that's alright as well.
How to always keep files open in Visual Studio Code
Tags: vscode, tricks, howto
Published: 2020-05-20 20:56:19

---
title: 'How to always keep files open in Visual Studio Code'
description: Solution to open files always in a new tab in Visual Studio Code
tags:
  - vscode
  - tricks
  - how-to
show: true
canonical_url: https://itsopensource.com/how-to-always-keep-files-open-in-vs-code/
published: true
---

Visual Code is an amazing editor and I use it for my everyday code. One thing bugs me every time is the files are not open permanently until I use the shortcut `cmd + k` `enter` or right-click and select `keep open` on the filename. This happens because the VS Code opens the files by default in `preview mode`, so whenever the new file name is clicked from explorer, the opened file closes and the new file is visible. But if you are equally frustrated by this behavior here is what you need to do.

The solution is way simpler than expected, just add the following line to your  `setting.json`
(Code Menu > Preferences > Setting)


```code
"workbench.editor.enablePreview": false
```

Follow me on [GitHub](github.com/championshuttler) and [Twitter](twitter.com/idkhtml)

Cheers!
---
Musare - Collaborative Music
Tags: octograd2020, githubsdp, showdev, opensource
Published: 2020-05-20 20:55:31

# ![Musare](https://github.com/Musare/MusareNode/blob/experimental/frontend/dist/assets/blue_wordmark.png?raw=true)

> An open-source music app where you can listen collaboratively to real-time curated or custom music stations with friends.
>
> [Explore for yourself at **musare.com**](https://www.musare.com)

The GitHub Education Pack was very useful for me and other students I collaborated with whilst developing this project. In particular, we utilised the access to free [GitHub Pro](https://github.com/pricing), and the benefits offered by [Mailgun](https://www.mailgun.com/), [Travis CI](https://travis-ci.org/) and [JetBrains](https://www.jetbrains.com/).

## The stack:

The project is separated into two different services - the frontend and backend. [Socket.io](https://socket.io/) is used as intermediary between the two. We also use [Docker](https://www.docker.com/) for managing the live servers and helping with local development.

#### Frontend

A [vue-loader](https://vue-loader.vuejs.org/) SPA [Single Page App.], which is served over [Nginx](https://www.nginx.com/).

Technologies used:
- [Vue.js](https://vuejs.org/) for building the user interface
- [Vuex](https://vuex.vuejs.org/) for handling state with Vue

#### Backend

A Node.js app that is build with scalability in mind for the future.

Technologies used:
- [Node.js](https://nodejs.org/) for server-side code
- [MongoDB](https://www.mongodb.com/) as a non-relational database
- [Redis](https://redis.io/) for caching (e.g. user sessions)

---

## The codebase:

{% github Musare/MusareNode %}

## Additional thoughts:

Musare is still in development with many more features planned, some of the in-progress work can be found on the [experimental branch](https://github.com/Musare/MusareNode/tree/experimental).

If you would like to contribute or try out Musare, please check out the links above! We have quite detailed guides in setting up a local instance on GitHub, and, if you need any help, we would love for you to get in touch (contact details available on the [readme](https://github.com/Musare/MusareNode/blob/experimental/README.md)).

Musare was a team-effort, but was developed mainly by myself and [Kristian Vos](https://github.com/krisvos130). The full team (past and present) can be found [on the website](https://www.musare.com/team).

It is also worth noting the idea for this project was originally developed in [Meteor](https://www.meteor.com/) by some of the team, mainly [Akira Laine](https://github.com/AkiraLaine) and [Kristian Vos](https://github.com/krisvos130).
Clean Coding React - Props
Tags: react, typescript, cleancode, tips
Published: 2020-05-20 20:55:22

---
title: Clean Coding React - Props
published: true
description: A clean pattern for declaring the type of props in React components.
tags: react, typescript, cleancode, tips
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/vmkya3ft4r77kt27uw1b.jpeg
---

>[Clean code is code that is easy to understand and easy to change.](https://cvuorinen.net/2014/04/what-is-clean-code-and-why-should-you-care/#what-is-clean-code)

When you are developing a React application in TypeScript, you most likely come across the problem of defining the type of the `props` of a component. Now this isn't something that's hard to solve, on the contrary: it can be solved in many ways! The problem comes with "many ways".

In my few months of working with React in TypeScript I came to the conclusion to use the following pattern illustrated by a made-up component:

```tsx
interface Props {
  size: Size
  variant: Variant
  thirdProperty: ThirdProperty
}

const MadeUpCompo = ({ size, variant, thirdProperty }: Props) => {
  /* implementation of component */
}
```

Why do I use this pattern?
- The declaration of the `Props` interface is always before the component. I find this cleaner than declaring the type of props inline which can become quite cluttered after a few properties.
- I always use the name `Props` for the interface so I never have to think for even a second about its name. One other pattern I see would be naming it `MadeUpCompoProps` but that's repetitive, longer, and I don't think it enhances clarity any more.
- Props are always destructured so you just use the `size`, `variant`, etc. identifiers, instead of writing something like `props.size`, `props.variant`, etc.
- Props are typed, I catch errors compilation time. I avoid using *any* for "typing" props

One last thing I thought about is whether the Props should be an interface or type alias. At this point I don't think it matters much, but here is a well-fitting article connected to this: [Type aliases vs. interfaces in TypeScript-based React apps](https://link.medium.com/9JXCvJEyv6)

What do you think? Do you find this pattern useful?
Day 1: Began FreeCodeCamp curriculum
Tags: css, design, challenge
Published: 2020-05-20 20:55:22

# Day One

I have had an issue lately that I have been struggling to overcome. Some call it imposter syndrome, the feeling of not being ready when you are more than ready to take the next step as a web developer. 

Except for me, I realized that the reason I felt imposter syndrome, was because I AM an imposter in my eyes. I finished Coding Bootcamp a couple of months ago and while I believe I have the tools and knowledge to leverage those skills into a job, I can personally tell when I haven't truly internalized something. That feeling comes from when I look at the projects I have made and don't feel any real sense of accomplishment from them. 

I am by no means discounting the work that I have previously done, but I know my potential better than anyone else, and I know when I am not fully walking into what my true potential is. I have read tons of articles that motivate me to fix my resume or make large projects and reach out to people. While those things have helped me land a few interviews, I have found that I lack some of the basic understanding skills that are necessary to become an <i> Effective </i> web developer. 

After taking a hard step back and realizing that at the end of the day, I had to decide if I wanted to continue feeling like a poser, or if I wanted to become an effective developer who isn't just looking for the name or the perks that come with it, but to become an actual asset and earn the title. 

I came to the answer of <i> Yes, I DO want this </i>

So, what was I going to do now? I have the Bootcamp experience under my wing, but at the end of the day, being able to display my true skillset and knowledge is what will land me at the job of my dreams, and oh, are my dreams big. I decided to take what I am calling the "baby lifecycle method". The reason I am calling my approach the "baby lifecycle method" is pretty straightforward. I keep trying to get into the prestigious private Universities when I haven't even adequately learned to walk yet, let alone talk or explain the intricacies of scope and closures.

So, this leads me to the point of my first post. Today I began studying the freeCodeCamp curriculum. After reading some very positive reviews from new engineers and job recruiters alike, I have made the decision to let go of my pride of not knowing and my impatience to find a career to truly allow myself the time and dedication it takes to truly learn something I am passionate about. I am currently working on the first certification on Responsive Web Design, which I have some experience with, but I could always improve. I am even completing the menial tasks that I already know, to reinforce my knowledge. 

I have also decided to begin reading Eloquent Javascript in addition to studying this work to further develop my understanding of Javascript and it's deeper intricacies. 


Overall, I am going to make a post everyday from now on that speaks about what I have learned and how the journey to landing my first web developer position is going. Feel free to join me for the ride and offer any wisdom you might have!
Jonin
Tags: javascript, node, html
Published: 2020-05-20 20:54:25

Hello everyone,

I'm the co-owner of a Discord Bot named Jonin. Jonin is a Discord bot made using the Discord.js library and Javascript. I and my friend decided to make our own bot after we couldn't find a bot that could get done the things we needed. After making the bot public we found out that there were other people who also needed some custom commands. So we decided to use some suggestions and turned them into commands. Slowly but surely our bot started growing and currently, we are at 220 servers. If you would like to give a suggestion, come join our server [here](https://tinyurl.com/jonin-support). You can also invite Jonin [here](https://discordapp.com/oauth2/authorize?client_id=662517805983334416&permissions=2137517567&scope=bot). Also check out Jonin's site while you are at it [here](https://jonin.gq/) :)
How to remove all images and containers in Docker
Tags: docker, tricks, howto
Published: 2020-05-20 20:51:25

---
title: 'How to remove all images and containers in Docker'
description: Solution to remove all images/containers of Docker at once.
tags:
  - docker
  - tricks
  - how-to
canonical_url: https://itsopensource.com/how-to-remove-all-images-and-containers-in-docker/
published: true
---

Recently I started using Docker in my internship and sometimes you just mess up your docker images and containers, so you wanted to start from clean but first you need to remove all images and containers of Docker locally.


```bash
# Delete all Docker containers
docker rm -f $(docker ps -a -q)

# Delete all Docker images
docker rmi -f $(docker images -q)
```

Also there is a new docker command, that will delete all unused images and volumes.

```bash
docker system prune --all --force
```


You can read more about this command [here](https://docs.docker.com/engine/reference/commandline/system_prune/)

Follow me on [GitHub](github.com/championshuttler) and [Twitter](twitter.com/idkhtml)

Cheers!

---
Loquat
Published: 2020-05-20 20:49:12

## Inspiration
As students who currently invest, there is a large learning curve associated with investing that is hard to overcome on your own. Loquat aims to provide a platform to bring together groups of people so the task of investing is less daunting.

## What it does
Loquat provides a platform for friends/colleagues to invest together in a fun and educational environment. You can manage group portfolios as well as invest in your own portfolio. The platform makes recommendations for stock purchases using a variety of features including sentiment analysis and risk data collected from the Aladdin API.

## How we built it
Each member worked on different aspects of the project. We used React to develop a web application that the user can interact with. We utilized Flask to develop a REST API that our web app could interact with in order to query the database. The backend was also responsible for processing the data retrieved from the Aladdin API and generating recommended stocks.

## Challenges we ran into
Determining which features to use in our recommendation system was exceptionally difficult. We also ran into difficulty with memory allocated for our flask instance, which was causing crashes with no explanation.

## Accomplishments that we're proud of
We built a realistic application that could make investing fun for any group of individuals!

## What we learned
We learned how to work under pressure and how to work with new technologies that we were not initially comfortable with.

## What's next for Loquat
We want to introduce competitions as well as news integration so people can learn as they invest.
## Link to Code
{% github https://github.com/anirudhnkl/loquat-new %}
[BIFU -A GREEN ALTERNATIVE FOR FUTURE]
Tags: octograd2020
Published: 2020-05-20 20:39:56

#Motto:
We have stepped in an era where we need faster and cheaper means of transportation and mechanical work. Thus, a non- conventional source of energy is required, particularly an alternative which can replace the commonly used fuels in the engines or machines to derive mechanical work more efficiently in a cheaper way.The project work BIFU ~ A GREEN ALTERNATIVE FOR FUTURE proposed herein deals with this problem with a view to find an alternative fuel.
#TECHNOLOGY/MANAGEMENT
BIFU ~ THE GREEN ALTERNATIVE FOR FUTURE has to go through some prior mechanisms that includes various stages of technology and managements including Chemical technology,Machine technology,Computer technology and many more related technologies.
#Target group/market size
INDIA IS THE 3RD LARGEST ENERGY AND OIL CONSUMER IN THE WORLD AFTER CHINA AND THE US.According to a statistics total consumption of crude has increased to 146.5 million tonnes in 2006-07 as against total production of petroleum crude of 34 million tonnes.So, we have to depend on other countries for production. BIFU can bring a revolution in INDIA if accepted. Since a "waste product" is to be converted to a useful product, this project seems to possess potential market opportunities.
For this particular venture we were selected from more than 1000's of teams to participate in REGIONAL CONVENTION OF CHHATRA VISHWAKARMA AWARD AICTE 2019.

SMALL SCALE PROTOTYPE IS READY AND TESTED.

THANKS FOR READING. YOU ALL ARE AMAZING. KEEP SMILING AND HAVE A NICE DAY.
Real-time statistic app
Tags: octograd2020
Published: 2020-05-20 19:56:42

_Real-time web/mobile/bot application to track/view stats about COVID-19_

_thanks #githubsdp_

## My Final Project
Created web application, a few bots (ICQ, VKBot, Telegram (now in progress), mobile PWA application to track latest statistic about COVID-19 with charts, dynamic theme, language and items switcher
Now, I'm working on AI/ML/DL/GA for analysis against stats and provide info about future stats

And #githubsdp provided me access to 

- name.com (domain name)
- DigitalOcean (1 droplet)
- Bootstrap Studio (design and layouts)
- GitHub Pro status (motivates me :))

## Demo Link
https://corona.notify.wtf

## How I built it (what's the stack? did I run into issues or discover something new along the way?)
SENT - (My own template for Sapper.js + Express.js + Node.js + Typescript, that I created when started this project)
Socket.io
Graphana
Svelte.js
Docker + Docker Compose
Rollup
SSH
PostgreSQL
Ubuntu
Bootstrap Studio
Markdown

## Additional Thoughts / Feelings / Stories
- DigitalOcean provided me 50$ to account when I sent my application for COVID-19
- I've about 1000 users on a web page
- All my development history for this project was tracked at [development blog](https://vk.com/wall167752831_18294)

[Final Note]: # (CONGRATULATIONS!!! You are amazing!)
Would You Have Survived!
Tags: devgrad2020, octograd2020, githubsdp, machinelearning
Published: 2020-05-20 20:34:02

## My Project

Although this is not my final year project, but I would like to share it with the community because its fun!

In the initial days of learning Data Science, I trained a model on the very popular **Titanic Dataset** and got good accuracy. I thought why not share it with everyone so that everyone can check whether they **would have survived if they were on the Titanic ship**.

## Demo Link

[Here is the working demo](https://titanic-survival.herokuapp.com/)

## Link to Code

`{% github.com/techytushar/would-you-have-survived %}`

## How I built it

I mostly used **Python** to build the project. The following stack was used:

* **Machine Learning:** Scikit Learn, Pandas, Numpy, XGBoost
* **Web App:** Flask, JavaScript
* **Deployment:** Heroku

This was the first project which I deployed on Heroku and I realized how easy it was to deploy Python webapps on it. I also learnt how to connect machine learning model with webapps.
Youtube-dl-gui
Tags: javascript, electron, node, githubsdp
Published: 2020-05-20 20:31:06

### Introduction
When covid19 hit my country, I got bored pretty fast. So I decided to start a new project to boost my JavaScript skills and learn Electron. I really wanted to make something usefull and easy to use. Thats how I came up with the idea to use the quite popular library youtube-dl and Electron, to create an application that allows its users to easily download YouTube videos and later on playlists.

Of course I knew that there are a lot of other GUI's for youtube-dl. But they are not always as easy to use. They quite often have bad designs as well. Thats why I decided to create my own little GUI.

### How?
To start off this project I followed the 'Get Started' tutorial from Electron. After that I started designing the interface with Bootstrap. While I was designing the interface I was slowly adding the code behind it as well.

The next step was adding the ability to download playlists, this was a real challenge for me, because I had to work with async events in JavaScript. Something I had never done before. After a lot of StackOverflow I found a good way to do it, and it worked great!

The last thing I did was adding error handling and streamlining the application.

### Did I learn anything?
Hell yes, I learned a lot during this project. I learned new JavaScript functionalities, Electron, how to efficiently deploy software and most important: I learned how to solve complex problems using code!

### Repository
Want to check my code for yourself or try the application?
- [GitHub Repo](https://github.com/jely2002/youtube-dl-gui)
- [Download page](https://github.com/jely2002/youtube-dl-gui/releases)
Using YouTube Subtitles for a drinking game
Tags: octograd2020
Published: 2020-05-20 20:30:15

## YouTube Subtitles

A friend suggested this concept, and I was sufficiently bored of revision to make a quick MVP. 

The idea is that you take a selection of videos from your favourite YouTuber and analyse their most used phrases; which you must drink on, each time someone says them. 

## Link to Code

{% github https://github.com/crablab/youtube-subtitles %}

## How I built it

This is a simple Python 3 application you can run at home. I might make it into an actual website at some point. 

Issues:
- It uses up a stonking great chunk of YouTube "quota". There are some small tweaks I could make to improve this: better filtering the subtitle tracks before downloading them etc. 
- The text analysis is a very basic moving window frequency analysis. It is not clever and contains no AI or ML! Room for improvement.
On.NET Episode: GitHub Actions
Tags: github, dotnet, devops
Published: 2020-05-20 20:26:44

GitHub Actions makes it easy to automate all your software workflows. You can build, test, deploy your application right from within GitHub

In this episode, Jeremy and Abel show us how to configure and trigger a GitHub action against the Tailwind Traders web application.


{% youtube eLQ1Ivz-1n0 %}

If you liked this video and would like to see some more of our .NET content, please subscribe to our [.NET Developers YouTube Channel](https://www.youtube.com/channel/UCvtT19MZW8dq5Wwfu6B0oxw).


## Useful Links
<ul>
<li><a href="https://github.com/features/actions" target="_blank">GitHub Actions</a></li>
<li><a href="https://help.github.com/en/actions" target="_blank">GitHub Actions documentation</a></li>
<li><a href="https://docs.microsoft.com/aspnet/core/host-and-deploy?WT.mc_id=ondotnet-c9-cephilli" target="_blank">Host and deploy ASP.NET Core</a></li>
</ul>