teleren/devto huggingface dataset:
Angular Build Upload to AWS S3 + Cloudfront
Tags: aws, python, angular
Published: 2020-07-20 19:49:02

Published Python automated script for Angular project deployment to AWS S3 and Cloudfront.

This will help to automated uploading Angular project build code to AWS S3 and CloudFront cached invalidation part. This will ensure to take backup of existing code for rollback operation if required.

```
from deployment_angular_s3_cloudfront import *

from constants import REQUEST_PARAMS

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('--env', help="Select Environment PROD/STAGE/DEV")
parser.add_argument('--codepath', help="Code path of UI code")
parser.add_argument('--buildpath', help="Build path of UI code")
args = parser.parse_args()
if args.env:
    env = args.env
else:
    env = "STAGE"
if args.codepath:
    code_path = args.codepath
else:
    code_path = REQUEST_PARAMS.get(env).get('repositoryPath')

if args.buildpath:
    build_path = args.buildpath
else:
    build_path = REQUEST_PARAMS.get(env).get('buildPath')

print("Starting process for %s environment" %env)
request = {
    'bucketName': REQUEST_PARAMS.get(env).get('bucketName'), 
    'buildPath': build_path,
    'repositoryPath': code_path,
    'envName':  env,  # 'DEV, STAGE,PROD'
    'distributionId': REQUEST_PARAMS.get(env).get('distributionId'),
    'portal': 'PROJECTNAME',
    'buildCommand': REQUEST_PARAMS.get(env).get('buildCommand')
}
obj = DeploymentService(request)
obj.start_process()
```
Contribution for this repository is open. `pip` package process in progress. 

https://github.com/aviboy2006/angular-build-upload-s3-cloudfront
Two Sum Solution in JavaScript
Tags: javascript, webdev
Published: 2020-07-20 19:38:22

So what the hell is Two Sum? Well, it's a very popular Problem set in the world of Programming.
> 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.

Basically what it saying is, you have an array and an integer. For example: `[3, 2, 4] 6`. Now add two items of the array and the result must be 6, `2 + 4 = 6`. And don't forget that you can not add the same array item `3 + 3 = 6`, you can't do this here :P.
When you get the result of the sum which is equal to the integer then return the index of those two array items as an array. So the index of 2 is 1, and the index of 4 is 2, and the result is `[1, 2]`.

In JavaScript there are lot's of ways you can solve this, I will describe you two of them.
```js
const twoSum = (nums, target) => {
    const result = [];

    for (let i = 0; i < nums.length; i++) {
        for (let j = i + 1; j < nums.length; j++) {
            if (nums[i] + nums[j] === target) {
                result.push(i);
                result.push(j);
                return result;
            }
        }
    }
}
console.log(twoSum([2, 4, 6, 5], 8)); // [0, 2]
```
Here we are finding which two array items create a sum that is equal to *target* integer, then store the index of those two items in an array and return that array.  
Everything works fine here but what about **Time Complexity**. We are looping through the array twice, which means the *Time Complexity* is `O(n^2)`. It's quite expensive, isn't it?

Okay, now let's see a better approach...
```js
const twoSum = (nums, target) => {
    const result = [];

    for (let i = 0; i < nums.length; i++) {
        let diff = target - nums[i];
        let secondItemIndex = nums.indexOf(diff);

        // (secondItemIndex > -1) if array item is grater than target, then ignore that item
        // (secondItemIndex !== i) if same index, then ignore that item
        if ( secondItemIndex > -1 && secondItemIndex !== i ) {
            result.push(i);
            result.push(secondItemIndex);
            return result;
        }
    }
}
console.log(twoSum([2, 4, 6, 5], 8));
```
In this function mainly two thinks are happing, at first we are finding the difference between array item and target, `2 - 8 = 6`. Then finding the index of that number in the array, `nums.indexOf(diff)`.
The most important thing is in this scenario the **Time Complexity** is `O(n)`, which is almost half of the previous one.
COVID-19 Tracker with React, Chart.js, Nodejs
Tags: react, javascript, webdev, github
Published: 2020-07-20 19:37:40

