teleren/devto huggingface dataset:
SwiftUI Previews: Fix 'Cannot convert value of type SomeType to expected argument type EnvironmentObject<SomeType>' errors
Tags: swift, swiftui
Published: 2020-07-31 18:36:19

Using `@EnvironmentObject` is a great way to [share data between your views]. Previously, I'd been using `@ObservedObject`s all over my views, and it felt clumsy.

Hot tip: by setting an `environmentObject` for a `NavigationView`, any children of this `NavigationView` can then add a property like `@EnvironmentObject var someType: SomeType`. SwiftUI then gives them access to the observed object, without you having to pass the object down the navigation tree and through views that don't need access to it:

```swift
/* ContentView.swift */

import SwiftUI

struct ContentView: View {
    @ObservedObject var someType: SomeType

    var body: some View {
        NavigationView {
            MyView()
        }
        .environmentObject(someType)
    }
}

/* MyView.swift */

import SwiftUI

struct MyView: View {
    var body: some View {
        SomeTypeList()
    }
}


/* SomeTypeList.swift */

import SwiftUI

struct SomeTypeList: View {
    @EnvironmentObject var someType: SomeType
    
    var body: some View {
        // Do something with someType
    }
}
```

But! If you were passing it in to a child view as an `ObservedObject` and had set up some test object for use in your SwiftUI preview? If you try to pass in your test object, you'll get an error:

_Cannot convert value of type '`SomeType`' to expected argument type '`EnvironmentObject<SomeType>`'_

To fix this, use the `environmentObject` modifier on your child view's preview provider:

```swift
struct SomeTypeList_Previews: PreviewProvider {
    static var previews: some View {
        SomeTypeList()
            .environmentObject(testSomeType)
    }
}
```

Yay, your preview works again!

[share data between your views]: https://www.hackingwithswift.com/quick-start/swiftui/how-to-use-environmentobject-to-share-data-between-views
What was your win this week?
Tags: discuss, weeklyretro
Published: 2020-07-31 18:33:18

---
title: What was your win this week?
published: true
description: Share the highlights of your week, technical or otherwise! 
tags: discuss, weeklyretro
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/nujcfyzx33x386bvwe2v.png
---
👋👋👋👋

Looking back on your week — what was something you're proud of?

All wins count — big or small 🎉

Examples of "wins" include:

* Learning something new
* Starting a new project
* Fixing a tricky bug
* Cleaning your house...or whatever else that may spark joy 😄



