teleren/devto huggingface dataset:
Videos auto-playing on Dev.to
Tags: discuss, watercooler
Published: 2020-07-28 06:46:39

Curious to see the community's thoughts on auto-playing videos in posts on `dev.to`. Personally I'm not a fan and would like some way to disable it within `dev.to`'s settings.

I appreciate the videos themselves but sometimes when I'm on Dev it's not the appropriate environment to watch videos.

What do you think?
A trick with the Ruby documentation
Tags: ruby
Published: 2020-07-28 06:28:47

I've never been able to remember the arguments for `Array#reduce`. Every time I think I've managed to do it I just get it wrong.

Luckily for me, Ruby has very good documentation on its standard library and, what's even better, it ships with a CLI to explore it so I don't even need to Google it :grimacing:

```
ri "Array#reduce"
```

```
= Array#reduce

(from ruby core)
=== Implementation from Enumerable
------------------------------------------------------------------------
  enum.reduce(initial, sym) -> obj
  enum.reduce(sym)          -> obj
  enum.reduce(initial) { |memo, obj| block }  -> obj
  enum.reduce          { |memo, obj| block }  -> obj

------------------------------------------------------------------------

Combines all elements of enum by applying a binary operation,
specified by a block or a symbol that names a method or operator.

The inject and reduce methods are aliases. There
is no performance benefit to either.

If you specify a block, then for each element in enum the block
is passed an accumulator value (memo) and the element. If you
specify a symbol instead, then each element in the collection will be
passed to the named method of memo. In either case, the result
becomes the new value for memo. At the end of the iteration, the
final value of memo is the return value for the method.

If you do not explicitly specify an initial value for
memo, then the first element of collection is used as the
initial value of memo.

  # Sum some numbers
  (5..10).reduce(:+)                             #=> 45
  # Same using a block and inject
  (5..10).inject { |sum, n| sum + n }            #=> 45
  # Multiply some numbers
  (5..10).reduce(1, :*)                          #=> 151200
  # Same using a block
  (5..10).inject(1) { |product, n| product * n } #=> 151200
  # find the longest word
  longest = %w{ cat sheep bear }.inject do |memo, word|
     memo.length > word.length ? memo : word
  end
  longest                                        #=> "sheep"

```

It has a very good interactive mode as well (`ri -i`) In which you can search whatever you want :)

Oh, and if you use Vim you can access it by using `K` over any word. Check this out:

