teleren/devto huggingface dataset:
Leetcode September Day12
Tags: python, computerscience
Published: 2020-09-14 07:53:53

Problem Statement - *Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).

You may assume that the intervals were initially sorted according to their start times*

Example - 
"""
Input: intervals = [[1,3],[6,9]], newInterval = [2,5]
Output: [[1,5],[6,9]]
"""
My initial approach - insert the `newInterval` at a position such that the intervals array remain sorted by _start of each interval_.
After I have inserted the newInterval, I can merge all the intervals wherever possible.
Solution
```
class Solution:
    def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
        if len(intervals) == 0:
            return [newInterval]
        intervals.append(newInterval)
        intervals = sorted(intervals, key = lambda x : x[0])
        # now merge the intervals
        i = 1
        while i < len(intervals):
            p_i = intervals[i-1]
            c_i = intervals[i]
            if p_i[0] <= c_i[0] and c_i[0] <= p_i[-1]:
                intervals[i-1] = [p_i[0], max(c_i[-1], p_i[-1])]
                del intervals[i]
            else:
                i += 1
        return intervals
```
TC - O(nlogn + n^2) because of sorting and deletion.

How can we optimise it ??

We can use binary search to determine the index.
```
class Solution:
    def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
        if len(intervals) == 0:
            return [newInterval]
        intervals.append(newInterval)
        intervals = sorted(intervals, key = lambda x : x[0])
        lo = 0
        hi = len(intervals) - 1
        idx = 0
        while lo < hi:
            mid = (lo + hi)//2
            if intervals[mid][0] <= newInterval[0]:
                idx = max(idx, mid)
                lo = mid + 1
            else:
                hi = mid - 1
        intervals.insert(idx + 1, newInterval)
        # now merge the intervals
        i = 1
        while i < len(intervals):
            p_i = intervals[i-1]
            c_i = intervals[i]
            if p_i[0] <= c_i[0] and c_i[0] <= p_i[-1]:
                intervals[i-1] = [p_i[0], max(c_i[-1], p_i[-1])]
                del intervals[i]
            else:
                i += 1
        return intervals
```
Typescript for beginners: boolean
Tags: typescript, javascript
Published: 2020-09-14 07:51:05

Boolean is the data type that has two possible values. It is either true or false. 

To do type checking on the variable we can write a statement as follows

```javascript
const isTrue : boolean = true;
``` 

Step-by-step: 

* Define variable `const isTrue`
* Add typescript type check `: boolean`
* Define value `true`

To check whether function is returning boolean we can do it as fallows:

```javascript
function isOlder(age : number) : boolean {
  return age >= 18 ? true : false;
}

isOlder(18) // true
isOlder(16) // false
isOlder(true) // error 'Argument of type boolean is not assignable to parameter of type number'
```

Step-by-step:
* Define function `function isOlder(argument : typecheck) : type to return {...}`
Continuing with React & Starting My Latest Side Project!
Tags: devjournal, react, womenintech, codenewbie
Published: 2020-09-14 07:18:15

_This post was originally published on September 14, 2020 on [my blog] (https://alexlsalt.github.io/blog)._

Monday morning, folks - look alive (talking to myself)! I've got a lot on my plate today, so productivity is of the essense. Lots of focus on not context-switching and embracing the joy of single-tasking.

I'm officially off to the races with my So You Think You Can France project! (I've talked about this project in the past - it's a website I built on Squarespace, and I'm now in the process of rebuilding it from scratch with React).

A bit of a plot twist, though, on the project - so, before, I was planning on just using Firebase Firestore to store the data (the main point of the website is that it holds dozens of French city guides with lots of info for each city).

But...this weekend I started looking more into SQL and I may actually build my own database. I'm very conscious of the fact that I don't have a very clear picture on how everything fits together and how each part of the project will fit together, but that's okay!

It's coming together peripherally and I don't need all the answers *right this very second*. As I always say, one foot in front of the other and the rest will come together as needed.