![covid-19 tracker](https://dev-to-uploads.s3.amazonaws.com/i/ewjwfoqq1l7uhshokios.png)

What can I do to contribute to the current crisis? Often, I found myself repeating this question over and over the past few months. As a recent boot camp grad, I know I wanted to take the skills I learned and contribute to the current crisis the world is facing. One day, I scrolled through GitHub projects that were trending and found that said "COVID-19 Tracker". I wish I can find the original project that I encountered, but it was very simple and easy to read. Sure enough, I found a YouTube tutorial on how to build one. The issue that the project was the line chart was mobile-friendly and the card components were too small in 4k view. I decided I wanted to tackle this project and put my touches on it!

{% youtube khJlrj3Y6Ls %}

## Visual Data

To present the data visually, you will need to learn Chart.js. I found it to be pretty simple and easy to use. The visual data does present nicely, but I had to do a few media queries to optimize it for mobile use. I also used CountUp to add numbers counting up in the card component. I have not used CoutnUp before, but I will be using it for future projects as it is very confident to use.

![Chart.js visual data](https://miro.medium.com/max/2954/1*qoF7yCK6Y99BbhAnV4K0Hw.png)


 ## Future Updates
I plan on turning the page to be most visually-pleasing. Although this is a really good start, I would love to add a few designs to get the project to stand out for when I present the project to employers. I would also like to add a few more animations to it to add to the user experience of the page.

## Github Project

{% github mrshawnhum/covid19-tracker %}

Check out the project on GitHub! Please leave a star on the project if it has provided any value to you! Feel free to fork the project and put your spin on the project. I am always interested to hear how others had made it better or unique.
Mongoose find( )
Tags: 100daysofcode, mongodb, javascript
Published: 2020-07-20 19:33:18

Find is an inbuilt mongoose method chained to the model and used to filter and find particular data. Find ( ) can take three parameters
* A query filter/ condition
```javascript
student.find({ firstName: jane });
//Returns all the data with the firstName as Jane
```
NB: We need not to worry about type conversion to objectIds, Mongoose handles that for us.

* Query projections. Defines the data to be excluded or included in the search results.
```javascript
student.find({ firstName: jane }, `firstName major`);
//Returns the specified fields - firstName and major
```
* General query options such limit ( ), skip( ), sort( ) e.t.c
```javascript
student.find({ firstName: jane }, `firstName major`, { Limit: 10 });
//Limits the search to  the first 10 results
student.find({ firstName: jane }, `firstName major`, { skip: 2 });
//Skips the first 2 results.
```
Callback function. After data is retrieved you'll want to pass the results to callback function 
```javascript
student.find({ firstName: jane }, `firstName major`, { Limit: 10 }, (err, students) => {});
//Callback arrow function
```
#### FindById ( )
Gets a single Item by Id
```javascript
student.findById(req.params.bookId, (err, student) => {});
//Retrieves a single item.
```
CFM 2.0.1 Release!
Tags: apachenifi, cloudera
Published: 2020-07-20 19:20:47

https://docs.cloudera.com/cfm/2.0.1/release-notes/topics/cfm-whats-new.html

CFM 2.0.1 for running NiFi with Cloudera Manager on CDP-DC 7.1.1 clusters

#FLaNKStack #ApacheFlink #ApacheNiFi #ApacheKafka
Integer to Roman and back
Tags: javascript
Published: 2020-07-20 19:11:37

I haven't posted in a while and now that my career took a U-turn back into the boardroom, I suppose it might be the beginning of the end of my coding days... again. Strange times!

While on the topic of switching back and forth between worlds, here's two simple O(n) solutions to Leetcode's [Roman to Integer](https://leetcode.com/problems/roman-to-integer/) and [Integer to Roman](https://leetcode.com/problems/integer-to-roman/) problems.

```javascript
// integer to roman numeral
const intToRoman = function(num) {
    const rosettaStone = {
        1: 'I',
        5: 'V',
        10: 'X',
        50: 'L',
        100: 'C',
        500: 'D',
        1000: 'M'
    };            
    let resStr = '';

    for (let i = 1000; i >= 1; i /= 10) {
        const times = Math.trunc(num / i);
        if (times > 0) {
            if (times % 9 == 0) {
                resStr += rosettaStone[i]
                    .concat(rosettaStone[(times + 1) * i])    
            } else if (times % 8 == 0) {
                resStr += rosettaStone[(times - 3) * i]
                    .concat(rosettaStone[(times - 7) * i]
                    .repeat(3))
            } else if (times % 7 == 0) {
                resStr += rosettaStone[(times - 2) * i]
                    .concat(rosettaStone[(times - 6) * i]
                    .repeat(2))                
            } else if (times % 6 == 0) {
                resStr += rosettaStone[(times - 1) * i]
                    .concat(rosettaStone[i])
            } else if (times % 5 == 0) {
                resStr += rosettaStone[(times) * i] 
            } else if (times % 4 == 0) {
                resStr += rosettaStone[i]
                    .concat(rosettaStone[(times + 1) * i])   
            } else if (times <= 3) {
                resStr += rosettaStone[i].repeat(times);            
            } 
            num -= times * i;
        } 
    }        

    return resStr;            
};

// roman numeral to integer
const romanToInt = function(s) {
    const rosettaStone = {
        'I': 1,
        'V': 5,
        'X': 10,
        'L': 50,
        'C': 100,
        'D': 500,
        'M': 1000        
    };
    let result = 0;
    let lastValue = 0;

    for (let i = s.length -1; i >= 0; i--) {
        const value = rosettaStone[s[i]];
        if (lastValue > value) {
            result -= value;
        } else {
            result += value;
        }
        lastValue = value;
    }

    return result;
};

```
[optional soundtrack](https://www.youtube.com/watch?v=qnlhVVwBfew)
Best practices to authenticate with Passport.js
Tags: javascript, node, help, discuss
Published: 2020-07-20 19:07:29

I would like to ask the community for help to better understand and use [Passport.js](http://www.passportjs.org/).

The way I learned to use it, you define a strategy, make a couple of auth routes and persist session on a cookie.

So, for instance, you would create a Google strategy like this:

```javascript
const passport = require('passport')
const GoogleStrategy = require('passport-google-oauth20').Strategy

passport.use(new GoogleStrategy(
    options,
    (accessToken, refreshToken, profile, done) => done(null, profile)
))
```

Then add cookie-session and passport middleware:

```javascript
app.use(cookieSession(cookieOptions))
app.use(passport.initialize())
app.use(passport.session())
```

And finally create a log in route and a callback route:

```javascript
app.get('/google', passport.authenticate('google', scope))

app.get('/google/callback', passport.authenticate('google', options))
```

But my understanding of Passport.js is very limited and I often wonder if this is even a good idea. For instance, I don't really know what the parameters `accessToken` and `refreshToken` in the strategy's callback are. I imagine they serve some purpose beyond just existing, but I wouldn't know how to use them.

So I thought I'd ask around and hopefully hear good opinions on the matter.

How do you personally use Passport.js?
What method(s) do you use to persist sessions?
What are the pitfalls/security issues with the approach I outlined above?
What can we use `accessToken` and `refreshToken` for?

Thanks a lot in advance for your replies^^
Python Zero to Hero - Ep.15 - Python generators
Tags: python, tutorial, video, generators
Published: 2020-07-20 19:03:09

---
title: Python Zero to Hero - Ep.15 - Python generators
published: true
description: Moving from iterators late week, we have introduced generators (or generator functions). Which lets you create iterators just like writing a function, with yield. It also got a "send" method which lets you pass information from one iterator to another, setting the stage for async in Python.
tags: Python, tutorial, video, generators
---

Moving from iterators late week, we have introduced generators (or generator functions). Which lets you create iterators just like writing a function, with yield. It also got a "send" method which lets you pass information from one iterator to another, setting the stage for async in Python. If you have any questions or any suggestions about which Python topics to cover, please leave your comment at my [Twitch channel](https://www.twitch.tv/cheukting_ho)

You can get the slide deck [here](https://slides.com/cheukting_ho) and the example code and homework form [GitHub here](https://github.com/Cheukting/python02hero). Ask questions at my [Twitch channel](https://www.twitch.tv/cheukting_ho)
SHOWCASE YOUR GITHUB PROFILE WITH CODERSRANK
Tags: github, python, career
Published: 2020-07-20 19:00:55

Hi all!
I would like you to meet an amazing platform, called <a href="https://bit.ly/2NbSVLS" target="_blank">CodersRank.</a> On <a href="https://bit.ly/2NbSVLS" target="_blank">CodersRank.</a>, you can create your ultimate developer profile based on the public and private data you hold on various coding sites.
So, what does this profile do for you?
1.You can get personalized job offers 
2.You can monitor your professional progress 
3.You can network with other developers, get inspiration or just have a good time
4.You can save yourself a lot of time by not having to update your CV ever again
CodersRank will show who you really are and what you've built. :male-technologist::female-technologist:
We already have a large number of developers  on the site, so take a look at how you rank among them
4 Secrets To Building A Portfolio That’ll Make Everyone Want To Hire You
Tags: hiring, portfolio, job, devlive
Published: 2020-07-20 18:46:04

When it comes to proving yourself professionally, it’s important to show and tell.
1. Figure Out What You’re Showing Off
Before you can figure out how to show off your work, you need to understand what you want others to see.
Even though you’ve got a lot more real estate on an online portfolio than you do on your resume, you should be equally selective about what you include. After all, people have limited attention spans, and you only want to upload the samples that best demonstrate your talent and experience.
2. Keep it Simple
When it comes to showing your stuff, less is definitely more. We suggest presenting your projects in a straightforward format on one web page.The lack of captions means all your attention is focused on the photos. However, when you hover over an individual image, a caption pops up. Clicking on the image brings you to a detailed description of the shoot, additional photos, and helpful links.
3. Make it Easy to Navigate
Another way to make your portfolio easy for readers to navigate? Use categories. When you’ve got a lot of work to show off, placing everything on one page can be overwhelming. It can also be misleading — if the first three projects are all related to digital strategy, potential clients might assume you don’t offer any other services and miss the web development projects further down on the page.
4. Remember It’s Not Just About Your Work
While your past work is a critical aspect when someone’s thinking about working with you, it’s important to remember that said person isn’t looking to hire your work, but the person who made it.
A good portfolio is made even better when it’s part of a robust personal website — including a bit about your story, background, and what type of person you’re like to work with.
If you Want Such Portfolio I will design for you ! -> https://www.fiverr.com/s2/5aa4a9814e
How to beat your competitors in a backlink building?
Tags: webdev
Published: 2020-07-20 18:33:20

How to beat your competitors in a backlink building?
How to beat your competitors in a backlink building? This is the question for many people such as website owners and people working on SEO link building. So let us start with that question.

Who are your competitors? In every niche anyone has competition, so if you have a website maybe your competitor is only five places ahead, or even maybe only one place ahead, which puts you in the second place.

To start beating your competition you need to know who your competitors are.

Beat them with link intersect
To start this, you need to have the access to the Ahrefs tool. I use this tool for my clients and myself in link building and SEO analysis for my clients’ website and my website.

How to star and beat competitors in link building?
When you get access to the Ahrefs tool you will see a section below LINK INTERSECT.

Before you click the link intersect, make sure you type your website URL in link explorer because you want to compare your website with competitors’ websites.

The next step is to click on link intersect and you will get 3 fields where you have to type your competitors’ URL-s.

Let us start with stealing your competitors’ backlinks.

NEXT STEP IN STEALING YOUR COMPETITORS’ BACKLINKS
How to beat your competitors in a backlink building?
How to beat your competitors in a backlink building?
After you complete all of these steps (you can insert three of your competitors’ URL-s) and then click show link opportunities

After that, you will get all domains that are linking to your competitors’ websites but not to your website.

How to beat your competitors in a backlink building?
YOUR competitors are not so dominant in link building
After this process, you will get an insight into linking domains that are linking to your competitors’ websites, and then you can go and explore what you can do.

My google SERP competitors got backlinks (all three of them) from website prlog.ru which comes from a webpage that makes websites analysis.

How to beat your competitors in a backlink building?
So we are going to do the same reverse and get a backlink like our competitors. Surely it is a no-follow backlink but since they have one, why also not take the same one.

Next linking domain is the one that two of our competitors got backlinks from is clutch.co.

Now we have a different thing. We get a no-follow link but it is a content link. So we need to contact clutch.co. with an article to get guest posting content backlink. Since it is hard to get a guest post you can find an alternative finding a similar website with the same or above DA to get a backlink.

CONCLUSION
For building backlinks and beat competitors in backlink building, the right tool to use is Ahrefs and link intersect.

If you would like to hire an SEO agency you can contact us for backlink building or <a href="http://project09.com" rel=author />More...</a>
<a href="https://maps.google.com.br/url?sa=t&url=https%3A%2F%2Fproject09.com%2F" rel=author />More...</a>
Write Scraped Twitter Data to Airtable
Tags: tutorial, wayscript
Published: 2020-07-20 18:23:21

Introduction
------------

Have you ever wanted to do more with your Twitter followers data such as grabbing their bios and exporting them to a platform like Airtable? WayScript is the perfect answer and can be created in a short amount of time

Prerequisites
-------------

You will need to have an Airtable account and generate an API key. To learn more about how to do that to can refer to the following documentation

*   [Working with Airtable](https://docs.wayscript.com/library/modules/airtable)

You will also need to create a base with a proper table name and column fields like the example below

![](https://cdn.wayscript.com/blog_img/119/airtable_base.PNG)

Finally, we will need to import the Time Trigger, Airtable, and Twitter packages which can be done easily through the WayScript libraries tab

![](https://cdn.wayscript.com/blog_img/119/libraries.PNG)

For this post we will be using the Loop module and the Time Trigger and Twitter packages. For more information on these you can use the following resources:

*   [Working with Time Trigger](https://docs.wayscript.com/library/triggers/time-trigger)
*   [Working with Loops](https://docs.wayscript.com/library/logic/loop)
*   [Working with Twitter](https://docs.wayscript.com/library/modules/twitter)

Getting Started
---------------

Simply, click the ‘+ New Script’ button found in the top right corner to start creating your new workflow.  
  

![](https://cdn.wayscript.com/blog_img/83/1.png)

  
  
Now, let’s add and enable a simple _Time Trigger_  
  

![](https://cdn.wayscript.com/blog_img/119/time_trigger.PNG)

  
  

Search Twitter for Followers
----------------------------

First, we will want to search for a list of followers to your _Twitter_ account. Note that the highlighted area should be your _Twitter_ handle  
  

![](https://cdn.wayscript.com/blog_img/119/twitter_followers.PNG)

  
  

Followers Loop
--------------

We will need to use the _Loop_ module to iterate through your followers  
  

![](https://cdn.wayscript.com/blog_img/119/loop.PNG)

  
  

Twitter Followers Bio
---------------------

Within the loop we will want to first add another _Twitter_ step to grab the bio of each follower  
  

![](https://cdn.wayscript.com/blog_img/119/get_twitter_follower_bio.PNG)

  
  

Write to Airtable
-----------------

Finally, we add a final step inside our loop to write our followers _Twitter_ handles and bios to _Airtable_  
  

![](https://cdn.wayscript.com/blog_img/119/airtable.PNG)

  
  

Result
------

Your Twitter follower data will now be written to Airtable automatically  
  

![](https://cdn.wayscript.com/blog_img/119/result.PNG)

  
  
As always, if you have any questions, comments, feedback, or suggestions, please let us know on WayScript or through our [discord](https://discord.gg/VWbXSbj). If you would like to view this WayScript simply follow the link [Twitter to Airtable](https://wayscript.com/user/wizgeeky/boHWA_Fi).
Taxi Booking App source code | Uber Clone 
Tags: android, javascript, ios, wordpress
Published: 2020-07-20 18:22:33

About Taxi Booking App
This project is a complete clone of Uber, which is a taxi booking iOS app. We have build this app using Native Objective- C for iOS and Native Java for Android. You can download this taxi booking app source code for free by scrolling down. Some of the great features of the app are:

Feature of User App :
Intro Video splash screen to give appealing look to the app.
Google api integration for autocomplete
Plotting of places to google map with distance and minutes calculation between routes.
One step and easy booking process.
Integration with Paypal and Stripe Payment gateway.
Support different rates for day and night.
Option to set cab types with rates from backend CMS .
Stylish animation between views with Facebook style slide menu.
Display all booking with scroll to load and clean UI.
Filters to sort booking’s on the basis of completed, pending booking etc.. Available on both User and Driver App.
Enable Auto refresh when driver accept job on driver arrival, journey begin , journey completed / dropped etc.
Support Push messages for all the status as well.
Live tracking Driver who are assigned for your booking.
Option to Cancel the Job till driver is not assigned.
Rate card screen with option to view all Taxi’s day and night rates.
100% Native Objective C and shipped with full source code.
Support localization and Internationalization .
Support RTL Languages
Share ETA to Facebook and Twitter .
Read full article at https://prosourcecode.com/taxi-booking-app-source-code-free-download/