teleren/devto huggingface dataset:
What I have learned so far with Python 
Tags: python, beginners, discuss
Published: 2019-08-02 07:32:08

---
title: What I have learned so far with Python 
published: true
description: 
tags: #python,#beginners,#discuss
---



Python is a fantastic programming language and I found that for me, it is the easiest language I have seen so far, well I do not have lots of knowledge on different languages, in fact I have had contact only with C++ and JS before, and I was told that JS is the most simply language for beginners, what I do not agree, I can surely say that Python is!

But what makes me say that? Simple answer, in my view Python has a simple syntax, with no complication and it is very direct. If you want to print something, just use <em>print()</em>! That is what I am talking about, simplicity.

The languages are classified in basically two fields: <strong> Natural </strong> and <strong> Formal </strong>. The <em> Natural</em> languages are the languages we speak, like English, German, Spanish (...), and the <em>Formal</em> are the languages we use to "talk" to machines, used to represent Math, Chemistry and so on. Formal languages tend to have a strict syntax and very specific. Python has an easy to understand syntax and it is very similar to our natural language, what makes it easy to learn.


<strong>What can we do with Python?</strong>

Hard question to answer because we can use Python for a lot of things. Data Science, Machine Learning and Artificial Intelligence, Web Development, simple manipulation of data... well the possibilities are immense. There are awesome libraries out there to be used according to the need of the project: TensorFLow, Numpy, SciPy...


So far I was able to write small programs like the Iris flower classification (a very beginner program), compared and created charts on population growth, prices of cars sales according to their features, basic suggestion program based on previous choices from user and I even created a simple game with Python, what I find fantastic!

Well we all know that not everything can be only flowers, if you know what I mean. As every language, Python requires dedication, effort, practice, persistence and maybe the most important: <strong>Passion</strong>. So if you are learning Python, or thinking about it, be prepared to struggle sometimes and to study a lot, but I guess that is is like that with every language or every new subject we learn.

So, to finish, I really want to encourage you to start your studies with Python,not only if you are new to coding. It is a wonderful language and I learned so many things that are applicable to other languages too! The possibilities are that you fall in love with it or learn something new, but I guarantee, it totally worth a try!
Avoid Unnecessary Rendering for Function Components in React
Tags: react
Published: 2019-08-02 07:16:42

With the introduction of the React hooks, we are using function components more, and what you might have noticed that they render all the time, not caring if the props stay the same. For example, if you have a big list of to-do items, and you are adding a new item to the list, all the item components will re-render, even if they return the same result given the same props.
Class components have additional methods to prevent unnecessary rendering: `PureComponent` and `shouldComponentUpdate`. The former one is easy to use; the user doesn't need to write any additional logic; the component shallowly checks the props and rerenders if it detects new ones. The latter method is of the lifecycle, and the user needs to write the logic by manually comparing the properties or state, and tell the components if it has to render.
Function components have a method to avoid unnecessary rendering too, and only the syntax differs a little bit. React.memo() - does component memoization, cashing result and reuse it if the props did not change.

## React.memo() 
A higher-order component that will memoize your component, very similar to `PureComponent`. It will shallowly compare current and new props of the component, and if nothing changes, React will skip the rendering of that component. To help method be effective as possible, make the prop structure as primitive values or simple objects. If you have a complex object, the comparison might fail, the component will not be memoized and will render again.
The use is pretty simple:
```javascript
function List() {
  return ['one', 'two'].map((item) => (
    <MemoizedListItem item={item} />
  );
}

// Memoize ListItem component
const MemoizedListItem = React.memo(function ListItem({ item }) {
  return <li>{item}</li>
})
```
In this case, if you add a new item to the list, only the component with the new item will render to the DOM, the first two will use the result from the last rendering.

If the prop structure is more complex and requires manual comparison, you can pass an additional function to `React.memo()` as a second argument. The function will receive two arguments `prevProps`, `nextProps` and it must return a boolean if the props are the same. It is the opposite return statement comparing with the `shouldComponentUpdate`.

```javascript
const ListItem = React.memo(
  function ListItem({ item }) { ... }, // first argument
  function arePropsEqual(prevProps, nextProps) { // second argument
    return prevProps.item === nextProps.item;
  }
);
```

