teleren/devto huggingface dataset:
Arrow Functions + This keyword
Tags: javascript, codenewbie, beginners
Published: 2018-11-14 18:53:19

---
title: Arrow Functions + This keyword
published: true
description: 
tags: javascript, codenewbie, beginners
---

Technical blog post number trois, coming at ya!

At the end of my last post about arrow functions, I briefly teased that the arrow function has a special relationship with the JavaScript keyword, *this*. There's so much to learn about *this* (Google spit out over 309,000 hits on the topic!), but here is what I've learned so far about it in regards to the lovely *fat arrow*. 

(Sidenote: As evidenced by some mildly-heated debate in my last post's discussion section, the arrow function goes by many names! I even just saw it referred to as the *hash rocket*, which is a term dubbed by Ruby enthusiasts. And I've gotta say, that may be my favorite term dubbed by anyone for anything.)

From what I've seen, *this* has as almost many haters as it has super fans. It can be confusing and seemingly unreliable to use in all classic function expressions because *this* relies on the **context** of its environment in which its called, e.g., if *this* lies within a function within a method, *this* will refer to the global scope and not the method.  

Enter... THE ARROW FUNCTION!

As you can see in my example code below, *this* unfortunately does not work the way I intend it. The alerts that pop up show "loves to bite", "loves to scratch", and "loves to destroy" without including the cat's awesome name, Dragon. *This* fails to refer to the object but refers to the global scope since it is within a function. I've seen this failure referred to as a "JavaScript quirk," which can be considered an understatement by some. :) 

```
//Trying to use 'this' without an arrow function

let cat = {
  name: 'Dragon',
  favThings: ['bite', 'scratch', 'destroy'],
  showFavThings: function() {
    this.favThings.forEach(function(fav) {
      alert(this.name + " loves to " + fav + "!");
    });
  }
};

cat.showFavThings();
//output does not include cat name, boooo!
```
But our friend, The Arrow Function (which was developed for JavaScript ES6 in part due to the aforementioned "quirk"), comes to the rescue here because *this* is lexically-bound to arrow functions, meaning that *this* will refer to whatever code the arrow function is in before it.
```
//this with arrow function

let cat = {
  name: 'Dragon',
  favThings: ['bite', 'scratch', 'destroy'],
  showFavThings () {
    this.favThings.forEach((fav) => {
      alert(this.name + " loves to " + fav + "!");
    });
  }
};

cat.showFavThings();
//Dragon loves to bite!
//Dragon loves to scratch!
//Dragon loves to destroy!
```
Good job, Dragon! You do you!