May need to talk this over though with a mentor or something to get a little bit more clear in my head.

In any case, I'm really excited about it! I've started building out the frontend of the site just using HTML, CSS, and JavaScript - but I'll make the migration to React soon enough.

Today's focus is spending a few hours continuing my work through my Pure React ebook, and then also starting in on the huge task of migrating a lot of the French city guide data over to a few spreadsheets that will be set up as my databases will be set up (i.e. Cities, Restaurants, Bars, etc)

Let's go!

----------


P.S. Did you know I have a podcast with new episodes each Wednesday? Go listen [right over here >>] (https://www.ladiescodecollective.com/podcast)

![The Ladies Code Collective Podcast cover art](https://dev-to-uploads.s3.amazonaws.com/i/e9bnxljvfrdjeti7fvbr.png)
Validate your startup idea with MVP.css
Tags: css, html, javascript, slingcode
Published: 2020-09-14 06:58:06

I don't know about you but when I come up with a new startup or app idea I get super excited and want to dive into coding right away.

One of the best things you can do to save yourself a bunch of wasted time and effort is to create a basic landing page and see if anybody actually wants the thing you intend to build, before you build it. There is nothing worse than spending months building something only to launch it to blank stares and crickets.

In this video I'll show you how to use MVP.css to create a basic landing page that you can put up online to test the waters. If you put it up online and people actually like the idea then you can build it. If not, no harm done, on to the next idea!

{% youtube NqHvbMRj7vc %}
Hello, Blog World!
Tags: firstpost, helloworld
Published: 2020-09-14 06:50:33

### Hey there! 👋
I am Shubham Verma, a Frontend Developer from India.
This is my first step into the world of blogging.

The reason I wanted to get into blogging is that I am studying Computer Science at my college.
And there are a lot of my friends who don't understand programming or they lack the basics of it.
So, in this blog, I would be posting blogs on the basics of those languages.
Django Rails or Laravel? My personal journey
Tags: python, ruby, php
Published: 2020-09-14 06:30:48

---
title: Django Rails or Laravel? My personal journey
published: true
description: 
tags: Python,Ruby,PHP
//cover_image: https://direct_url_to_image.jp
series: Django, Rails or Laravel?
---

I started my journey as a programmer 20 years ago. I have created over a hundred custom software for small and medium businesses.

About 10 years ago, I stopped programming and invested all my time in the family business. I did some little software here and there but nothing serious.

Since last year, the company I'm in has had a big project to update and redo almost all of our internal software. Everything will be web and cloud application. No more Windows software and no more local PC installation.

I decided to redo all the applications myself. This big project will take me about a year and a half.

To do this, I finally decided to use a full stack framework for the simplicity and speed of development. We are a small business, time is money.

I took advantage of the several weeks of inactivity of covid-19 to study the latest web development tools and framework.

The choice of programming language and framework is not an easy task. Like everyone else, I started reading and watching videos on the subject. I read a ton of pro and less pro blogs and started doing some demos and tutorials.

Demos were made with the Django, Rails, Laravel, Node, React and Vue frameworks. Yes I know that's a lot! When I do something I always do it with passion or I don't do it at all.

After these initial tests and readings, I quickly concluded that for my business needs, a monolithic solution was best. All my learning efforts will therefore go to the backend frameworks, so I decide to concentrate on Django, Rails and Laravel.

Since these frameworks are very similar, I had to develop more than a demo todo list to evaluate them.

So I decided to build a real small project from A to Z with these three frameworks.

The evaluation was supposed to last 2 weeks and ultimately lasted more than 3 months. 3 months of learning, building and real comparison of these three frameworks.

It goes without saying that I have a lot to share. Some of my conclusions match what we can read everywhere, but I find that many blog posts or videos have dated information. Some frameworks have made a lot of change in the past year or two. So all the reviews that are more than 1 year old are partly obsolete.

I will divide this post into five parts. You are currently reading part one. In part two, three, and four I'll cover Django, Rails, and Laravel. Finally in part 5 I talk about the conclusion of my research and my final decision.
Advice for a new bootcamp graduate.
Tags: career, discuss, beginners, codenewbie
Published: 2020-09-14 00:04:02

**Background**
Here is a quick background about myself. I originally have have a degree in nutrition from Chico State and worked at a VA hospital as a clinical diet tech for 10 years. This Jan I decided to quit my job and was accepted into Flatiron SF software development bootcamp. During the program we went over how to use Ruby, Rails, Javascript, HTML/CSS and React. I graduated from the program in June and officially declared my job search in Aug.

**What I do on a weekly basis**
The beginning of the week I usually browse Linkedin and try to connect with at least 10 people in software development or QA. Then the rest of the week I work on doing Javascript data structure problems or on various QA Engineering Udemy classes. 

**Questions for readers of this blog**
1. Aside from data structures, projects, and networking is there anything else anyone recommends I should be doing to increase my chances of getting an interview/job?
2. One of my biggest obstacles currently is finding a quiet workplace during the pandemic. Usually I would go to a local library or the Flatiron campus, unfortunately they closed.  My apartment is really small with constant construction outside so working there consistently can be difficult. Where have you been going to work/study during covid?
3. What is the best website to practice algorithms? There seem to be an endless amount of books and websites for algorithm practice. Which ones have you had the most success with?

Thanks in advance for spending time to read my blog and answer of the following questions.
Hello-World!
Tags: actionshackathon, actions, opensource, github
Published: 2020-09-14 06:15:21

# GitHub Actions x DEV Hackathon


### My Workflow : 
![GitHub Actions](https://dev-to-uploads.s3.amazonaws.com/i/6b2tg2c9ai6vpbs7ixkt.jpg)
Greetings - Greets users who are first time contributors to the repo. (actions/starter-workflows)


### Submission Category: 
Maintainer Must-Haves


### Yaml File or Link to Code:
[**Yaml File**](https://github.com/BhuvaneshHingal/HELLO-WORLD/blob/master/.github/workflows/greetings.yml) 
{% github https://github.com/BhuvaneshHingal/HELLO-WORLD %}



### Additional Resources / Info :
`https://github.com/BhuvaneshHingal/HELLO-WORLD`

***Tried learning about GitHub Actions and found it very impressive. This repository consists of a very simple and basic usage of GitHub Actions learnt from an existing template.***
Using Icons
Tags: webdev, react, codenewbie, html
Published: 2020-09-14 06:03:19

For the "Contact Me" section of my website, I wanted clickable icons that would redirect the user to my social media pages.  Here is how I went about this using regular HTML and a handy React tool: 

If you have worked with basic HTML, you know that we use the `<a>` tag in order to reference a URL.  It would look something like this:

```
<a href='https://www.linkedin.com/in/maasa-kono'>LinkedIn link</a>
```

...which ends up looking like this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1qzvi0ijls6qmemlvrxp.jpg)

This will create a clickable link on your DOM entitled "LinkedIn link" that will redirect the page to my LinkedIn profile.  However, I want to have the page open up in a new tab (just my personal preference).  In order to do so, we will need to update the `<a>` tag by adding `targe='_blank'`, so the updated version looks like this:

```
`<a href='https://www.linkedin.com/in/maasa-kono' target='_blank' rel='noopener noreferrer'>LinkedIn link</a>`
```
*You will notice another addition of `rel='noopener noreferrer'`.  This was added due to a security risk notification that popped up in the terminal, more of which you can read about [here](https://mathiasbynens.github.io/rel-noopener/).*

Now I have a link that will open up in a new tab so the user won't lose their place on my website!  

Now I want that icon image to click on, as opposed to just plain text.  To get this working, I utilized the `react-share` package, which you can download by running the following in your terminal:

`npm install react-share --save`

or

`yarn add react-share`

Once that installation is complete, we can now grab social media icons that are available in the package to use in our website. First, let's import the specific icons we want to use at the top of the file:

```
import React from 'react';
import {LinkedinIcon} from 'react-share';
```

We can now use the LinkedIn icon in this file!  Let's replace the link text so that it is updated as follows:

```
<a href='https://www.linkedin.com/in/maasa-kono/' target="_blank" rel='noopener noreferrer'><LinkedinIcon /></a>
```

So now, our page looks like this: 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/202yy462q2x1r25ja87s.jpg)

You can find detailed information on more that `react-share` has to offer [right here](https://www.npmjs.com/package/react-share).

Happy coding!
NUMPY and PANDAS
Tags: numpy, pandas, python, datascience
Published: 2020-09-14 05:51:42

What do you begin with to learn Pandas/Numpy? I don’t really like the styling side of Django/React.... I like how things work and connections. I’m liking how Datascience looks and machine learning. How do you get started? Also.... what are the prerequisites?
I taught myself, Trigonometry  and Pre Calculus
Too many configuration files in development nowadays
Tags: development, frontend, config, javascript
Published: 2020-09-14 05:49:57

---
title: Too many configuration files in development nowadays
published: true
description: Made a list of configuration files with irony.
tags: development, frontend, config, javascript
cover_image: https://repository-images.githubusercontent.com/283129583/27b43100-f692-11ea-8d93-cb640ccca4c7
---

We use lots of tools in development nowadays, and there are too many configuration files in a single project. With irony, I made a list of configuration files.

`.config` is a list of configuration files with a brief description of each tool, so it might help you a little.
https://github.com/ixkaito/.config

Pull-requests of addition and translation are welcome.
Simple 'Todo' app with the help of flask and SQLite and deploy it to Heroku. 
Tags: actionshackathon, flask, heroku
Published: 2020-09-14 05:44:01

### My Workflow
'Todo' app with the help of flask and SQLite and deploy it to Heroku.


### Submission Category: 
Maintainer Must-Haves, DIY Deployments 


### Yaml File or Link to Code

`https://github.com/misalraj/flask_learn`
Let me google that (issue) for you
Tags: actionshackathon
Published: 2020-09-14 05:02:52

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)
### My Workflow
This is the `"lmgtfy-action"`... on issue creation, the action will trigger and automatically take the issue creator's issue title or body content and use it to create a let me google that for you short url as a reply to the issue. This is just a wacky wildcard, as it's bad open source etiquette to snarkily reply to users with a let me google that for you link! Hopefully it will be unlikely that you're getting poor quality comments that the answer can be googled for as well. This might have been better as a Rick Roll even, as a search on the issue will likely turn up irrelevant results in most cases. I was mostly using this as a learning opportunity to experiment with JavaScript github actions!

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

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

This isn't being used by anything yet, it was solely created as an actionsHackathon submission.

[Note]: # (Make sure to include the name of your GitHub Action and share where it's being used!)

### Submission Category: 
Wacky Wildcards

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)

### Yaml File or Link to Code
[*****Yaml workflow file*****](https://github.com/rdlucas2/lmgtfy-action/blob/master/.github/workflows/autoRespond.yml)

{% github https://github.com/rdlucas2/lmgtfy-action %}

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)

### Additional Resources / Info

Nothing too special about this one. I used chrome dev tools to inspect the network tab while on the "let me google that for you" site when I clicked the button to produce the short url. I copied the relevant info to postman to play with the call, then went about learning how to setup the JavaScript action. Once I did a test run to see what the payload returned, it was pretty easy to plug in the relevant info to make the necessary REST calls to the lmgtfy API and the GitHub API to create a response to the issue. I learned about a tool that was new to me... [ncc](https://github.com/vercel/ncc), which was a nice find that I may use in future projects.

Thanks for sticking around and happy coding!


[Note]: # (Be sure to link to any open source projects that are using your workflow!)

[Note]: # (Be sure to include the DEV usernames of your collaborators, if any. )

[Reminder]: # (Submissions are due on September 12th (11:59 PM PDT) and winners will be announced on September 23!)
New ER diagrams
Published: 2020-09-14 04:55:32

Before going over the ER diagrams there has been something astonishing going on at the school of Albion College in Michigan. The school put forth an app that would be able to contact trace the students in the case of a coronavirus outbreak. However, the app was giving way to much access to personal data such as real time locations of the students. Obviously, this is not safe considering if someone accessed the data they could see where anybody was at any time. This is definitely an intrusive app that could potentially be dangerous to some of the people on campus. I would not be as worried as some people if Penn State decided to put this app in place, but I would definitely be against it for the benefits of others. If someone were to access this information many people would be very frightened. I would say that safety is more valuable than privacy in some cases, but this is not one of those cases. This is especially true because the information getting leaked could potentially be even more harmful than the benefits that they are getting from this information. If someone was tracked down and potentially kidnapped this would be a dire situation. I know that is an extreme case scenario, but it is still possible. One way of doing contact tracing would be to have positive tested students fill out places they have been in close contact of others and the specific times, then send out a report to students to get tested if they were at any of those places during those times. This would not allow people to know others current locations, only past ones which is not nearly as harmful as the app they are currently using. 

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

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

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

{% youtube NxHFWlQgvsw %}
🏝 Desert island apps
Tags: watercooler, discuss
Published: 2020-09-14 04:35:10

I’m sure you have probably heard of desert island discs, where you pick 5 discs (records/albums) you would want to have with you stuck on a desert island for the rest of your days.

What about with apps/websites?

Let’s assume you’ve got WiFi, a device of your choice and power and for some reason none of these enable you to get home (humanity has banished you? 😂).

I’d probably take...
- Twitter
- Messenger
- A code editor
- YouTube

Hmm... and if my desert island has a postal address then Amazon as well. 😅

Web browsers and app stores are cheating! 👀
fastget - ultra fast download files over HTTP(S)
Tags: showdev, githunt, go, opensource
Published: 2020-09-14 04:27:56

---
title: fastget - ultra fast download files over HTTP(S)
published: true
description: 
tags: showdev, githunt, golang, opensource
//cover_image: 
---

⚡`fastget` is an open source CLI tool and Go library to ultra fast download files over HTTP(S).

https://github.com/pgollangi/fastget

### Features
- Concurrent download of files over HTTP(S) if server supports Accept-Ranges. Otherwise, fallback to single thread download.
- Increase no. of concurrent workers to speed up download. Use flag --workers.
- Add curl like custom headers to authentifacte HTTP(S) requests. Use flag --header.
- Specify output file to write downloads. Default to file name of URL.


### Demo
![fastget Demo](https://github.com/pgollangi/fastget/raw/master/assets/fastget_demo.gif)
Replace or reduce heavy javascript frameworks
Tags: javascript, frameworks, libraries
Published: 2020-09-14 04:07:52

Being worked with Vue.js in recent years, I was really satisfied with the speed and performance that it brings to my programming jobs. However, recently I came up with an opinion  that it brings more cons than pros by introducing frameworks like this. To be simple, it causes the page to load more heavy libraries than before.  

Using frameworks is an irreversible trend as it brings the advantage of easier programming. Using modern frameworks like Vue.js or react js just increased productivity by implementing functions that is more frequently used or introducing concepts like components, and it reduced the time that programmers have to use to search for a relevant function.

However, it is a chain that makes you load many more unnecessary libraries that you don't need.  

Taking Vue.js as example, when you want to use the components, you might start by loading Vue itself, then if you find yourself hating the node.js thing, you will start by finding libraries like VueHttpLoader to load components. But that just increased libraries your site has to load **everytime** when visitors are visiting the page, causing performance degration.  
  
You might say, at least you still need to load jQuery or other essential libraries. Sure we aren't having the debate here for 'librariless' or vanilla javascript where programmer use zero libraries, although at times this might be the best approach. However, I think programmers need to reduce their library stacks as possible in order to make webpages load faster. Don't rely only on modern browser technologies as there are times that user is in a relatively slow internet connection.