## Conclusion
`React.memo()` is a performance optimization method, so first make sure if you need it. Do profiling of your app, measure the performance, and apply the method if it is necessary. A wrong application might lead to bugs.
Comparing website with designs using Figma + GluePrint
Tags: design, figma, zeplin
Published: 2019-08-02 07:00:24

---
published: true
title: 'Comparing website with designs using Figma + GluePrint'
cover_image: 'https://thepracticaldev.s3.amazonaws.com/i/ru4adz37fdmfaa0oig8u.png'
description: 'Compare your design with the running app/website design using Figma+GluePrint (an alternative to "Pop Out" in Zeplin)'
tags: Design, Figma, Zeplin
---

At Australia Post we use [Figma](https://www.figma.com/features/) to create and share UI designs. In the past we used Sketch+Zeplin which has a really nice feature called ["Pop Out"](https://support.zeplin.io/en/articles/1437093-comparing-app-website-with-designs-using-pop-out). It allows you to overlay the designs on the running app/website to to easily see if the UI you're developing on matches the designs. Figma does not have this same feature (as far as I know).

There is a workaround, however, to get similar functionality with Figma using [GluePrint](http://glueprintapp.com/).

1. Export the design as a PNG (select frame then export as 1x PNG).

2. Open the image in GluePrint. You can change the opacity from GluePrint by scrolling.

3. Open your running app/website and GluePrint will be overlayed on top of it. You can then compare it with the designs to make it pixel perfect!

## Example

![Example showing the steps above](https://media.giphy.com/media/fqgrhd4447r8jbZ4H3/giphy.gif)

It's not as convenient as Zeplin's Pop Out feature but it does the job.

If you have any better ideas please let me know in the comments.

## Found a typo?

If you've found a typo, a sentence that could be improved, or anything else that can be updated on this blog post, you can submit pull request to update the content directly at [the repository](https://github.com/BBlackwo/my-dev.to/blob/master/blog-posts/figma-pop-out/figma-pop-out.md).
How do I regain my sense of purpose after quitting my job
Tags: discuss, advice
Published: 2019-08-02 06:47:05

I recently quit a long time job, and honestly things have not been the same since.

{% twitter 1149869676073226240 %}


I've occasionally discussed the reasons for leaving in the comments here at DEV, but to summarise - General lack of organisation and weak financials drove my decision.

I've been having a hard time coming to grips with the void that left in my life. I'm a 20 year old undergraduate student in India, and I had gotten quite comfortable in the fact that I was earning a decent bit of money for myself, helping the family with minor expenses, and saving up in a culture where employment alongside college is not really common or even looked up to, much less doing so remote.

I've been trying to get hired elsewhere to regain that stability I felt before and to fill the void left over by the reduced responsibilities, but it's been an uphill battle. My previous hire was a result of my contributions to the company's open source project [substratum](https://github.com/substratum/substratum) which I eventually took over as sole maintainer of. Job hunting and rejection is a new and demotivating experience for me and I can already feel the toll of it. My parents have been very supportive throughout the process, reassuring me that I don't _need_ to be employed and they would happily support me until I finish college and am able to pursue a full-time job, like practically every parent in the country but I just can't bring myself to terms with what I essentially see as me slumping into defeat.

Has anybody else here ever gone through a similar experience? How did you deal with the defeatist feelings? Is there a secret to getting hired that I am not aware of or am I just unemployable and got lucky the first time around?
Yet Another Weekly Newsletter?
Tags: showdev
Published: 2019-08-02 06:24:58

I can clearly hear you screaming the title! But wait, what about having a hand-curated list of articles, news, discussions, newly-developed or already popular packages, help-wanted & good-first issues in your inbox? That's why Packages Weekly goes live!

Behind the idea of creating another weekly newsletter was such clear: why don't we get updated about the latest news regarding packages we use everyday? With the PW newsletter, in every each of the the week, you will be receiving an email containing what you would like to be aware of what's going on among library/package/framework developers.

In the first (beta) issue, we're publishing some lovely libraries and frameworks related with [GraphQL](https://packagesweekly.com/#Topic_of_the_Week) as the topic of the week, too.

As a reminder, we will be adding Archive, Submit Your Link, Become Sponsor and Blog sections in a near future, so keep tight!

And of course, all kinds of feedback from you are very precious for us, so please keep us updated via emailing about bugs, inconsistencies basedo on content and other stuff you've noticed: packagesweekly@gmail.com

So why you wait? Join other package developers, maintainers, contributors & lovers today here: https://packagesweekly.com/

Cheers!
ComponentDidUpdate is not firing !!!!!
Tags: react, reactnative, redux, javascript
Published: 2019-08-02 05:22:01

I was updating a certain redux state in reducer like this, 

```javascript
case UPDATE_SOMETHING:
      return {
        ...state,
        something: action.something,
      };
```
and i was checking the state update like following, 

```javascript
componentDidUpdate(prevProps, prevState) {
    const { something } = this.props;
    if (!_.isEqual(prevProps.something, something)) {
      this.setState({ something });
    }
  }
```
But the problem is, i can see that my redux state is update in redux debugger, but componentDidUpdate is not firing anymore !!!!. After wondering for a while , i tried to update the redux state using shallow copy. Like this, 
```javascript
case UPDATE_SOMETHING:
      return {
        ...state,
        something: {
          ...state.something,
          ...action.something,
        },
      };
```
Its, working now!!!!!!
DSL (from the repository and probably not the best way of doing one either)
Tags: programming, basic, csharp, legacy
Published: 2019-08-02 05:05:23

Just posted a piece of programming memorabilia: a simple "[Script Language Interpreter](https://github.com/axtens/sli)" originally written in [MoonRock BASIC](http://www.rowan.sensation.net.au/moonrock.html) and then reimplemented in C#.

The original MoonRock BASIC source is provided along with the more recent C#. A number of sample scripts are also provided, including the classic "99 Bottles of Beer". 
```
    MACRO dec inc $1 -1
    define times 1
    defined %2
    ifyes set times {%2}

    define bottles 99
    define pronoun one
label drink
    message {bottles} bottles of beer on the wall\n
    message {bottles} bottles of beer\n
    message take {pronoun} down and pass it round\n
    inc bottles -1
    test eq {bottles} 1
    ifyes goto lastone
    message {bottles} bottles of beer on the wall\n
    message \n
    goto drink

label lastone
    message {bottles} bottle of beer on the wall\n\n
    set pronoun it
    message {bottles} bottle of beer on the wall\n
    message {bottles} bottle of beer\n
    message take {pronoun} down and pass it round\n
    message no more bottles of beer on the wall\n\n
    message no more bottles of beer on the wall\n
    message no more bottles of beer\n
    message go to the store and buy some more\n
    set bottles 99
    set pronoun one
    message {bottles} bottles of beer on the wall\n
    message \n

    inc times -1
    test eq {times} 0
    ifno goto drink
    end Burrrrp!
```
For other implementations of 99BoB, see [99 Bottles of Beer](http://rosettacode.org/wiki/99_Bottles_of_Beer) on RosettaCode.

[RosettaCode](http://rosettacode.org) is good for more than just irrelevant drinking songs. There's lots of good programming code demonstrated there.

> Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 961 tasks, 215 draft tasks, and is aware of 744 languages, though we do not (and cannot) have solutions to every task in every language.
Async Await Keywords in JavaScript - Make Asynchronous Code Look Synchronous
Tags: javascript, asynchronous, async, await
Published: 2019-08-02 04:01:42

**What is Anync Await Keyword?**
In JavaScript, we have used **promises** and the code of promise looks like an asynchronous code.

We can make asynchronous code look like a synchronous code by using async await keywords.

**Definition:**
Inside a function marked as async, you are allowed to place the await keyword in front of an expression that returns a promise. When you place await keyword, the execution of async function is paused until the promise is resolved/rejected.

![](https://thepracticaldev.s3.amazonaws.com/i/unfwut4ck2mufkdgfx5c.png)

Have a look at this tutorial which shows how to transform an asynchronous **fetch api call** to a *synchronous looking***(yet asynchronous)** code.

It will also show you the difference between Promises and Async/Await and which one's better.

{% youtube -PNOBmgcPoI %}
Which service provider should I use to host my backend for production?
Tags: javascript, node, heroku, programming
Published: 2019-08-02 03:53:18

---
title: Which service provider should I use to host my backend for production?
published: true
description: I've heard a lot about AWS, Digital Ocean, Heroku, Zeit etc but I'm unsure of which one to use for my backend. I'm trying to reduce my cost as I'm running a startup company and don't really have a lot of funds. Would love to hear your opinions. Thanks
tags: #javascript #node #heroku #programming
---
A Twitter Bot for Passive ❤️s
Tags: twitter, javascript
Published: 2019-08-02 00:36:49

---
title: A Twitter Bot for Passive ❤️s
published: true
description: 
tags: twitter, javascript
---

Paste this into your browser console (or make a plugin with Scriptish) and posts will ❤️ themselves automatically as you scroll

```js
setInterval(() => {
  const heart = document.querySelector(`[data-testid="like"]`);
  if(heart) heart.click();
}, 1408);
```

Or paste this into the address bar

```js
javascript:setInterval((heart=document.querySelector(`[data-testid="like"]`)) => {heart && heart.click();}, 1500);
```

`disclaimer: Automated likes are against Twitter ToS`

`second disclaimer: don't go to anyone's profile or you'll look like a stalker`
Not a Number
Tags: algorithm, computerscience, showdev, javascript
Published: 2019-08-04 20:33:00

---
title: Not a Number
published: true
tags: algorithm, computer science, showdev, javascript
canonical_url: https://atila.fassina.eu/the-case-of-nan/
---

# Checking NaN is tricky

First of all, it's simply not trivial to check it.

```js
NaN === NaN // false
```

This is one of those headscratchers that are like that just because. Long story short, there's a [spec](https://en.wikipedia.org/wiki/IEEE_754) for floating point numbers which determines that `NaN` values are never equal.

Then, for a long time we've had only the `isNaN()` method, which covers the above case, but it get you some unexpected results.

```js
isNaN(NaN) // true
isNaN('foo') // true
```

That's confusing. To navigate around that issue, in the ES5 days, people usually did something like:

```js
const isReallyNaN = value => {
  const n = isNaN(value)
  return n !== n
}
```

Thankfully, since ES6 came around, we now have a new method within the `Number` prototype that works consistently across every case:

```js
Number.isNaN('foo') // false
Number.isNaN(NaN) // true
```

Important to note, both `isNaN` and `Number.isNaN` are available, careful not to mix them up! 💥

## References

- [`isNaN` on mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN)
- [`Number.isNaN` on mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN)
AWS vs Azure vs Firebase vs Heroku vs Netlify—How To Choose the Best Platform for Web Projects
Tags: javascript, cloudcomputing, programming, softwareengineering
Published: 2020-02-12 21:35:57

---
title: AWS vs Azure vs Firebase vs Heroku vs Netlify—How To Choose the Best Platform for Web Projects
published: true
date: 2019-08-01 23:58:02 UTC
tags: javascript,cloud-computing,programming,software-engineering
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2600/1*wkeo2W7cBxJS4oQ6Esdu4g.jpeg)](https://medium.com/better-programming/aws-vs-azure-vs-firebase-vs-heroku-vs-netlify-how-to-choose-the-best-platform-for-web-projects-482d017de254?source=rss-3a534b5053e6------2)

Choosing the right platform for web projects can be challenging

[Continue reading on Better Programming »](https://medium.com/better-programming/aws-vs-azure-vs-firebase-vs-heroku-vs-netlify-how-to-choose-the-best-platform-for-web-projects-482d017de254?source=rss-3a534b5053e6------2)
Processing the Hackathon Muñón data written on the blockchain
Tags: blockchain, ethereum, buidlhonduras, muñon
Published: 2019-08-01 23:32:07

---
title: Processing the Hackathon Muñón data written on the blockchain
published: true
description: 
tags: blockchain,ethereum,buidlhonduras,muñon
---

After our [first round of Hackathones Muñón on top of ethereum](https://dev.to/turupawn/we-just-attended-to-a-decentralized-hackathon-1cae) we are now sitting in the raw data that participants added to the blockchain. So we decided to participate on a [Gitcoin bounty](https://gitcoin.co/issue/gitcoinco/skunkworks/117/2948) to process meaningful data and expose it to everyone.

Pretty exciting!

So John and I met at a café to discuss this and so far this is the data that sounds relevant to us:

#### Data useful for organizers
1. % fees payed upfront before event's date

![](https://thepracticaldev.s3.amazonaws.com/i/c4wqewc2hevd9bnopd3j.png)
_This may help us understanding when participants register and anticipate to it_

#### Data useful of people interested in participating
1. % participants cashed out more Eth than the entrance fee
2.  Participants collected X average Ether
3.  Average participant review score X
4. Top participant review score X
5. Top participant ether collected X

Note: This data above can be presented into the *All time* category or sectioned by event (we have had 2 events so far).

What do you guys think? Any comments? Otherwise, I'll start coding!

John and I at the café figuring this out:
![](https://thepracticaldev.s3.amazonaws.com/i/34o5j43yvni18tfovovu.jpg)
![](https://thepracticaldev.s3.amazonaws.com/i/ldx43kj1ajhj5bxjhsy2.jpg)
![](https://thepracticaldev.s3.amazonaws.com/i/keaqptma4y1bkkawoyq0.jpg)
UIKit - SwiftUI Cheat Sheet 📱
Tags: thetealpickle, ios, swiftui, resource
Published: 2019-08-01 23:10:47

---
title: UIKit - SwiftUI Cheat Sheet 📱
published: true
description: A cheat sheet for UIKit elements to SwiftUI
tags: #thetealpickle #ios #swiftui #resource
---

SwiftUI WAVEEE 🌊 I made a cheat sheet!! 💻 💻 

<img src="https://thepracticaldev.s3.amazonaws.com/i/oeglqthisibp2l954vh9.PNG" />
What do you use for testing c/c++ apps?
Tags: help, c, cpp
Published: 2019-08-01 23:00:53

---
title: What do you use for testing c/c++ apps?
published: true
tags: help,c, cpp
---

Hello there!

I'm starting a new learning journey about quality assurance of C/C++ applications.
What framework do you use for testing c/c++ applications? Why?

Thanks in advance, community :)
One command deploy with GitHub Pages
Tags: tutorial, githubpages, productivity, jekyll
Published: 2019-08-03 10:14:29

---
title: One command deploy with GitHub Pages
published: true
canonical_url: https://nervewax.com/one-command-deploy-with-github-pages/
description: Deploy a non-standard static site with GitHub pages using a single command.
tags: tutorial, githubpages, productivity, jekyll
cover_image: https://thepracticaldev.s3.amazonaws.com/i/v8ylxe6x8rtqaw0psbtm.jpg
---

<small><em>Cover image by the magnificent <a href="https://andreewallin.com/">Andre Wallin</a></em></small>

One of the caveats of [GitHub Pages](https://pages.github.com/) is that it won’t automatically build your site if you’re not using the GitHub Pages Jekyll gem. On top of this, you can’t use any Jekyll plugins that aren’t [supported by GitHub Pages](https://pages.github.com/versions/).

That being said, GitHub will deploy _compiled_ code for you, either from the `/docs` folder, a `gh-pages` branch or from the `master` branch. [[ref]](https://help.github.com/en/articles/configuring-a-publishing-source-for-github-pages)

The solution I’m using right now means still I’m able to run my build process locally and auto-deploy with a single command.

So for this to work, I’ve set up two branches for my site:

- `master` contains my Jekyll compiled `_site/` folder, which GitHub will deploy each time it’s pushed. 
  - `.nojekyll` should be added to this branch so GitHub doesn’t attempt to compile it.
- `sources` contains the full repo, with the Jekyll source files. 
  - This method could work with any static site generator.
  - `_site/` should be added to the .gitignore on this branch, so you don’t commit the changes in there.

I’ve written a simple [npm shell script](https://nervewax.com/npm-scripts-compiler/) that runs with `npm deploy`, which is essentially an alias for the following string of commands:

```
bundle exec jekyll build &&
cd _site/ &&
git add . &&
timestamp=$(date \"+%s\") &&
git commit -m \"automated deployment $timestamp\" &&
git push origin master &&
cd ..
```

Each time I want to deploy:

1. The `jekyll build` command compiles and builds my static site inside the `_site/` folder.
2. We then change directories to `_site/`, which has a .git config, set to the `master` branch of the repo.
3. The script then commits all changes (+ timestamp), pushes master and returns to my source folder.

That’s it! So now, once I’ve made changes to my site or content, I can still have my site built and deployed with a single command.

### Further reading

[Moving from Ghost CMS to Jekyll](https://nervewax.com/ghost-to-jekyll/)
[GitHub Pages Basics](https://help.github.com/en/categories/github-pages-basics)
[Official Jekyll Docs](https://jekyllrb.com/docs/)