teleren/devto huggingface dataset:
LEARN TO CODE LIKE A HERO
Tags: dev, beginners, javascript
Published: 2019-11-02 22:18:38

I'm a self taught developer and I was able to learn JavaScript and Python on the internet without taking any paid courses. So how did it all start?
I completed high school with ambitions to learn coding, so I jumped on the internet and downloaded a few books on Python and started reading. Although the books gave me the basic commands and meanings, I don't know how to use them to build anything that was worth it except for the usual"print('Hello World')". So I stopped learning how to code and got into blogging where I created my first website using WordPress. After some time I realise I wanted to do something more, that's when I contacted @JNYBRG on Twitter and asked him to build a streaming platform for me. He gave me an open sourced project he worked on and told me to tweak it to my liking, but I don't have any coding skills. I told him and he introduced me to JavaScript and web development. From here my life as a developer took off and never went back. 
I went on YouTube and watched lots of videos and my thanks to Travesly Media, Design Course and Dev Ed.
I watched Dev Ed create a Weather App and I code as he goes and after that 40 minutes video I understood how to bring lines of code together to build something cool and it turned out that's all I needed to boost my coding skills.

SO WHAT DID I LEARNED ABOUT "LEARNING TO CODE" FROM THIS EXPERIENCE?
1. Learn the basics, understand what each line of code does.
Read on it and see how other developers use them in their codes.

2. Learn how to use them together to produce cool results.

3. Start a project. Start building a real app and learn new things as you do it. Use Google and StackOverflow to get answers to any problems you encounter.

4. Join the Dev Community.
Create a Twitter and Github account and start talking about tech/code and start contributing the little you know to open source projects.

I hope this article help encourage you in learning how to code and help you be more proficient in it. 

Since this is my first article, I'll be glad to read your remarks in the comments.
WHY YOU CAN'T BE A PROGRAMMER 
Published: 2019-11-02 21:52:05

Let me be clear here: most developers don't know a s**t about how to learn programming and improve their careers. This is absolute truth.

And I'm not saying this in a mean way, but as a way to alert most of you about something you've been doing wrong for most of your lives. Learning something new requires some strictly techniques in order to maximize your potentials, or, you'll be swimming in circles and you'll most likely to die in the middle of the sea.

Just take today's case: a guy that has completed a programming course but know nothing about what they've learned. It just feels like he hasn't completed any course at all.

Learning the art of programming can be a bit of a struggle for some. However, knowing some ways for making your learning process faster can be a huge help for you. It can be a manageable task if you follow and implement a few simple steps.
Hacktoberfest - What a great idea!
Tags: hacktoberfest, opensource
Published: 2019-11-02 21:32:56