![K opens vim docs in vim](https://dev-to-uploads.s3.amazonaws.com/i/3y3gxynkolbmrxwwonjd.gif)
How to code like a pro 👨‍💻
Tags: productivity
Published: 2020-07-28 05:46:00

Being a developer is not an easy thing, it takes a lot of brainpower lots of energy and time. Here are some ways to code faster and make the time you spend on coding faster and more enjoyable. 

#Know your editor of choice
The more you know your editor the faster you will be able to code. Know shortcuts are highly beneficial as you don't have to spend time thinking, like okay click here for the terminal and here to open a new terminal tab, but when you know your shortcuts you can be like command space and something.   

#Use plugins for your editor and language 
Using plugins will help you boost your production speed. For python and javascript use kite which is an autocompletion tool. Plugins will help you type less, read less documentation, make fewer errors, and enjoy what really matters. coding.

#Use a good keyboard and learn home row typing style 
The most used hardware other than your computer while coding is your keyboard, having a good keyboard will help you type faster, I bet you will find excuses to type on the keyboard. Learning home row typing style essentially removes the extra step of looking down at your keyboard and after time it will be second nature to your, where is l oh I know where it is I memorized it. This also removes the use of thinking where is that key on the keyboard oh there is it is it's next to l and below p and p is next to o, I think.

#Have a good space to work in
Having an environment that you can feel comfortable working in and enjoying the space will always keep your mood up and will motivate you to code more and work harder.

Link to my favorite plugin kite:  https://www.kite.com/
A Merit of Learning a New Language
Tags: watercooler
Published: 2020-07-28 06:25:58

There are times when I find it hard to express my thinking in a certain way in the new language because I am not familiar enough with it, and I need to find an alternative way. That requires alternative thinking. Sometimes the alternative thinking can be quite a departure from the original, even changing my perspective, sometimes semantically, sometimes genuinely.

I just really couldn't find a good way to express "that's not what I meant" in Japanese. I resorted to "excuse me for making you misunderstand" instead.
JavaScript Remove Duplicates from Array
Tags: javascript
Published: 2020-07-28 06:10:24

Today I want to share with you guys the easiest way to remove duplicates in an array with `JavaScript`.

We are going to be using the [`Set`](https://daily-dev-tips.com/posts/javascript-es6-sets/) method for this.

> BTW: I have a free Giveaway on Twitter! [🚨 Free Giveaway](https://twitter.com/DailyDevTips1/status/1287735721298726912)

## JavaScript Removing Duplicates from Array

We already had a full overview of the `Set` function before, but today we are using `Set` to remove duplicates from an array.

Let's start with the following array:

```js
var array = ['🤟', '🤟', 1, 'abc', '🤟', 1];
```

As you can see, we have the emoji three times and the number one twice.

So make this a unique non-duplicate array we simply call `Set` on it.

```js
var array = ['🤟', '🤟', 1, 'abc', '🤟', 1];
var set = new Set(array);
console.log(set);
// Set(3) {"🤟", 1, "abc"}
```

Wow, awesome and simple right!

`JavaScript` is not always complicated loops and functions; we have to leverage the write commands for the right solution.

Feel free to have a go on this Codepen.

<p class="codepen" data-height="265" data-theme-id="dark" data-default-tab="html,result" data-user="rebelchris" data-slug-hash="OJMGebq" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="JavaScript Remove Duplicates from Array">
  <span>See the Pen <a href="https://codepen.io/rebelchris/pen/OJMGebq">
  JavaScript Remove Duplicates from Array</a> by Chris Bongers (<a href="https://codepen.io/rebelchris">@rebelchris</a>)
  on <a href="https://codepen.io">CodePen</a>.</span>
</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

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

## Browser Support

Be aware; `Set` is not supported in the older IE versions!

![JavaScript Set support](https://caniuse.bitsofco.de/static/v1/mdn-javascript__builtins__Set-1595859501160.png)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Useful resources and links for Web Development
Tags: webdev, css, productivity, beginners
Published: 2020-07-28 06:09:26

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8r81mzrb3ao1ecx7ypfi.gif)

**Learning Platforms**

[freeCodeCamp](https://www.freecodecamp.org/)
A nonprofit community that help people learn to code for free and build projects.

[Scrimba](https://scrimba.com/)
Next-gen learning platform which has interactive courses and tutorials.

[Codecademy](https://www.codecademy.com/)
Have access to resources that can teach web fundamentals, as well as multiple programming languages, including JavaScript, Ruby, and Python.

[Frontendmentor](https://www.frontendmentor.io/)
Learn and Solve real-world HTML, CSS and JavaScript challenges.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/di0au1fxmx72t1t4quhj.JPG)

[Sololearn](https://www.sololearn.com/)
Learn to code for free which has interactive lessons, "on-the-go"
practice and peer support.

**Illustrations**

[Blush](https://blush.design/)
Create, mix, and customize illustrations made by artists around the world.

[Ouch!! Icons8](https://icons8.com/)
ICONS8 allows designers to express their ideas giving right design elements at right time.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bu4p4t61lds99t6ria0v.JPG)

[Storytale](https://storytale.io/)
Storytale is a platform with vector, raster, and 3D illustrations that grows every week. 

[Drawkit](https://www.drawkit.io/)
DrawKit is a designstripe project has free Hand-drawn vector illustration and icon resources.

**CSS**

[Tailwindcss](https://tailwindcss.com/)
Tailwind CSS is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override.

[CSSgradient](https://cssgradient.io/)
Free tool that lets you create a gradient background for websites.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iqsouuvwxuorq1fem083.JPG)

[cssinspector](https://cssinspector.com/)
Chrome extension which helps to get the CSS of any element on the web.

[CSSpeeper](https://csspeeper.com/)
A smart CSS viewer which Inspect styles in a simple, well-organized& beautiful way with Chrome extension.

[BTTN.CSS](http://bttn.surge.sh/)
Get awesome buttons for awesome projects.

**Other resources**

[Startupstash](https://startupstash.com/) 
Online directory of resources and tools for startups and entrepreneurs.

[Unsplash](https://unsplash.com/)
Over 1 million free high-resolution images brought to you by the world’s most generous community of photographers.

[Pixabay](https://pixabay.com/)
Over 1.8 million+ high quality stock images and videos shared by our talented community.
Should you learn multiple programming languages?
Published: 2020-07-28 06:07:04

Each programing language has its own strength and weakness. So there remains a question should you learn different programming languages. I think learning different programming languages is good in away. If what you want to learn and what language will be your main programming language. Touch languages so when you do need it you know the basics and use the documentation for parts that you don't understand. I would say Master 1 or 2 programming languages and touch their surface to all the programming languages in the world.
What's on your VS Code home screen?
Tags: vscode, webdev, showdev, productivity
Published: 2020-07-28 06:06:05

## The first visual you see when you open a new window

Is it high in information density or sparse and 🧘 zen? Educational, fully of entertainment, strictly work related, or possibly all of the above? What gets us into the zone 🎧 and helps unwind after a long stretch of coding?

> [Give Marquee](https://marquee.activecove.com/) a spin - let us know what you think 🤩

These and many other questions led us to 👩‍🎨 design Marquee. We intentionally decided to leave options open. As with many other aspects in life, there's no one 🥇 home screen to rule them all. Marquee strives to be as functional as it is customizable to make working inside VS Code more productive 🦾 for you. Above all, we want you to take the 🚘 driver's seat.

## 😝 Love procrastination and zeitgeist?

Me too! Go with the mini forecast and all news.

![Mini forecast & all news](https://dev-to-uploads.s3.amazonaws.com/i/z1g6mtuyennlab2t8f76.png)

## 🙈 Rather stay hyper-focused because your susceptible to distractions?

Turn on todos and the scratchpad. No weather and definitely no news!

![Hyper-focus with no entertainment](https://dev-to-uploads.s3.amazonaws.com/i/t4gdqghu8nkm2iubowig.png)

## 🌵 Love the outdoors and can't wait to go outside?

Wrapping up work before enjoying nature? Totally fair, that beautiful sonoran desert. Maximize the background image and keep tabs on the weather.

![Natural beauty and the outdoors](https://dev-to-uploads.s3.amazonaws.com/i/k4cjlbk0sfag5l59j390.png)

# 🙋 What does your heart desire?

Show us your home screen and for sure let us know 📨 if there is anything else your developer heart desires. Be sure to install [Marquee](https://marquee.activecove.com/) so you can keep Xzibit and us posted on your home screen customizations. We'd love 💚 to hear from you. Leave a comment below, click the "Give Feedback" button in Marquee, or hit us up on <a href="https://twitter.com/activecove" target="_blank">twitter</a>.
Let's solve LeetCode! Two Sum
Tags: algorithms, javascript, tutorial
Published: 2020-07-28 06:05:58

# [Two Sum: Easy](https://leetcode.com/problems/two-sum/)

## Problem
Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice. 

### Example
```
Given nums = [2, 7, 11, 15], target = 18,

Because nums[1] + nums[2] = 7 + 11 = 18,
return [1, 2].
```

### Conceptual Overview
Before we get to the solution lets think about this conceptually. Looking at the array from our example we would need to find the pair of indices that add up to 18.

#### Possible Solution #1
One way of finding the indices would be to iterate through the array with two for-loops. Create a for-loop that will traverse the array and nest a second for-loop that will traverse the rest of the array at an index of +1 to the first loop.

##### Time & Space Complexity
O(n^2) Time & O(1) | Two for loops with a constant lookup

#### Possible Solution #2
A solution that is faster but will require more space will be making use of hash tables or more simply using an object.

When we use a hash table to store values we have access to constant lookup which makes this solution much quicker than the first. So as we iterate through the array we will be checking the hash table to see if it has the value we are looking for that adds up to target. Let's write some arithmetic

X<sub>1</sub> + X<sub>2</sub> = target
Where:
target = 18
X<sub>1</sub> = current value in for-loop
Find X<sub>2</sub>
X<sub>2</sub> = target - X<sub>1</sub>

So as we loop through the array we are storing values to the hash table and checking to see if X<sub>2</sub> exists in the has table. If X<sub>2</sub> exists then we return indices of [X<sub>1</sub>, X<sub>2</sub>]

##### Time & Space Complexity
O(n) Time & O(n) Space | One for-loop and storing data to a hash table iterating through the array once

### Solutions

#### Solution #1 O(n^2) Time & O(1) Space
```javascript
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
let twoSum = (nums, target) => {
    for (let i = 0; i < nums.length; i++) {
        for (let j = i + 1; j < nums.length; j++) {
            if (nums[i] + nums[j] === target) return [i, j]
        }
    }
    
    return []
}
```
#### Solution #2 O(n) Time & O(n) Space
```javascript
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
let twoSum = (nums, target) => {
    const hash = {}
    
    for (let i = 0; i < nums.length; i++) {
        if (hash[target - nums[i]] !== undefined) {
            return [hash[target - nums[i]], i]
        }
        
        hash[nums[i]] = i
    }
    
    return []
}
```

And there you have it! A couple of solutions for Two Sum. I would love to see what solutions you all came up with. See you all in the discussions :D
Winget (Preview) - Windows Package Manager
Tags: winget
Published: 2020-07-28 05:55:25

### What is Winget?
Winget is a native windows package manager tool from Microsoft. It is [open source](https://github.com/microsoft/winget-cli) and currently in preview as of 29th May, 2020.

Winget will support **Windows 10 Build 1707 and higher version**. If you are a windows insider (fast or slow ring) then you might already have winget installed. You can type winget -v in command prompt to confirm whether you have winget installed or not in your machine.

![Winget Version](https://vaghelabhavesh.github.io//images/2020-05-29/winget1.png)

### How to use Winget?
To install any package in winget, you have to type command - **winget install package-name**. For example to install power toys, type in **winget install powertoys**

![Winget Install](https://vaghelabhavesh.github.io//images/2020-05-29/winget2.png)


### What else Winget can do?
The following commands are available:
  - **install** - Installs the given application  
  -  **show** - Shows info about an application  
  -  **source** - Manage sources of applications
  -  **search** - Find and show basic info of apps
  -  **hash** - Helper to hash installer
  - **files** - validate  Validates a manifest file

![Winget Install](https://vaghelabhavesh.github.io//images/2020-05-29/winget3.png)

For example to see the information about powertoys which we installed, we can try command **winget show powertoys** and it will display information such as version, description, publisher, homepage etc about powertoys.

![Winget Install](https://vaghelabhavesh.github.io//images/2020-05-29/winget4.png)

### Conclusion
Winget will help us in automating the process of getting application in our machine. You can specify application and it will install it on your machine. No hassle to search online, download and install. 

Happy Coding.

###### This post was first posted on -  [https://vaghelabhavesh.github.io/blog/2020/05/29/winget-windows-package-manager.html](https://vaghelabhavesh.github.io/blog/2020/05/29/winget-windows-package-manager.html)
Is "C Programming language" Still Worth Learning in 2021?
Tags: c, beginners, tips, computerscience
Published: 2020-07-28 05:43:54

C has been an evergreen language and played a prominent role for most of the system developments that took place in the last few decades. C programming was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs and was made for general-purpose, imperative computer programming, that supported structured programming, lexical variable, scope, and recursion etc.

Today, we have lots of programming languages to choose and learn but as a beginner, everybody has a question “Which programming language should I learn first?” and most of the answers that we get on the internet or through suggestions are “C”. In this article, we’ll try to find out if C Programming is still worth learning in 2018. If yes then why?

## Where C language is used?
1. Microsoft’s Windows kernel is developed mostly in C, with some parts of assembly language.
2. Linux’s kernel is also written in C.
3. Every driver and program in mac is running on a C-powered kernel.
4. Ios, android, and windows phone kernel are also written in C.
5. World’s popular databases, including Oracle, MYSQL, MS SQL server are coded in C. (with C++)
6. 3D movies are created with applications that are generally written in C.
7. Embedded systems like an alarm clock, remote and censors controls, etc are most likely programmed in C.
8. Even my favorite programming language Python also is written in C.

## Is It Still Worth Learning C? (Advantages)

## Flexibility
As a middle-level language, C combines the features of both high-level and low-level languages. It can be used for low-level programming, such as scripting for drivers and kernels and it also supports functions of high-level programming languages, such as scripting for software applications, etc.

## Compatibility
Various features of C including direct access to machine level hardware APIs, the presence of C compilers, deterministic resource use, and dynamic memory allocation make C language an optimum choice for scripting applications and drivers of embedded systems.

## Portability
C is a highly portable language. It is a hardware-independent language or platform-independent language. It is used for scripting system applications which form a major part of Windows, UNIX, and Linux operating systems.

###Read more reasons [here (full article)](https://www.codesnail.com/is-it-still-worth-learning-c/)
How To Create A Git Repo For Beginners
Tags: github, git, githunt
Published: 2020-07-28 04:59:04

Let’s create a simple repository containing a readme.txt file
Register on GitHub, and create a repository.
Now create a “readme.txt” file in a folder on your desktop.
Open this folder > Right click > Now click the “Git Bash Here” option to open the terminal.
In the terminal, type git init then press enter
git add readme.txt
git commit -m "first commit message"
git remote add origin URL [copy this URL from the your repository page]
git push -u origin master
We have successfully created our first repository containing a readme.txt file.
Forcing Your Website To Serve Secure Content
Tags: security, webdev, tutorial, codenewbie
Published: 2020-07-28 04:41:15

While most hosting plans include an [SSL [Secure Sockets Layer]](https://www.ssl.com/faqs/faq-what-is-ssl/) certificate, they are not automatically activated, as you sometimes have to manually install the certificate via the cPanel.

Once installed, you should force a redirect to [HTTPS](https://en.wikipedia.org/wiki/HTTPS). This encrypts and secures your website’s data, and traffic. It will encourage visitors to engage your site content because they feel safe, and reassured – especially if you’ll be requesting some personal information.

#### First of all, you need to install the SSL Certificate via the cPanel

1. Click “SSL/TLS” in the Security category.

       ![GYRO Design Lab](https://gyrodesignlab.com/wp-content/uploads/2020/07/one.png)

2. Click “Manage SSL sites”

       ![GYRO Design Lab](https://gyrodesignlab.com/wp-content/uploads/2020/07/two-1024x426.png)

3. Now click “Browse Certificate”

       ![GYRO Design Lab](https://gyrodesignlab.com/wp-content/uploads/2020/07/browse-certificate-1024x517.png)

4. A window pops up; choose from the list of certificates and click “**Use Certificate**“. The form-fields get automatically filled.

5. Now scroll all the way down, and “**Install Certificate**“

#### Certificate Installed!

#### Finally! Force a redirect to HTTPS using any of these 2 methods;


* Method 1: 

Is it a wordpress site?

Go to your dashboard and open up the **Settings › General** tab. You’ll find two fields called **WordPress Address (URL)** and **Site Address (URL)**.  Now replace the **HTTP** prefix in both fields with **HTTPS**, and save the changes to your settings: That’s all it takes to configure WordPress to use HTTPS.

* Method 2: 

Edit the .htaccess file

Type the following code into your .htaccess file; create one if you don’t already have one. If you can’t locate it, see how here.

```
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
```

Either of these two should help you load serve secure content.

However, enabling HTTPS on your website isn’t enough. If you have mixed content loading over a secure HTTPS connection, you’ll continue to receive mixed or insecure content warnings and push people away. So, take the time to check and monitor your site for insecure content. Because you can bet that even though some site visitors will still risk visiting your site with mixed content warnings, popular browsers like Chrome are going to continue to crack down on insecure sites and prevent users from engaging with them the way you’d like.