![Toothless applauds](https://vignette.wikia.nocookie.net/howtotrainyourdragon/images/6/69/Toothless_ecstatic_claps.gif/revision/latest?cb=20160224034457)

As a novice coder, I'm still learning how to best use Arrow Functions as not all situations call for them. **But what about you? Why do you like or dislike this method?**
need help with c++ calculator
Tags: help, cpp, homework
Published: 2018-11-14 18:28:46

---
title: need help with c++ calculator
published: true
description: homework
tags: #help, #cpp, homework
---

So I am taking a c++ course and I am on my third assignment. The first was a simple calculator, get 2 numbers and then Display the results for added, subtracted, divided and multiplied. The second one was a simple game that measured the time it took to press a key after the game said go. Now they've turned it up several notches and I'm doing a full blown calculator without the GUI, and I'm stuck. I don't even know where to start. The user must be able to add, subtract, multiply and divide as many times as he/she/it wants then get the result of be able to clear and start over. Now as far as pseudo code goes I've gotten so far as : Get user input number 1, operator, number 2, sum, put sum into vector, show sum and get next input, sum, put into vector loop this until user either decides to clear or wants the sum. An I totally wrong here? Now I don't want all the code written for me, I mean I want to learn this I just want a nudge in the right way of thinking 😊
Hundreds of devs are live-streaming simultaneously this Saturday 😱
Tags: startup, livecoding
Published: 2018-11-14 18:02:32

If you're a software developer with an interest in entrepreneurship and startups, you may want to check out [The 24 Hour Startup Challenge](https://24hrstartup.com/), which is live-streaming on Saturday. I know some of the folks behind it and they're good people. We even tossed in a bit of DEV swag as prizes to help out.

You _may_ want to partake, but likely it could be an interesting opportunity to learn from those opening up the process to the world.

I'm personally quite intrigued by this. I myself am a startup founder. I've taken a distinctly different approach which involved lots of time and tinkering, rather than a plunge. But the plunge is an interesting approach and I plan on tuning in to see what folks are up to.

Does startup culture care too much about launches and not sustained growth? Probably. Is a 24 hour challenge the healthiest way to build software? Probably not. But it sure sounds like a fun and unique event.

I'm leaning towards _maybe_ taking part in some capacity myself.
education WordPress theme
Tags: wordpress, themes, templates, website
Published: 2018-11-14 18:01:10

---
title: education WordPress theme
published: True
description: Education is one of the vital element in everyone’s lives. We can say education is necessary to become successful in life. In this digital realm where everything is online, people are also preferring online education. If you are an owner of an institution, school or college then you also by building an online presence can attract more students. This way they can get high-quality education and will be aware of your presence as well. You need not tinker about designing a website as WordPress is now available with a lot of themes. By exerting [education WordPress theme](https://gracethemes.com/themes/education-wordpress-theme/) you can design splendid education website.

tags: WordPress, themes, templates, website
---
Syntax vs Semantics
Tags: programming
Published: 2018-11-14 17:51:20

---
title: Syntax vs Semantics
published: true
description: 
tags: programming
---

We have often come across this problem. Right?

Well not quite. We choose to ignore them most of the time. But what the hell does this even mean.

Aren't they both the same?

Well ... Not quite. Let's understand why.

<b>Syntax:</b> A syntax tells you what you can write. 
<b>Semantics:</b> A semantics tells you what the hell you wrote.

Ha Ha!

For eg.

Value1 + Value2 gives a Value3 in programming. We all know that.

Now this "ValueX" can be a variable, can a constant or maybe something else too.

So,

1 + 2 gives 3. Right? YES!
"Hello" + "World" gives "HelloWorld". Right? YES!
1 + "Hello" gives ??? 

<b>Exactly ... this is semantics.</b>

You can right 1 + "Hello". This is "syntactically" correct coz you have two values and an operator in between. 

But what the hell does it mean? That is what "semantically" means.

<i>Phew!</i>
What is so cool about JSX?
Tags: react, jsx
Published: 2018-11-14 17:34:40

---
title: What is so cool about JSX?
published: true
description: 
tags: react, jsx
---

JSX or Javascript XML. The thing I noticed best about JSX is that you can write JSX inside JavaScript and you don't need to append HTML elements using quotes(") or concatenate(+) them. 

For any kind of values to be written within them you can simply use expressions{}.

Pretty damn cool!
Are podcasts part of your learning as a developer?
Tags: opensource, discuss, beginners
Published: 2018-11-14 17:27:12

---
title: Are podcasts part of your learning as a developer?
published: true
description: Do you love listening to podcasts as a software developer?
tags: #opensource #discuss #beginners
---

I love listening to podcasts. They are a very important part of my learning as a software developer. 

Personally, I consume them mainly in the following ways:

- To have a broader knowledge of new concepts I am learning. 
- Revising a particular concept or technology in a short time.
- To hear about experiences of senior developers in the community.

I am curious if you listen to podcasts then in what different ways do you utilise them?

In the meantime, if you want to listen to some interesting development podcasts then check out my [curated list](https://github.com/vjs3/awesome-podcast-episodes) of podcast episodes on various software development topics on GitHub.
LaravelのHTTPテストでoutput buffersが閉じられていないエラー
Tags: php, laravel, phpunit
Published: 2018-11-14 11:29:16

---
title: LaravelのHTTPテストでoutput buffersが閉じられていないエラー
published: true
description: 
tags: php,laravel,phpunit
canonical_url: https://crieit.net/posts/Laravel-HTTP-output-buffers
---

Laravelのテストでいつの間にかRiskyテストが出るようになっていた。失敗ではないのでCIでも何も言われなかったようで、実行時にもエラーが発生していなかったので気づかずにいたらしい。

具体的には下記のようなエラー。

``` shell
Test code or tested code did not (only) close its own output buffers  
```

結論としては、下記のようなテンプレートの書き方をしていたために正常にレスポンスが返っていなかったらしい。

```
@section('additionallTag', $data->tag)  
```

これは特に記述自体は問題ないと思うが、変数の中に入っているのがHTMLタグだったため今回のエラーが発生しているっぽい。そのため下記のように修正したところ改善した。

```
@section('additionalTag')  
{!! $data->tag !!}  
@endsection  
```

同じエラーの改善方法を解説している記事も見つけた。

[LaravelのHTTPテストでなぜかresponseが返ってこない件](https://qiita.com/t_k_m_s_otya/items/6e973f90c09df40f2224)

この場合はsectionが閉じられていないためとのことだが、今回のように変数の指定によってはうまく閉じられなくなってしまうということっぽい。
What the hell is type-safe language?
Tags: programming
Published: 2018-11-14 17:24:10

---
title: What the hell is type-safe language?
published: true
description: 
tags: programming
---

Consider you are a compiler. Now suppose you are a person who doesn't care about your fellow programmers who are writing code and using you to get them compiled. Like for example:

Someone is assigning an integer(4 bytes) into a char(1 byte) variable.

If you are not careful, that assignment will take away the adjacent 3 bytes away. Poof!.

This is type-unsafe. That is the compiler or YOU are not taking care of such validations before compiling them.

Again this can be at two levels:

1. <b>Static typing</b> - one which is done at compilation time.
2. <b>Dynamic typing</b> - one which is done at run-time. This is when you get all those run-time exceptions.


Be type-Safe!
Progressive Service Architecture At Auth0
Tags: sre, architecture, sitereliability
Published: 2018-11-14 17:18:05

---
title: Progressive Service Architecture At Auth0
published: true
description: Learn how to build a mature service architecture for high availability by creating its topology progressively.
tags: #sre #architecture #sitereliability
canonical_url: https://auth0.com/blog/progressive-service-architecture-at-auth0/
---

In this blog post, we are going to discuss how the Auth0 Site Reliability team, led by Hernán Meydac Jean, used a progressive approach to build a mature service architecture characterized by high availability and reliability.

At Auth0, we manage different features for our clients. We use feature flags to enable features into codebases without breaking anything or having to change the code. As defined by Pete Hodgson, feature flags, or feature toggles, are a flexible and powerful technique that allow developers to modify the behavior of a system without changing its code. A feature flag lets a development team turn features on and off in the system even after it is live in production.

[Read on 🏛](https://auth0.com/blog/progressive-service-architecture-at-auth0/?utm_source=dev&utm_medium=sc&utm_campaign=aueng_psa)

![Progressive Service Architecture At Auth0](https://thepracticaldev.s3.amazonaws.com/i/8125biu0z8ig8j59wuvd.png)
create-react-app not working in cmd
Tags: npm, react
Published: 2018-11-14 17:06:52

---
title: create-react-app not working in cmd
published: true
description: 
tags: npm, react
---

Since the version 5.2 of npm we can use npx also. 
If somehow you get an error like "command not recognized or something of that sort", use 

<b>npx create-react-app --your_app_name-- </b> for installing a react app.


Use <b>npm -v</b> on the command line to know your npm version. :D
Learning ReactJs
Tags: react
Published: 2018-11-14 16:54:30

---
title: Learning ReactJs
published: true
description: 
tags: ReactJs
---

Ok after fighting a lot with myself, I have decided to learn ReactJs. 

So here is how I study something new. 

1. I download some videos from some of my favourite online teachers. 
2. I open the official website of the technology for their documentation. 
3. And last but not least, I get a small pdf of the theoretical aspects of the technology, including its history. 

4. Once that is done, I alternate between these things. It's best to read or go through all of them. This solidifies the knowledge and fills up the gaps if you come across doubts.

With all that done, I am starting this new venture and shall update what I understand and if I understand.
Changelog: Post Analytics Available for All
Tags: meta, changelog
Published: 2018-11-14 16:14:28

Just yesterday I made this post:

{% link https://dev.to/devteam/analytics-will-be-generally-available-soon-5hg6 %}

By soon, I figured this would ship in a week or two. Turns out things went pretty smoothly and analytics are actually available right now.

Your own totals may not show up immediately, but they should tally up shortly. Let us know if anything seems totally out of whack if you give it some time and things still seem off. We'd love to hear from you if this seems faulty in any way.

The only analytic we're providing right now is a simple view count. We will explore options for getting more granular in the future.

The cover image is from my own dashboard. I seem to be pretty popular around these parts.
Most Popular Development Posts Of The Week (14 November 2018)
Tags: git, typescript, css, javascript
Published: 2018-11-15 14:11:37

---
title: Most Popular Development Posts Of The Week (14 November 2018)
published: true
tags: git,typescript,css,javascript
canonical_url: https://medium.com/daily-now/most-popular-development-posts-of-the-week-14-november-2018-25132a292fd6
cover_image: https://cdn-images-1.medium.com/max/1024/1*iW1EdCZWqsXiI4rsbjnJcQ.jpeg
---

<figcaption>Timing, perseverance, and ten years of trying will eventually make you look like an overnight success</figcaption>

- [10 Interesting JavaScript and CSS libraries for November 2018](https://app.dailynow.co/r/57450780318beb9a90c1ac50506fa6a1)
- [Gitote is out now!](https://app.dailynow.co/r/5303a3ceba0864f9acd8b18f35faa923)
- [You’re not a junior developer any more](https://app.dailynow.co/r/8dfe622996717822eb5b268606c29bfa) by [Brenn](https://medium.com/u/b29abf345025)
- [4 Free Resources for being an amazing javascript developer](https://app.dailynow.co/r/863ca192881a3863feabf5e5fe113575) by [Brenn](https://medium.com/u/b29abf345025)
- [6 Traits to Become a Better Developer](https://app.dailynow.co/r/34e8d92d7c4741d6a24782610d15e0d9) by [Bhavani Ravi](https://medium.com/u/74e6436117a8)
- [The rapid web development toolkit](https://app.dailynow.co/r/5fece0f7684bc450942c6a38fb50226c) by [Brenn](https://medium.com/u/b29abf345025)
- [Why I wrote 33 VSCode extensions and how I manage them](https://app.dailynow.co/r/1a682926ef92e982ffe3a8ccc6d72267) by [Fabio Spampinato](https://medium.com/u/dfaca860b6b3)
- [Designing a progressive web app](https://app.dailynow.co/r/9ae88aed70db56aafc5127d7b8f8316b) by [Mustafa Kurtuldu](https://medium.com/u/ae3ba7c2904f)
- [The Three Stages of a Developer](https://app.dailynow.co/r/a14cea745f401f8d110d4d75aca0e3f1)
- [TypeScript Cheat Sheet](https://app.dailynow.co/r/8b91f0d5e7dade176096cecad79966f4)

* * *

[_Thanks to Daily_](https://www.dailynow.co/) _developers can focus on code instead of searching for news. Get immediate access to all these posts and much more just by opening a new tab._

![](https://cdn-images-1.medium.com/max/1024/1*m8Uf-6F4Q5AOp_wW6tbKSQ.jpeg)
Bad code isn't shameful
Tags: beginners, programming
Published: 2018-11-14 12:03:37

---
title: Bad code isn't shameful
published: true
tags: 
    - beginners
    - programming
canonical_url: https://carlanderson.xyz/bad-code-isnt-shameful/
---

Let's be honest. We all write bad code.

Sometimes, we write absolutely _shocking_ code.

In the programming community, we have an obsession with "good" code – and it's not difficult to see why. Good code is objectively better than bad code. It's faster, cleaner, more maintainable – Why would you settle for anything less?

**Because we can't always write good code** – Sometimes there isn't time. Sometimes there's legacy code. Sometimes the code was good when we wrote it, but the requirements changed.

Sometimes we just don't know how

Good code is an ideal – something we should all aspire to, but bad code is a part of life. Writing bad code _isn't shameful_. Writing bad code doesn't make you a bad developer.

The only thing that's shameful is never trying to write good code at all.
★ A better way to register routes in Laravel
Tags: laravel, php
Published: 2020-01-02 23:07:40

---
title: ★ A better way to register routes in Laravel
published: true
date: 2018-11-14 11:00:00 UTC
tags: laravel, php
canonical_url: https://freek.dev/1210-a-better-way-to-register-routes-in-laravel
---

Let's take a look at how you can define routes to controllers in Laravel. By default you can do it like this:

```php
Route::get('my-route', 'MyController@index');
```

This will look for the `MyController` class in the `App\Http\Controllers` namespace. This default namespace is [set up](https://github.com/laravel/laravel/blob/dc3e768d4cb3c77056da6076f0e725327aa85ad1/app/Providers/RouteServiceProvider.php#L17) in Laravel's RouteServiceProvider.

This was fine for a long time, but [in modern Laravel apps](https://github.com/laravel/framework/pull/24385) (thanks for that PR, Jaanus Vapper) there's a cool new way to register routes. You can define them using a tuple. Let's see how that looks like:

```php
Route::get('my-route', [\App\Http\Controllers\MyController::class, 'index']);
```

You can make it shorter by importing the namespace:

```php
use App\Http\Controllers\MyController;

Route::get('my-route', [MyController::class, 'index']);
```

In a real-world route file You might end up with lots of `use` statements, but a good IDE will just hide all of them.

In order to make tuple notation work you'll need to remove [this `namespace` call](https://github.com/laravel/laravel/blob/dc3e768d4cb3c77056da6076f0e725327aa85ad1/app/Providers/RouteServiceProvider.php#L55) in the `RouteServiceProvider` so Laravel won't prefix `\App\Http\Controllers` to an already fully qualified controller class name.

Compared to using strings, defining a route using a tuple has two benefits:

1. If you're using an IDE like PhpStorm you can now just click through the controller class name in your route files to go to the right controller.
2. When refactoring the name or namespace of the controller the class names in your route file will change too.

You can use tuple notation when redirection using the `action` method too.

```php
namespace App\Http\Controllers;

class MyController
{
    public function myMethod()
    {
        // do some work...

        return redirect->action([MyOtherController::class, 'index']);
    }
}
```

If you're using [an invokable](https://freek.dev/calling-an-invokable-in-an-instance-variable) controller, you can define a route like this

```php
use App\Http\Controllers\MyController;

Route::get('my-route', MyController::class);
```

At [Spatie](https://spatie.be) we're now using this tuple notation in all our current projects. I've also updated my blog to use them, here's [the relevant commit](https://github.com/spatie/murze.be/commit/1da2a4f493074fb1a1606d181d90e57243905e19).

In my opinion, tuple based routes should become the default in a future version of Laravel. There are only benefits and there's less magic involved (no need to prefix a string behind the scenes).

Do you like this notation? Let me know in the comments below.
Why Python is called "Python"?
Tags: funfact, python
Published: 2018-11-14 10:24:03

---
title: Why Python is called "Python"?
published: true
description: The reason why programming language Python is called Python
tags: funfact, python
---
Did you ever wonder why the programming language Python is called "Python"?
<a title="Daniel Stroud [CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0)], via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:Guido-portrait-2014-curvves.jpg"><img width="512" alt="Guido-portrait-2014-curvves" src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Guido-portrait-2014-curvves.jpg/512px-Guido-portrait-2014-curvves.jpg"></a>

>[Guido van Rossum](https://en.wikipedia.org/wiki/Guido_van_Rossum), the author of Python Programming Language was reading the published scripts from **“[Monty Python’s Flying Circus](https://en.wikipedia.org/wiki/Monty_Python%27s_Flying_Circus)”**, a BBC comedy series from the 1970s. Van Rossum thought he needed a name that was short, unique, and slightly mysterious, so he decided to call the language **Python**.
In the [faq](https://docs.python.org/3/faq/general.html#why-is-it-called-python), he continued saying that there is no compulsion to love Monty Python to use the Python programming language and the love can be mutually exclusive.


Source:[General Python FAQ](https://docs.python.org/3/faq/general.html#why-is-it-called-python)
What are some great blogs to contribute to / collaborate with for webdevs?
Tags: discuss, webdev
Published: 2018-11-14 09:58:36

---
title: What are some great blogs to contribute to / collaborate with for webdevs?
published: true
description: Lets discuss opportunities for webdev bloggers.
tags: discuss, webdev
---

Recently collaborations and contributions to and with blogs have motivated me a great deal to pick up my blogging game. I wrote an article for Contentful about [API first CMS](https://www.contentful.com/blog/2018/05/02/how-i-fell-in-love-with-an-api-first-cms/), produced a piece for Netlights make it new about [polling in RxJS](https://makeitnew.io/polling-using-rxjs-8347d05e9104) and then some.

Now I am on the look out for more collaboration / contribution programs out there on webdev related blogs, so my question to you today is:

> # Which webdev related blogs out there are looking for contributors?

If you worked with / for a blog, feel free to share you experience.
If you are looking for contributors to your blog, this is your time to advertise.
If you are searching for more places to post as well, this is your opportunity to get inspired.
What was the first code you ever wrote? 
Tags: discuss, webdev, career, programming
Published: 2018-11-14 09:56:27

---
title: What was the first code you ever wrote? 
published: true
description: 
tags: discuss,webdev,career,programming
---
I bet many of us have started with some silly codes, i just feel curious about other people's experience, so what was your first lines of code/script/application?