![Friyayyyy](https://media.giphy.com/media/5C0Efx0dzvAxBP2Z7J/giphy.gif)
NLTK modules overview
Tags: nlp, machinelearning, python
Published: 2020-07-31 18:23:35

**NLTK** stands for **Natural Language Toolkit** and it is suite of libraries and programs in Python for Natural Language Processing Tasks. It is one of the most widely used NLP Python libraries. 

It can perform various NLP tasks like tokenization, stemming, POS tagging, lemmatization and classification to name a few.

A summary of popular modules of NLTK is given in the table below.


| S.No | Language Processing Task   | NLTK module                 |
|------|----------------------------|-----------------------------|
| 1    | Accessing Corpora          | nltk.corpus                 |
| 2    | String Processing          | nltk.tokenize, nltk.stem    |
| 3    | Collocation discovery      | nltk.collocations           |
| 4    | Part-of-speech tagging     | nltk.tag                    |
| 5    | Classification             | nltk.classify, nltk.cluster |
| 6    | Chunking                   | nltk.chunk                  |
| 7    | Parsing                    | nltk.parse                  |
| 8    | Semantic interpretation    | nltk.sem, nltk.inference    |
| 9    | Evaluation metrics         | nltk.metrics                |
| 10   | Probability and Estimation | nltk.probability            |
| 11   | Applications               | nltk.app, nltk.chat         |
| 12   | Linguistic fieldwork       | nltk.toolbox                |
[Week 31]Good First Issues
Tags: goodfirstissue, opensource, github
Published: 2020-07-31 18:07:02

Hey folks, just want to mention we have a [discord](https://discord.com/invite/gZMKK5q) for Open Sauced and it is the place where the idea for the newsletter came about. One of our newest members to the pizza party shared their project, [ApurvShah007/portfolio-optimizer](https://github.com/ApurvShah007/portfolio-optimizer) - _A collection of various computational methods to optimize a user's investment portfolio using Modern Portfolio Theory and optimizing various factors such as Returns, Sharpe Ratio and Risk_.

If you have a project to share let us know and we can add it to the newsletter.

_This list was sourced from [goodfirstissue.dev](https://goodfirstissue.dev/)._

# What is this? 👀
There are several projects looking for contributions from experience and first-time contributors. Below is a list of those projects.

## :green_book: The List
### 🐊  TypeScript/JavaScript
- [strapi/strapi](https://github.com/strapi/strapi/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) - 🚀 Open source Node.js Headless CMS to easily build customisable APIs
- [iodide-project/iodide](https://github.com/iodide-project/iodide/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+label%3A%22good+first+issue%22) - Literate scientific computing and communication for the web
- [GoogleChrome/lighthouse](https://github.com/GoogleChrome/lighthouse/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+no%3Aassignee) - 

### 🐍  Python
- [freedomofpress/securedrop](https://github.com/freedomofpress/securedrop) - GitHub repository for the SecureDrop whistleblower platform. Do not submit tips here!
- [facebookincubator/Bowler](https://github.com/facebookincubator/Bowler/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+label%3A%22good+first+issue%22) - Safe code refactoring for modern Python.

### 🍕 Open Sauced

- Images flicker when the page has reloaded the homepage. [#612](https://github.com/open-sauced/open-sauced/issues/612)
- Pagination: Unhandled Rejection (TypeError): Cannot read property 'gitHub' of null [#535](https://github.com/open-sauced/open-sauced/issues/535)
- Feature: Create a Changelog [#668](https://github.com/open-sauced/open-sauced/issues/668)

If you have good first issues feel free to comment below.
Cloudinary with GraphQl 
Tags: graphql, cloudinary, architecture, react
Published: 2020-07-31 18:03:10

 Hi guys, 

I am writing a code, and I need to do query & mutation to/from cloudinary using GrapqhQl on the backend. I am use to use cloudinary with Rest Api and the middleware uploadCloud but I have no idea how to make it work with graphQl
State of Emmet
Tags: html, css, emmet, discuss
Published: 2020-07-31 17:53:32

I love emmet.io and find it a very underrated plugin.
Perhaps this is because there are some frameworks and templating engines that I don't know about as a beginner, and I guess most developers do not write their projects from scratch but come to existing ones.

Earlier this year, I discovered several bugs within it. A friend of mine was telling me about how flexbox and grid layouts work and showed me a few Emmet shortcuts. I noticed that they work fine on Codepen, but behave completely differently in the VSCode.

As a result, I ended up testing all the abbreviations I learned about in 4 editors (VSCode, Brackets, SublimeText, Atom) and on CodePen.

Today I finally decided to write about them, went to GitHub, opened several Issues in case there was already such a problem, and came across other similar bugs.
 
At this moment, I realized that I have questions for which there are no clear answers anywhere on the web.

What to consider the main Emmet plugin?
How to distinguish a problem with the plugin itself and conflict with the editor?
Where is it better to write about those kinds of bugs? To the Emmet? To the code editors?

And the most important ones:
Does Emmet still alive? Or is it slowly dying, keeping only on the energy of enthusiasts? If it is, why?

P.S. Don't get me wrong, auto suggestions / textual completions in editors is a cool thing, but typing code without even looking at them is whole other experience.
New Savings Bond Wizard Available
Tags: savingsbondwizard, savingsbond, financial, calculator
Published: 2020-07-31 17:51:07

Record your I, E, or EE series savings bonds in an .xlsx or .csv file and import the list into our new <a href="#">savings bond wizard</a> to determine the total cost, interest earned, and the redemption value of all your us savings bonds!

Visit this YouTube video for a quick ~1m demo on <a href="https://youtu.be/bmpDWGRRl8s">how our savings bond calculator</a> works.
This will get your Pull Request merged Quickly
Published: 2020-07-31 17:42:19

These PR reviews points are for the Software Company products, for open source libs PR there could be little deviation from these points.


> Pull request review is a collaborative process, all the team members should participate in this, with the thought of improving the code

---

### Keep the PR Small

PR should be as small as possible and very much specific to the problem statement it is trying to solve, avoid to make unnecessary changes in the PR.

---

### Put proper and elboartive PR description

Add proper PR description, screenshot to your PR so that the reviewer can quickly prepare a mental model of the changes, and there will be less back and forth around the PR.

---

### PR Navigation

Add proper comments to your PR so that it is easier for the reviewer to understand the changes better and navigate easily in the PR.

---

### Mention Impacts

Mention about the impacts this PR can make on the existing critical features so the reviewer can help you in identifying any edge case or scenario missed by you.

---

### Be open for suggestions

Always remember PR review is not Criticism, it is collaboration, so take suggestions sportingly and use it as an opportunity to improve your code and skills.

---

### What if you disagree.?

*Disagreements will definitely occur during the PR review*, but always remember to voice out your opinion in calm and friendly manner and keep it a collaborative positive discussion, rather than a competition of being who is right.

Also, put proper elaborative reasoning behind your disagreement

---

### Be quick in fixing PR comments

Once you have received the feedback on your PR make sure you fix those comments ASAP, if you will delay may be the reviewer loose context of the changes.

*Feel free to add your thoughts and practices for PR reviews*
Switch Your Job, Save Democracy
Tags: career, startup, codenewbie
Published: 2020-07-31 17:01:15

Calling all tech, data, and paid media talent: we've got under 100 days to the election, and the progressive movement needs your help more than ever. Join All Hands to get matched up with a job at one of the most impactful organizations today (it's free!).

We'll work to actively matchmake you to roles with our hiring partners and vouch for your experiences wherever we can. We've got over 40 hiring partners (including Color of Change, SEIU, Priorities USA, the DNC, Fair Count, Hustle & many more) and 300+ active roles. Apply here to join the talent pool >> https://all-hands.us
UseFetch hook for react js.
Tags: react, javascript
Published: 2020-07-31 17:25:56

hello guys, will show you a custom hook for handling async call.
`useFetch` hook take a `callback` as first argument and `callback` params for rest arguments. 
here it's:

```
const useFetch = (cb, ...params) => {
  const isMounted = useRef();
  const [response, setResponse] = useState();
  const [loading, setLoading] = useState(false);
  //const [error, setError] = useState();

  return {
    response,
    loading,
    isMounted,
    reset: () => setResponse(),
    fetch: async (reload = false) => {
      try {
        isMounted.current = true;
        if (!response || reload) setLoading(true);
        const data = await cb(...params);
        if (isMounted.cuurent) {
          if (data) setResponse(data)
        }
      } catch (error) {
        errorNotification(error); // do something with the error
        // or u can add setError(error)
      }
      finally{
     setLoading(false);
       }
    }
  };
};

```
Usage:

```
const UserProfile = ({ id }) => {
  const { response, loading, fetch, isMounted } = useFetch(getUserProfile, id);
  useEffect(() => {
    fetch();
    return () => {
      isMounted.current = false;
    };
  }, []);
  return (
    <>{loading ? <p>Loading...</p> : response && <p>{response.userName}</p>}</>
  );
};
```
Note: `isMounted` is used to detect component `unmount` for not firing unnecessary state update.
hope you like it,thanks.
Uninstall Anaconda from MacOS Catalina
Tags: anaconda, python, macos, uninstall
Published: 2020-07-31 17:19:12

After I updated my MacOS to latest version when I tried to follow uninstall steps listed on official anaconda document it didn’t work. I had to look through couple of articles on internet and finally one which worked for me is I am documenting here so you don’t have to go through all the same steps again. Enjoy !

So when we upgrade our OS, zsh bash profile is not updated and so our conda commands don’t work. To solve this first we run following commands in terminal.

```
curl -L https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe -o cpr && chmod +x cpr ./cpr rehome ~/anaconda3

source ~/anaconda3/bin/activate

conda init zsh

```
So above command will activate your virtual environment and there you can use your conda command in your terminal. So now just following steps mentioned in official anaconda documentation will be pretty straight but remember there’s one important step so keep following me.

Now official documentation ask you to install new package called  anaconda-clean which will basically help you to take easy backup before you uninstall completely. So to do that run this command.

`conda install anaconda-clean`

Now to take backup just run that package which you just installed.

`anaconda-clean  —yes`

You’ll notice one new directory created name .anaconda_backup

Now this is important step, you have to deactivate virtual environment before you delete anaconda directory so run following command.

`conda deactivate`

Now you can remove anaconda directory by following command.

`rm -rf  ~/anaconda3`

Also you can choose to remove conda path from your bash profile so you’ll have fresh installation next time if you want. Run following command and put # to comment line or just delete what is mentioned next.

`sudo nano ~/.bash_profile`

**#export PATH=“/Users/your_username/anaconda3/bin:$PATH”**

**DONE !! Congratulation you have completely uninstalled anaconda from your MacOS.**
Portfolio Template using Flutter
Tags: flutter, dart, tutorial, webdev
Published: 2020-07-31 17:13:09

> “A clean, beautiful and responsive portfolio template for Developers !”

If you created something awesome and want to contribute then feel free to open Please don’t hesitate to open an pull request.

[Source Code](https://github.com/naveenjujaray/DeveloperFolio) -- [Live View](https://developerfolio.web.app)

## Desktop View
![Desk](https://github.com/naveenjujaray/DeveloperFolio/raw/master/gif/desk.gif)

## Tablet view
![Tab](https://github.com/naveenjujaray/DeveloperFolio/raw/master/gif/tab.gif)

## Mobile View
![Mob](https://github.com/naveenjujaray/DeveloperFolio/raw/master/gif/mob.gif)

## Sections
✔️ Summary and About me

✔️ Skills

✔️ Proficiency

✔️ Achievements 🏆

✔️ Blogs

✔️ Contact me

## Getting Started
From your command line, clone and run developerFolio:

In-order to work with this repo you need to have flutter beta installed on your system.
```
# Clone this repository
$ git clone 

# Go into the repository
$ cd DeveloperFolio

# Get Packages
$ flutter pub get

# Build Web using Flutter
$ flutter build web

# Launch/View
$ flutter run -d chrome
```
## Deployment 📦
When you are done with the setup, you should host your website online. We highly recommend to read through the docs for [Firebase](https://firebase.google.com/docs/hosting/quickstart) Hosting.
```
# Before you can install the Firebase CLI, you will need to install Node.js on your machine.
$ npm install -g firebase-tools

# Firebase Login
$ firebase login

# Initialize Firebase
$ firebase init

# Deploy to Firebase
$ firebase deploy
```
## For the Future
* Dark Mode
* Connect with LinkedIn to get Summary, Skills, Education and Experience
* Connect with Github to get Customized Pins, Profile Details
Personalization Page to edit everything in once place.

For more details check my [blog](http://naveenjujaray.js.org/)
Two Animated NavBars with Hover Effects using HTML & CSS
Tags: css, beginners, tutorial, design
Published: 2020-07-31 16:57:45

{% youtube Opd1DKvBNTo %}

In this Tutorial, we'll build a Two Animated Navigation Bars with Hover Effects using HTML & CSS Flexbox. This Project-based Tutorial is suitable for all especially Beginners.

📕 Images download link:  https://drive.google.com/drive/folders/1A8AYloN3DVe2Oz6a9qSFolDnSjz4peLO?usp=sharing

🧠 Concepts covered in this video:
 - Modern Web Design
 - Flexbox
 - Animations 
 - CSS transitions
 - Transforms

If you are interested in more real-world **project-based tutorials** then consider checking out the [**Code League**](https://www.youtube.com/channel/UCBF2LIwr2Odb3-pRnNBRegA) Youtube channel and inspire the tech industry.

Share this [video](https://youtu.be/Opd1DKvBNTo) with a friend

Let’s connect:
[Instagram](https://www.instagram.com/codeleague7)
[Twitter](https://www.twitter.com/codeleague7)
Check for Armstrong Number
Tags: challenge, computerscience, python, algorithms
Published: 2020-07-31 16:50:23

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

### Topic : Armstrong Number

### Problem Statement:
> An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 153 is an Armstrong number since 

```
1**3 + 5 **3 + 3**3 = 153.
```

Write a program to check the number is Armstrong number is not.

{% post codeperfectplus/10001st-prime-project-euler-soution-2fa3 %}

```python
def is_armstrong_number(number):
    num = str(number)
    exp = len(num)
    return number == sum([int(i)**exp for i in num])
```

Share your solution to check Armstrong number.
Ask Octopus - How do I change the order of the environments in my lifecycle?
Tags: octopus, devops, tutorial
Published: 2020-07-31 16:40:18

---
title: Ask Octopus - How do I change the order of the environments in my lifecycle?
published: true
description: Learn how to change the order of the environments in your default Octopus lifecycle.
tags: octopus,devops,tutorial
series: Ask Octopus
---

Why does adding a new environment add it to the end of the default lifecycle? Let's find out why and what you can do to change it in this week's Ask Octopus.

{% youtube AOT1PMwrQc4 %}

Do you have a question about how to use Octopus? Email advice@octopus.com and someone from our team will get you an answer. You might even see it in a future episode.

Join our community slack at https://octopus.com/slack
Installing Postman or other apps on Elementary Os Linux with snapcraft.
Tags: linux, beginners, todayisearched
Published: 2020-07-31 16:36:40

Hi, guys now i'll teach you how install any programs, on elementary Os linux with: <pre>snap</pre> if you are begginer on back-end career and you want use linux/ubuntu LTS based distribuition **it's a good tip.**
first place, **Elementary Os** is a linux operational System that looks like mac interface. based in Ubuntu LTS  distribuition. 
let's go at steps:
1.
<pre>***open your terminal***</pre>
2.
<pre>$ sudo apt update
$ sudo apt install snapd </pre>

and you can test on:
<pre>$ sudo snap install hello-world</pre>
<pre>$ hello-world</pre>

the next step is:
<pre>$ sudo snap install <any-program></pre>
it's interesting you go on **Snapcraft Store** to see the command that you have to apply on your terminal.

more information you see on:

https://snapcraft.io/
Quick VueJS Tip: Prop Validations
Tags: vue, javascript
Published: 2020-07-31 16:12:48

Catch typos and errors with prop validator functions.

It's also great for reminding yourself what options you want to allow.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/c5ugw6z6ac70kqfy7yj1.png)
Test Timing-Based JS Functions with Jest
Tags: javascript, testing, jest
Published: 2020-07-31 15:43:23

Asynchronous code is a key part of writing JavaScript. Modern web apps require timing-based elements like `setTimeout` and `setInterval`. For instance, a loading indicator that displays only after 100ms have elapsed or a debounced API endpoint that ensures requests aren't fired too often.

But, **how do we test this kind of timing-based functionality?**

I dig into this question in a quick screencast. Give it a watch!

{% youtube WbPXXDijkhc %}

## Details

Jest offers a set of [Fake Timer utilities](https://jestjs.io/docs/en/timer-mocks) that can be used to test functions that rely on functions like `setTimeout` and `setInterval`.

Here is a basic `delay` function that uses `setTimeout`:

```javascript
export const delay = (milliseconds, fn) => {
  setTimeout(() => {
    fn();
  }, milliseconds);
};
```

We might take a first stab at testing `delay` with something like this:

```javascript
import { delay } from "./delay";

describe("delay", () => {
  test("does something after 200ms", () => {
    const doSomething = jest.fn();

    delay(200, doSomething);

    expect(doSomething).toHaveBeenCalled();
  });
});
```

Because of the `setTimeout`, the `expect` call will be evaluated as a failure before `delay` is able to fire `doSomething`.

Not only does JavaScript not offer a clean way to _sleep_, but we wouldn't want to slow our test suite down with a bunch of sleep-like calls anyway.

Instead, we can take advantage of the timer mocks that Jest offers.

This only requires two additional lines of code:
1. Tell Jest to use fake timers for this test file.
2. Tell Jest to advance timers by enough for the `setTimeout` to be triggered.

```javascript
import { delay } from "./delay";

jest.useFakeTimers();

describe("delay", () => {
  test("does something after 200ms", () => {
    const doSomething = jest.fn();

    delay(200, doSomething);

    jest.advanceTimersByTime(200);

    expect(doSomething).toHaveBeenCalled();
  });
});
```

Advancing the timers by `200` milliseconds causes the `setTimeout` to call `doSomething` which our test's expectation can verify.

You can even use multiple `jest.advanceTimersByTime` calls in a test if your situation calls for it.

---

There is more where that came from. If you enjoyed this post and screencast, [subscribe to my newsletter](https://tinyletter.com/jbranchaud) and check out [more of my screencasts](https://www.youtube.com/user/jbranchaud).
The Technique,I Learnt about  Git
Published: 2020-07-31 16:06:13

Git is an application which helps you to keep your files in the source code history.

GitHub is a service, where you push your files into a Git repository. It also helps you to work with your team remotely on a project.

The Technique, I learnt on Git, is how to put your project on Git repository.You can do it in this order.


sign in, to your GitHub account , at the upper right corner of GitHub page.Click on + down arrow.choose New repository.



On the repository name box,type in a short name you can remember easily.



Add a description of your repository,for example,My first task on repository.



Choose how you want your repository to be seen by viewers.



Click on initialize this repository with a README.



Click create repository