teleren/devto huggingface dataset:
1764. Leetcode Solution in Python3
Tags: python
Published: 2022-07-21 14:15:01

```
class Solution(object):
    def canChoose(self, groups, nums):
        """
        :type groups: List[List[int]]
        :type nums: List[int]
        :rtype: bool
        """
        p1, p2 = 0, 0
        n1, n2 = len(groups), len(nums)
        while p2 < n2:
            if p2 + len(groups[p1]) <= n2 and nums[p2: p2 + len(groups[p1])] == groups[p1]:
                p2 = p2 + len(groups[p1])
                p1 += 1
                if p1 == n1:
                    break
            else:
                p2 = p2 + 1
        return p1 == n1
```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/form-array-by-concatenating-subarrays-of-another-array/
Svelte meets Ionic + Capacitor
Tags: svelte, ionic, capacitor, javascript
Published: 2022-07-21 14:11:33

Really enjoyed this stream by [Simon Grimm](https://twitter.com/schlimmson)! Kudos to Tommertom for https://github.com/Tommertom/svelte-ionic-app! 

{%youtube https://www.youtube.com/watch?v=prsXVk1fdW4 %}

It's all in the early stages, but promising. Would be so much fun to develop cross platform apps (and especially PWAs) with Svelte. :+1:
1839. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-21 14:09:54

```
class Solution {
 public:
  int longestBeautifulSubstring(string word) {
    int ans = 0;
    int count = 1;

    for (int l = 0, r = 1; r < word.length(); ++r) {
      const char curr = word[r];
      const char prev = word[r - 1];
      if (curr >= prev) {
        if (curr > prev)
          ++count;
        if (count == 5)
          ans = max(ans, r - l + 1);
      } else {
        count = 1;
        l = r;
      }
    }

    return ans;
  }
};

```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/longest-substring-of-all-vowels-in-order/
1910. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-21 14:08:20

```
class Solution {
 public:
  string removeOccurrences(string s, string part) {
    const int n = s.length();
    const int k = part.length();

    string t(n, ' ');
    int j = 0;  // t's index

    for (int i = 0; i < n; ++i) {
      t[j++] = s[i];
      if (j >= k && t.substr(j - k, k) == part)
        j -= k;
    }

    return t.substr(0, j);
  }
};

```



#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/remove-all-occurrences-of-a-substring/
2008. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-21 14:07:11

```
class Solution {
 public:
  long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {
    vector<vector<pair<int, int>>> startToEndAndEarns(n);
    // dp[i] := max dollars you can earn starting at i
    vector<long long> dp(n + 1);

    for (const auto& ride : rides) {
      const int start = ride[0];
      const int end = ride[1];
      const int tip = ride[2];
      const int earn = end - start + tip;
      startToEndAndEarns[start].emplace_back(end, earn);
    }

    for (int i = n - 1; i >= 1; --i) {
      dp[i] = dp[i + 1];
      for (const auto& [end, earn] : startToEndAndEarns[i])
        dp[i] = max(dp[i], dp[end] + earn);
    }

    return dp[1];
  }
};

```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/maximum-earnings-from-taxi
Writing Regex without knowing it
Tags: beginners, programming, tutorial, productivity
Published: 2022-07-21 14:02:44

Regex (Regular Expression) allows you to create patterns that help match, locate, and manage text. It's a powerful way to search and select a specific part of the string.

So you are able to write one line regex and replace several dozen lines of programming codes.

For some people, writing regex is a big pain.
Searching for general and famous regex on [StackOverFlow](stackoverflow.com) works most of the time, but if you don't know regex at all and you don't have time to learn it fast, there is a good solution for this type of people.

People wish to have a genie, and now we have a nice genie for regex!


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

I saw [Aarya's](https://twitter.com/gd3kr) [tweets](https://twitter.com/gd3kr/status/1545370626273120256) on Twitter.
He built an app to convert English expressions to RegEx.
The outputs are generated by OpenAI's GPT-3.

GPT-3 (Generative Pre-trained Transformer 3) is an autoregressive language model that uses deep learning to produce human-like text.


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

You can try it now on [autoregex.xyz](https://www.autoregex.xyz/).

Did you find something strange or funny? Comment them below 👇🏻

Because sometimes the result can be incorrect.
7 great Terminal/CLI tools not everyone knows
Tags: cli, tutorial, programming
Published: 2022-07-21 13:54:46

Do you work with the CLI a lot? It doesn't matter if Windows, macOS or Linux, [in this video](https://youtu.be/6FFNeDiRGK0) you'll learn 7 tools that I frequently use.

**exa, clink, rg & rga, plocate, bat, jq, f%$!**

What’s in the Video?

The video gives a short overview of how to use the tools mentioned above work. In order of appearance:

**exa** (https://github.com/ogham/exa) is a modern replacement for the venerable file-listing command-line program ls that ships with Unix and Linux operating systems, giving it more features and better defaults. It uses colours to distinguish file types and metadata. It knows about symlinks, extended attributes, and Git. And it’s small, fast, and just one single binary.

**Clink** (https://github.com/chrisant996/clink) combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities. Readline is best known for its use in the Unix shell Bash, the standard shell for Mac OS X and many Linux distributions.

**ripgrep** (https://github.com/BurntSushi/ripgrep) is a line-oriented search tool that recursively searches the current directory for a regex pattern. By default, ripgrep will respect gitignore rules and automatically skip hidden files/directories and binary files. ripgrep has first class support on Windows, macOS and Linux, with binary downloads available for every release. ripgrep is similar to other popular search tools like The Silver Searcher, ack and grep.

**plocate** (https://plocate.sesse.net/) plocate is a locate(1) based on posting lists, completely replacing mlocate with a much faster (and smaller) index. It is suitable as a default locate on your system.

**bat** (https://github.com/sharkdp/bat) is a cat clone with syntax highlighting and Git integration.

**jq** (https://github.com/stedolan/jq) is a lightweight and flexible command-line JSON processor.

**thefuck** (https://github.com/nvbn/thefuck) is a magnificent app, inspired by a @liamosaur tweet, that corrects errors in previous console commands.

{% embed https://youtu.be/6FFNeDiRGK0 %}
Top 5 Chrome Extensions for developers
Tags: react, github, webdev, javascript
Published: 2022-07-21 13:46:14

**Google Chrome extensions are programs we can be installed into Chrome in order to change the browser's functionality  as through adding new features.**
_In this article I will give you top 5 Chrome Extensions for developers:_

## 1. Window Resizer:

![ffff](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2kiabvdo8flbmq2jk0o8.jpg)
install extension: [Window Resizer](https://chrome.google.com/webstore/detail/window-resizer/kkelicaakdanhinjdeammmilcgefonfh?hl=en)
## 2. WhatFont:
![WhatFont](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2a64e4imi0225bcvw8r.jpg)
install extension: [WhatFont](https://chrome.google.com/webstore/detail/whatfont/jabopobgcpjmedljpbcaablpmlmfcogm?hl=en)
## 3. Make a Screenshot
![Make a Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rtgm3rcygaowa582xycs.jpg)
install extension: [Make a Screenshot](https://chrome.google.com/webstore/detail/make-a-screenshot/gfpdknjgjlakoegfncghjdggmolfocpa/related?hl=en)
## 4. ColorZilla
![ColorZilla](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6e9v89gms4ik5gkyg8hr.jpg)
install extension: [ColorZilla](https://chrome.google.com/webstore/detail/colorzilla/bhlhnicpbhignbdhedgjhgdocnmhomnp?hl=en)
## 5. ColorPick Eyedropper
![ColorPick Eyedropper](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lugr74e1y5kgwcagph9.jpg)
install extension: [ColorPick Eyedropper](https://chrome.google.com/webstore/detail/colorpick-eyedropper/ohcpnigalekghcmgcdcenkpelffpdolg?hl=en)
Tutorial: Nth Fibonacci number in Python
Tags: beginners, tutorial, python, tdd
Published: 2022-07-21 13:45:37

In this short video tutorial we will create a recursive algorithm for calculating Nth number of the Fibonacci series.

❓ What is The Fibonacci sequence?
👉🏻The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding numbers. The first two numbers in the Fibonacci sequence are 0 and 1, and the sequence goes on from there.

❓ How to calculate Nth number of Fibonacci sequence in Python?
👉🏻Calculating a value of an Nth number of the Fibonacci sequence is one of the fundamental recursive problems. In this video I will show step-by-step tutorial for writing a solution for this problem in Python using test-driven development.

{% embed https://www.youtube.com/watch?v=4DR-rXv7j8w %}

This is one of the most simple way to implement Nth Fibonacci number algorithm in Python and it isn't the most effective one.

Can you guess what would be time complexity for it? Feel free to write your gueeses in comments!
SCRCPY : Screen Mirroring
Tags: screen, mirroring, android, app
Published: 2022-07-21 13:33:41

Sometimes you need to mirror your mobile screen in to your desktop. For that you may have to install some heavy softwares.
But you can just connect your mobile phone to your _desktop_ and **easily** can mirror your phone and you can also control your mobile phone with your desktop machine.
Because the project is open source on [github](https://github.com/Genymobile/scrcpy) this application is actively made updates to increase the security.
Download the package from this [link](https://github.com/Genymobile/scrcpy/releases/download/v1.24/scrcpy-win64-v1.24.zip)  
And this will download ZIP file and the extract this zip file and then double click on the file named **scrcpy.exe** 
## Note :
Connect your mobile to desktop using USB Cable and enable USB Debugging on your phone.

![Image of Android Running on Debian OS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/erqg8c05e2c3g86q482b.jpg)
To download and use this application refer this amazing youtube video in hindi [https://www.youtube.com/watch?v=dINscOPHDR4](https://www.youtube.com/watch?v=dINscOPHDR4)
Tutorial in English [https://www.youtube.com/watch?v=vyX8ioYbT8I](https://www.youtube.com/watch?v=vyX8ioYbT8I)
How to Create Amazing Buttons With Icons using HTML & CSS
Tags: beginners, html, css, tutorial
Published: 2022-07-21 13:12:00

{% youtube aOQ_WzbHnjA %}

In today's video I'll be showing you how to create a button with icons using HTML & CSS. This is easily done, and can be added to your own website or project/Portfolio.
I show you the full front end coding tutorial, where I create the structure of the elements in HTML and then write all of the styling and effects with CSS from scratch, step-by-step!

***

**Markup**
```html
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Create Buttons with Icons</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>

  <button class="button">
    <span class="button__text">Like it</span>
    <span class="button__icon">
      <ion-icon name="heart-outline"></ion-icon>
    </span>
  </button>


  <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
</body>

</html>
```
**Styling**

```css
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap');

body {
	display: grid;
	height: 100vh;
	place-items: center;
	overflow: hidden;
	background: #20374e;
}
.button {
	display: flex;
	height: 50px;
	padding: 0;
	background: #2980b9;
	border: none;
	outline: none;
	border-radius: 5px;
	overflow: hidden;
	font-family: 'Roboto', sans-serif;
	font-size: 16px;
	font-weight: 500;
	cursor: pointer;
	box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
	transition: all 160ms ease-in;
}
button:hover {
	background: #008168;
}

button:active {
	background: #006e58;
	transform: scale(.95);
}
.button__text,
.button__icon {
	display: flex;
	align-items: center;
	height: 100%;
	padding: 0 24px;
	color: rgb(226, 226, 226);
}
.button__icon {
	font-size: 1.5em;
	background: rgb(0, 0, 0, 0.08);
}
```

***


🛴 Follow me for more on:
YouTube:        https://bit.ly/3oBQbc0
Facebook:       https://bit.ly/3cp2S5W
Instagram[New]: https://bit.ly/3Ihh2EB
3 examples of sleeping in Go
Tags: go, beginners, programming
Published: 2022-07-21 13:12:00

In order to sleep, we need `time` lib. Simplest case, when we want to sleep for a single second, we do it like:

```go
package main
import "time"

func main() {
  // ...
  time.Sleep(time.Second)
  // ...
}
```

## Sleep for seconds
In order to sleep for several seconds, we multiple by the amount of second we need. E.g. to sleep for 10 seconds:

```go
package main
import "time"

func main() {
  // ...
  time.Sleep(10 * time.Second)
  // ...
}
```

## Sleep for milliseconds
[`time.Millisecond`](https://onelinerhub.com/golang/how-to-sleep-for-500-milliseconds) can be used to sleep for `X` milliseconds:

```go
package main
import "time"

func main() {
  // ...
  time.Sleep(50 * time.Millisecond)
  // ...
}
```

You can also sleep for [minutes](https://onelinerhub.com/golang/how-to-sleep-for-500-milliseconds) or [hours](https://onelinerhub.com/golang/how-to-sleep-for-1-hour).
GraphDNA: Fingerprint GraphQL engines
Tags: graphql, security, pentest, python
Published: 2022-07-21 13:07:00

👋 Hey GraphQL Community folks!

We just released [GraphDNA](https://github.com/Escape-Technologies/graphdna), a tool to fingerprint GraphQL endpoint. ([Blog Post](https://blog.escape.tech/vulnerable-graphql-endpoint-discovery/))

With it, you can determinate with speed and precision which engine is behind a GraphQL endpoint and flag specific ones such as Shopify or Stepzen.

Here is a CLI example:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4gyhmstsp6sv9gz5k03w.png)

This is open-source so feel free to contribute /leave your ideas !
Personalized Search
Tags: ai
Published: 2022-07-21 13:02:03


Vue.ai’s personalized search solution enhances product data to ensure greater catalogue coverage and more accurate results. Retailers saw an 80% increase in conversion rate for users interacting with Vue.ai. 
**Power search results to be accurate and relevant to every shopper**

Vue.ai’s AI-powered [personalized search](https://vue.ai/products/ai-powered-personalized-search/) solution uses rich product and shopper data to make search results accurate and personalized for every shopper.
**Improve conversions and reduce bounce rate with personalized search results**
Vue.ai capitalizes on the high purchase intent behind eCommerce searches, by personalizing results based on individual shopper preferences. The AI-powered [personalized search](https://vue.ai/products/ai-powered-personalized-search/) solution also enhances product data to ensure greater catalog coverage and more accurate results. This tailored search experience reduces bounce rate and improves conversions for eCommerce retailers.
STYLING FORMS
Published: 2022-07-21 12:48:56

This is a course of an HTML and CSS so this lesson is simply about making forms look pretty. The forms are prettier and easier to use, that why web designer exists it's our job to whip this form into shape so that it look's like something people will actually want to inter act with. we will make each field sit on it's row, so I'll begin with a type selector input. But we don't want to select all inputs on the page because for example this check box is an input so we need to make our selector a bit more specific we only want to select inputs that use a type of email and now we can string together declarations and create our style.
CSS Battle: #8 - Forking Crazy
Tags: webdev, css, beginners, tutorial
Published: 2022-07-21 12:47:08


In this article, I will solve a [Forking Crazy](https://cssbattle.dev/play/8) CSS Challenge on [CSS Battle](https://cssbattle.dev/). Let's look at the [problem](https://cssbattle.dev/play/8) first.



## Problem 

We need to create the following container by using CSS Properties only:
![Forking Crazy](https://cssbattle.dev/targets/8.png)

## Solution

So now look at the Solution and how we are going to achieve this. 

### HTML


```html
<div class="root"></div>
<div class="slot"></div>
<div class="point"></div>
<div class="handle"></div>
```

### CSS

Now let's style the containers. 

<CodeTitle title="styles.css" lang="css"/>
```css
body {
  margin: 0;
  background: #6592cf;
  display: grid;
  place-items: center;
}
.root {
  position: absolute;
  width: 140;
  height: 190;
  background: #060f55;
  border-radius: 0 0 100px 100px;
  margin-top: 10;
}
.slot {
  width: 20;
  height: 100;
  background: #6592CF;
  z-index: 1;
  border-radius: 0 0 100px 100px;
  margin:20 0 0 0;
  box-shadow: -40px 0 0 #6592CF, 40px 0 0 #6592CF;
}
.point {
  width: 20;
  height: 20;
  background: #060F55;
  border-radius: 10px;
  transform: translate(-60px, -190px);
  box-shadow : 40px 0 0 #060F55, 80px 0 0 #060F55, 120px 0 0 #060F55; 
}
  
.handle{
  position: absolute;
  bottom:0;
  width: 20;
  height:60;
  background: #060F55;
}
```

>*Note: In CSS Battle you can use `100` instead of `100px`. You don't need to define `px` in CSS. However, if you are using `rem` or `%`, you need to pass them separately. That's why in the above CSS code there are no units mostly. For more info [visit here](https://cssbattle.dev/tips)*

>*Minify the code or CSS by using any [CSS Minifier](https://www.minifier.org/). It helps you to reduce the characters in the code which will increase the score.*

### Codepen 

{% codepen https://codepen.io/j471n/pen/vYmKVvd %}

### Video 

{% youtube https://youtu.be/fmDgipKUBPc %}

### Wrapping up
There are many ways to solve this. You can share your approach in the comments. If you like this then don't forget to ❤️ it. And I'll see you in the next article. See you soon.
Robotics Engineering projects
Published: 2022-07-21 12:39:53

Engineering student projects for b.tech and m.tech final year students. takeoff edu group offers a wide range of projects best for [robotics engineering projects](https://takeoffprojects.com/robotics-engineering-projects) looking for magnificent final projects at low cost. 
 
We have successfully delivered robotics engineering projects to our engineering students. Our programs are specially designed by experts for best results of robotics engineering projects for engineering students. max of the b.tech, m.tech, PHD and diploma scholars.
 
Takeoff edu group provides the most creative conceptions and ideas that can make very effective final year projects for scholars, experimenters, and engineers. so browse through our list of [robotics engineering projects](https://www.youtube.com/watch?v=ZCtrqRhBSJY) and choose the smart final year projects for your requirements moment.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5tl2f1bytxbd58i6u0e.png)
 
With the help of robotics, earthborn sweats to perform complex tasks have come lightly and more precise. Robotics is extremely delightful to course and inversely interesting to learn. An aspiring robotics professional must be massively passionate to learn and be laboriously involved in colorful problem- working surroundings with robust chops in donation, exploration, communication, and detailed knowledge of programming languages, as well as physical engineering.
 
Robotics is a multidisciplinary technology that combines mechanical, electrical, computer science, and many other fields together. Improving programming and innovation is helping robots to discover their way into various fields, which are excessively risky, dull, or unimaginable for humans to accomplish. Robotics has advanced dramatically in the 20th and 21st centuries. Because of this, job opportunities in this field have also increased rapidly.
 
Robotics has come up broadly. It’s not just something to intrude with now. A devoted raceway of engineering has come up in several engineering colleges. College events, Robotic carnivals, and competitions see a really large interest from robot enthusiasts.
 
Top 5 Robotics Engineering projects:

- 3D Printed Robot. It so happens that 3D printing is a wonderful application for the discipline of robotics.
- Stair Climber Robot.
- Robotic Arm Controlled by Touch Screen Display.
- Line Follower Robot. 
- Solar Floor Cleaner Robot.
Truthy and falsy values in JavaScript
Tags: javascript
Published: 2022-07-21 12:15:20

---
title: "Truthy and falsy values in JavaScript"
published: true
description: "A blog post truthy an falsy values in JavaScript"
tags: "javascript"
canonical_url: https://ashutoshbw.github.io/blog/truthy-and-falsy/
---

Truthy values are considered as `true` and falsy values are considered as `false` in Boolean contexts for example in conditionals and logical operators.

There are only the following falsy values in JavaScript:

* The Boolean false value: `false`
* The zero value of both Number and BigInt type: 
  * Number type: `0`, `-0`, `0.0`, `00`, `0x0` etc. 
  * BigInt type: `0n`, `0x0n`, `0b0n` etc.
* Empty string value: `""`, `''` and <code>&#96;&#96;</code>
* `undefined`, `null` and `NaN`.

All the rest of the values in JavaScript are truthy values.

That's it. Thanks for reading! Let's connect on [Twitter](https://twitter.com/ashutoshbw).
Bun.js - Fresh JavaScript runtime out of the oven 🧑‍🍳
Tags: javascript
Published: 2022-07-21 11:24:14

When JS devs got bored of rebuilding libraries, they started rebuilding the runtime. 

## An all-in-one JavaScript runtime

A few weeks ago, Jared Sumner released Bun.js—an all-in-one runtime for JavaScript. Bun includes a native bundler, TypeScript transpiler, task runner, and npm client. 

And it is _fast_. ⚡


![Bun benchmark](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ui5hy84ol3fxbewl5i0u.png)

Since Bun is an all-in-one tool, performance is not limited to apps. Developer tooling also benefit from it:

- [4.5x faster starts](https://twitter.com/jarredsumner/status/1499225725492076544) than node
- [30x faster script runs](https://twitter.com/jarredsumner/status/1454218996983623685) than npm
- 20x faster installs than yarn

On top of all, Bun has full compatibility with all the NPM ecosystem. So there's little to no migration needed. ✅

## Should we use Bun?

By all means, try it out! Bun.js looks extremely promising.  Its sheer performance could be driving change across the entire JS ecosystem; the same way Vite changed the face of front-end dev in a couple months. 

Personally, I'd love to see more tools aim at running on the edge.

But Bun still has to come to grips with:

- **Project scoping**—A monumental scope is not a bad thing per se, but it makes the challenge greater
- **Sustainable maintaining**—Building a team around the creator is vital to ensuring continuous development and support
- **The Zig question**—Bun is built with the Zig language which is quite unproven in the industry

Dig further by reading [Bun.js documentation](https://bun.sh/).

---

Like the content? Follow for more JavaScript & front-end stuff!

Cheers ✌