While I enjoyed my first involvement with [Hacktoberfest](https://hacktoberfest.digitalocean.com/) this year, I didn't end up completing enough pull request for the month. Partly this was due to a busy workload for the 9-5 job, but also I found that I wanted to find projects I could stay involved with. 

[Hacktoberfest](https://hacktoberfest.digitalocean.com/) did its job and got me more involved, more interested in contributing to open source projects on GiHub.  I'd already done a first step back in Dec 18 on [ollelauribostrom/rebus](https://github.com/ollelauribostrom/rebus) which is a great repository for your first attempt at a pull request. So I was ready to find some more projects I could help with.

To begin with I tried to just find anything that would get me across the line, but the fist project was really just an open repository to submit any code to help get 4 pull requests.  Not really what's intended, and a few of these were (rightly) getting excluded from the competition.

The second one was valid, and gave me a better feeling of accomplishment when submitting the pull request, but that also made me more focussed on finding something that I could not only help with, but that I could have some continued interest in.

I know that in a lot of projects any help is appreciated, and that full support of the whole project is not really required, as long as you can help solve the issue, add the feature.....  But I think I spent most of my time searching for that elusive project. One that was not only looking for help but was something that would be longer term than just one pull request.

I'm thinking the only way to find these projects is time, getting involved in open source by helping any project you can, and somewhere along the way one will appear that really takes your focus.  Or perhaps, over time, a project you contribute to will become something more to you.

[Hacktoberfest](https://hacktoberfest.digitalocean.com/) is a great idea. It got me contributing, and keen to try again next year, but I hope to keep its intent rolling through the year.

My thanks to [DigitalOcean](https://www.digitalocean.com/) and [DEV](https://dev.to/) for the incentive.
Why you should never map(parseInt)
Tags: javascript, bug, mistake, parseint
Published: 2019-11-02 21:11:27

I've just caught this simple bug in a code I'm building right on the browser's editor (simple things, no typechecking) and now I remember it's not the first time I've learned this the hard way.

```javascript
const someStringMaybe = ['08', '10']
const myInts = someStringMaybe.map(parseInt)
```

That looks neat and simple, but there's an underlying problem that may take you a couple of minutes to get it, specially if it has been a long time since you've dealt with `parseInt` and numbers stuff with Javascript.

Of course, you probably will chain that array with other operations and, in the end, realize it's broken. Than you realize the reason:

```
-> myInts
[8, Nan]
```

If you're familiar with `parseInt` you will know that `parseInt('10') === 10`, but, what happened?

By now, an experienced JS programmer should've realized what went wrong, but this could be a real pain for beginners. Yes, `parseInt` works fine converting string-numbers to numbers but it actually **supports base conversion**, and it receives **a second parameter**, as you can see in the [docs](https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/parseInt).

The problems happens because `Array.map` will always **pass 3 arguments**: the current value, the index, and the original array. When a function only accepts one argument, the other two are "discarded".

```javascript
-> someStringMaybe.map(console.log)
   '08' 0 ["08", "10"]
   '10' 1 ["08", "10"]
```

When you `map(parseInt)` directly, the `index` will be interpreted as the `base` and wild math-things will happen.

**The solution:**
```javascript
const myInts = someStringMaybe.map(str => parseInt(str, 10))
```
_(it works without the `10`, but it's recommended to always make the `base` clear for future readers, and also preventing the original problem.)_
Highlights from the Aurelia vNext 2019 fall update
Tags: aurelia, frontend, framework, javascript
Published: 2019-11-02 21:09:31

[There was a recent blog post with the status of Aurelia vNext](https://aurelia.io/blog/2019/10/31/aurelia-vnext-2019-fall-update/). For those of you that don't know, Aurelia is a front-end framework with a focus on standards, extensibility, ease of use and performance. It's been a while since a new major release, so vNext is a pretty big deal.

These are some highlights of what I found pretty cool in the latest update:

* Official name: **Aurelia 2**
* [VSCode integration](https://github.com/aurelia/vscode-extension/pull/104) with direct linking between bindables, observables, views, and custom attributes to their backing code representation
* VanillaJS-like performance with JIT (Just in time) optimisations, and  new AOT (Ahead of Time) optimisations 
* [Extensibility](https://aurelia.io/blog/2019/10/31/aurelia-vnext-2019-fall-update/#extensibility) that allows you to emulate the syntax of other frameworks, like Angular / Vue etc
* A continuous focus on [Web Standards](https://aurelia.io/blog/2019/10/31/aurelia-vnext-2019-fall-update/#web-standards)
* Developer Experience has received som pretty considerable features, here are the ones I'm excited about
  * More lifecycle hooks, and they are now synchronous. (no more queueMicroTask!)
  * New Router 🙌
  * Functional API's
* Multiple Integration scenarios that allow nesting of frameworks, and connecting other libraries directly in the underlying pipeline and more
* Extensive Test Tooling support, helpers and libraries.

The team is focused on keeping the migration path straight forward, though they have mentioned there'll be a few breaking changes. 

A lot of these improvements are raising the bar so high that we're bound to see more developers discover the joys of using Aurelia, as well as making that transition a lot easier for them with extensibility points.

I'm pretty excited about the future of Aurelia 2, but doubt I'll be getting my hands dirty just yet. Looking forward to a preview/release candidate before I start testing it out, and more of the WIP features are in place.
How to Create User Sign Up, Sign in, Logout in Django 2.2

Tags: django, sql, dangosignin
Published: 2019-11-02 20:59:48

In this tutorial, I will cover how to create Django user sign up/registration, login, logout. Usually, I have done it from scratch. You can checkout.

For the examples, I will use an empty Django project named college. Inside the college folder, I created an app student core. So every time you see college and/or core, change to the suitable project name and app name.

Basic Sign Up

The most simple way to implement a user sign up is by using the normal as it is. This strategy is suitable in case you are using the default Django user, using the username to authenticate and is interested only in setting the username and password upon sign up.

Read Full Article: https://realprogrammer.in/how-to-create-user-sign-up-signin-logout-in-django-2-2/
Watch Youtube Video: https://www.youtube.com/watch?v=s6pzYFPcDuQ&feature=youtu.be
The most neglected yet vital step of the coding process
Tags: productivity, beginners, codesearch
Published: 2019-11-02 20:46:47

It's hard to find an existing library or code sample and so we end up spending too much time looking and/or reinventing the wheel. I wrote an article with tips on how to quickly get to the good stuff: 
[Finding sample code](https://medium.com/@jeff.ferber/finding-sample-code-5e49df76f0df) (free / not behind Medium's paywall)

The article is admittedly on the dry side but I think the topic is one of the most neglected yet vital steps of the coding process.

Even if you don't find a library that you can use directly, skimming a relevant example for inspiration before starting your own programming task is fantastically productive. I used the technique in a [recent side project](https://github.com/ferbs/webstack-micro) (microservices for small teams), skimming samples before starting each task. It's hard to quantify the boost (2X?) but I don't think I would have finished the project without this technique.
Testing tokens
Published: 2020-08-17 15:11:25

---
title: Testing tokens
published: false
date: 2019-11-02 20:44:03 UTC
tags: 
canonical_url: https://tomandrews.co.uk/blog/2019-11-02-testing-tokens/
published: true
---

I’ve recently started working on a new project that makes heavy use of [JWT](https://jwt.io/). Thishas meant that I’ve been wrirting a decent number of tests to ensure that the token contains thecorrect contents and will expire at the correct time. A lot of the tests started looking like this.

```
const { iat: _iat, exp, ...contents } = jwt.decode(token)
expect(contents).toMatchObject(expectedContents)
expect(exp).toEqual(Math.floor(Date.now() / 1000) + 60 * 60)
```

As you can see this is very verbose and hides the intention of the test. It would be great if we could write a much cleaner test. Like this

```
expect(token).toBeTokenContaining(expectedContents)
expect(token).toBeTokenExpiringIn("1h")
```

As we using [Jest](https://jestjs.io) there is a way of [extending](https://jestjs.io/docs/en/expect#expectextendmatchers) it to add ourown matchers. So I created a new npm package that adds a couple of custom assertions for working with JWT. It is called [jest-expect-jwt](https://www.npmjs.com/package/jest-expect-jwt)

This was an overall great experience in extending jest by following the docs. The only complexity came from the integration with typescript and ensuring that the types for the new assertions were detected. When using it in a test it would execute successfully but would show an error in vscode.

```
Property 'toBeTokenContaining' does not exist on type 'JestMatchersShape<Matchers<void, string>, Matchers<Promise<void>, string>>'.ts(2339)
```

I eventually found a solution by reading the docs for [jest-extended](https://github.com/jest-community/jest-extended#typescript) and it should that you need to import the types into a `global.d.ts`.

But either way it will nice writing better tests. And you can too [jest-expect-jwt](https://www.npmjs.com/package/jest-expect-jwt)
What I learned in Coding Bootcamp is...
Published: 2019-11-02 20:26:08

I am almost done with my General Assembly SEI Program and can't believe how much has changed the last two months. So many new and exciting doors have opened in my life and I am thrilled to have been a part of such a great cohort. I have learned a whole new way of thinking and have excelled at breaking down problems I come across. I learned how to learn a whole new language and build an app within three weeks. Paired programming has become a favorite solution to tough projects. But one of the main things I learned, is that there is so much more to learn.
 
Throughout this experience I have seen myself grow in ways I didn't know I could. I have always been interested in learning new things, and programming has been such an inspiring journey. I have found a new passion for front end languages like JavaScript and CSS. React has been a nice addition and would like to tackle Angular after the cohort. I am excited to start my job search as I have already found a few companies I would love to work for that I am finally qualified for.
 
I have increased my problem-solving ability 10 times over not only in programming but in my day to day life. I have taken on a whole new way of thinking and looking at issues. Not to mention I see code in everything nowadays. This is great I have never really immersed myself if something like software development before but I am so glad I did. I can't wait to show everyone my capstone project!
Getting the grid (CSS)
Tags: ctrlshiftcodeschool
Published: 2019-11-02 20:20:57

One of the things I’ve heard a number of people refer to when preparing to create a website is the “whiteboard plan”.  The idea is that before you sit down to start working your code, you need to have a vision of what the end product will look like.  This of course makes sense, but when you’re only a month in, its hard to understand where you’re going to go after the whiteboard.

This week however, things started clicking.  You see, this week I learned about the grid.  Picture your monitor (that you’re probably staring at if you’re reading this on a computer) with 12 columns slightly spaced across the width of the screen.  This is how a lot of information can be enticingly organized to create enjoyable experiences for your user.  Do you know they used to use multiple windows on one screen (really!  They even had separate URLs and they had to be coordinated).  This made things a bit clunky and slow.

In the past, trying to accomplish something similar required setting up HTML tables.  Not the best but it got the job of positioning done.   However trying to go from design to final product was a pain and the code could be fragile.  One of my favorite quotes while reading from the website https://blog.froont.com/brief-history-of-web-design-for-designers/n  “It was also the time when so many developers decided not to like front-end coding.”

Javascript and Flash saved designers briefly but quickly gave way to CSS.  While the Cascading style sheets reigned supreme in the design world (keeping a separate declarative sheet to the code, that described the code, helped to solve a lot of problems and is still in strong use today) for a solid decade.  It eventually shared its time on the stage with the grid system.

  The grid system allowed for  one simple layout that could be used over and over again to produce the huge variety of website design we see today.   I couldn’t help but wonder if the KISS method was here to rule the day, or if I would see this evolve in my lifetime.
Scanning user input and looking for keywords
Tags: help, javascript
Published: 2019-11-02 20:02:45

#Original post:
I am trying to load a json file as a javascript object. I then convert the keys into their own array. I am then trying to search through a user input string to find any matches. If a match is found I then want it to then check if the value of that key is "next" and if so do one thing. If the value is not "next" I want it to do a different thing. If none of the keys match any of the words in the user input string I want it to send an error message. This last part seems to be the issue. When a user types a string without a keyword it will sometimes log the error message more than once. I have noticed that this happens especially when a new json file is loaded. [Here is a link](https://github.com/ElderINTERalliance/githubworkshop/blob/master/public/index.html#L54-L104) to where I think the issue is. I have tried just about everything I can think of but every solution seems to have the same problem so maybe I am just looking in the wrong place. If you have any questions or need more information please let me know.

#Edit:

I have an object that looks like this:
```
var object = {"keyword": "next", "other word": "wrong", "test": "wrong"}
```
it was loaded from a json file accessed from the server using the fetch API. I then have an input box that when a user enters one of the three keys of the object should echo its value on enter. If no keys are found in the string the user has input it should print out an error message. If the value of the key is "next" it should run a function called loadlevel() to load the next level. That next level is then loaded in the same way as the aforementioned one. This appears to be where I am having issues. When it loads the new json file it seems that both the previous object and the new object are still running. This causes it to print out the error message if the new input doesn't match both the new keys. See example below:

##Setup:
```
//This is the first object loaded from the json file:
var object = {"keyword": "next", "other word": "wrong", "test": "wrong"}
```

##What Should happen
When the user inputs the following strings it should have the corresponding outputs:
```
"this is the other word" => "wrong"
"hello, world" => "error"
"this is the keyword" => "next" loadlevel()
```
When the next level is loaded, say this for example:
```
var object = {"smith": "next", "hello": "wrong", "hi there": "wrong"}
```
It should then output this:
```
"this is the other word" => "error"
"hello, world" => "wrong"
"this is smith" => "next" loadlevel()
```
##What is happening
The first values seem to work fine:
```
"this is the other word" => "wrong"
"hello, world" => "error"
"this is the keyword" => "next" loadlevel()
```
When the next level is loaded, say this for example:
```
var object = {"smith": "next", "hello": "wrong", "hi there": "wrong"}
```
It then outputs this:
```
"this is the other word" => "error" "error"
"hello, world" => "wrong" "error"
"this is smith" => "next" "error" loadlevel()
```
I just don't understand async/await 😢!
Tags: javascript, async, await, help
Published: 2019-11-02 20:01:19

Hi,

I'm pretty new to coding and having a hard time understanding async/await.

My question: why is `createUserInFirestore` executing before `userExists`?

```
async googleLogin () {
      var provider = new firebase.auth.GoogleAuthProvider()
      try {
        const result = await firebase.auth().signInWithPopup(provider)
        const uid = result.user.uid
        const userExists = await this.userExists(uid)
        if (!userExists) {
          this.createUserInFirestore(uid)
        }
      } catch (error) {...}

async userExists (uid) {
      const usersRef = db.collection('users').doc(uid)

      usersRef.get()
        .then(async (docSnapshot) => {
          if (docSnapshot.exists) {
            console.log('user already exists in firestore')
            return true
          } else {
            console.log('no user in firestore')
            return false
          }
        })
    }
```

Thanks
What is the Internet of Things?
#iot,
Published: 2019-11-02 19:07:22

  The Internet of Things (IOT) is a network of networks that allows, via standardized and unified electronic identification systems and mobile wireless devices, to directly and unambiguously identify digital entities and physical objects, and thus to be able to retrieve, store, transfer, and process the related data without discontinuity between the physical and virtual worlds.
GitHub Actions - Deploy to Heroku
Tags: githubactions, heroku, github
Published: 2019-11-02 18:58:57

---
title: GitHub Actions - Deploy to Heroku
published: true
description: Deploying to Heroku using GitHub Actions, without adding any new dependencies.
tags: github actions, heroku, github
---

Here's how to deploy to Heroku using GitHub Actions. Without adding any new dependencies.

First, you need a Heroku auth token. You can generate one on your machine using the following:

```
heroku authorizations:create
```

Copy the `Token` value and add it as a secret to your repository (Go to your repository Settings -> Secrets. Name it `HEROKU_API_TOKEN`)

Next, add this to your workflow.

```yml
- name: Deploy to Heroku
  env:
    HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
    HEROKU_APP_NAME: "your-app-name-here"
  if: github.ref == 'refs/heads/master' && job.status == 'success'
  run: git push https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/master:master
```

This will only run for builds on the Master branch and if previous steps have worked properly.

Here's a full example for a Rails app. This runs your tests, and if successful, deploys to Heroku.

```yml
name: Ruby Test and Deploy
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set up Ruby
      uses: actions/setup-ruby@v1
      with:
        ruby-version: 2.6.3
    - uses: actions/cache@v1
      with:
        path: vendor/bundle
        key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
        restore-keys: |
          ${{ runner.os }}-gem-
    - name: Install Bundler
      run: |
        gem install bundler
    - name: Install Gems
      run: bundle install --path vendor/bundle --jobs 4 --retry 3
    - name: Run Tests
      run: |
        bundle exec rake test
    - name: Deploy to Heroku
      env:
        HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
        HEROKU_APP_NAME: "your-app-name-here"
      if: github.ref == 'refs/heads/master' && job.status == 'success'
      run: git push https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/master:master
```