teleren/devto huggingface dataset:
A Different Unit Test Pattern
Tags: testing, javascript, webdev, patterns
Published: 2019-09-03 16:42:14

---
title: A Different Unit Test Pattern
published: true
description: For this specific set of code, the original code could be tested by simply moving the code above into the test. But here, the point is that the pattern should never have been used.
tags: Testing, JavaScript, WebDev, Patterns
series: Front-End Testing Patterns
cover_image: https://thepracticaldev.s3.amazonaws.com/i/b8k7xtj52as21kk8bjb4.jpg
---

I will be adding this pattern to [Bad Test, Bad](https://dev.to/rfornal/bad-test-bad-1og7)

## A Unit Testing Anti-Pattern

This test is a pattern that I haven't seen before ... where the setup and initiator for the test is in a nested ***beforeEach*** and the individual ***expect***s are each within their own test.

When I first looked at this code I thought, **"this is cool."**

Then, I very quickly got an odd, queasy feeling ...

* If this pattern was so cool, why haven't I seen this pattern somewhere before?
* Why would a developer have created this pattern?

```javascript
describe("removeSomething", function () {
  describe("where when called", function () {
    beforeEach(function () {
      this.module.remove.and.returnValue(jasmine.helpers.deferredDone());
      this.module.removeSomething();
    });

    it("should call remove action to remove something", function () {
      expect(this.module.remove).toHaveBeenCalledWith({
        "subPathId": "removeSomething"
      });
    });
  });
});
```

The first thing that came to mind is that someone had been taught to only create **one expect per test** and this pattern allowed that for the individual execution of the code-under-test. This pattern allows a developer to ignore the Single Responsibility Principle (SRP) for the code-under-test and write what looks like good tests.

## Conclusion

For this specific set of code, I found that the original code could be tested by simply moving the **beforeEach** code above into the test. But here, the point is that the pattern should not have been used. While it is elegant "in a way," it also makes for a convoluted setup and initiation of a test that can allow for a more complex pattern of code-under-test that breaks the Single Responsibility Principle.
Leveraging the Dependency Injection support in Azure Functions
Tags: azure, dotnet, serverless
Published: 2019-09-03 16:40:22

> This article is part of [#ServerlessSeptember]( https://dev.to/azure/serverless-september-content-collection-2fhb). You'll find other helpful articles, detailed tutorials, and videos in this all-things-Serverless content collection. New articles are published every day — that's right, every day — from community members and cloud advocates in the month of September. 

> Find out more about how Microsoft Azure enables your Serverless functions at [https://docs.microsoft.com/azure/azure-functions](https://docs.microsoft.com/azure/azure-functions/?WT.mc_id=servsept_devto-blog-cxa).

For many developers, techniques such as [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) and [inversion of control](https://en.wikipedia.org/wiki/Inversion_of_control) have become commonplace in their codebases. Particularly in the .NET space, there are tons of open source frameworks and libraries that make incorporating these practices much easier.

As the software industry continues to steadily adopt more serverless technologies, development teams continue to search for ways to leverage their existing investments into this new serverless world. They want to be able to create modular components and dynamically swap out their implementations without having to rewrite or deploy their code. They want to be able to write focused unit tests for their code and create mock implementations that abstract away external dependencies. 

These are just some of the reasons why support for dependency injection was added to serverless functions targeting .NET Core in [Azure Functions](https://azure.microsoft.com/en-us/services/functions?WT.mc_id=ondotnet-devto-cephilli) v2.

We were so excited about this feature, we decided to invite [Fabio Cavalcante](https://twitter.com/codesapien) from the Azure Functions team to come on the [On .NET](https://channel9.msdn.com/Shows/On-NET?WT.mc_id=ondotnet-devto-cephilli) show to give us a demo of how it all works.

{% youtube LTPbaNzJd18?t=39s %}

If you liked this video and would like to see some more of our .NET content, please subscribe to our [.NET Developers YouTube Channel](https://www.youtube.com/channel/UCvtT19MZW8dq5Wwfu6B0oxw).


## Useful Links
* [Use dependency injection in .NET Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection?WT.mc_id=ondotnet-devto-cephilli)
* [Code demos from the show](https://github.com/fabiocav/azfunc-di-demo)
* [Advancing the developer experience for serverless apps with Azure Functions](https://azure.microsoft.com/en-us/blog/advancing-the-developer-experience-for-serverless-apps-with-azure-functions/?WT.mc_id=ondotnet-devto-cephilli)
* [Create your first function using Visual Studio Code](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?WT.mc_id=ondotnet-devto-cephilli)
* [Get started with .NET](https://dotnet.microsoft.com/)
What's New in Laravel 6.0?
Tags: php, laravel, laravelphp, laravel6
Published: 2019-09-03 16:24:57

---
title: What's New in Laravel 6.0?
published: true
description: Learn about the new features and products in the recent Laravel 6.0 release.
tags: #php #laravel #laravelphp #laravel6
canonical_url: https://auth0.com/blog/whats-new-in-laravel-6/
---
Laravel 6.0 is here!

Taylor Otwell, the creator of Laravel, has been teasing the 6.0 release for a few months now and today it has finally officially dropped. Let's take a look at what's changing and how you can start using it right away.

[Read on 6️⃣](https://auth0.com/blog/whats-new-in-laravel-6/?utm_source=dev&utm_medium=sc&utm_campaign=new_laravel6)

![What's New in Laravel 6.0?](https://cdn.auth0.com/blog/illustrations/laravel.png)
Create a Carousel with CSS
Tags: css, html, webdev, tutorial
Published: 2019-09-03 15:55:32

El usuario necesita navegar por un set de items y posiblemente seleccionar alguno de ellos para facilitar la interacción creamos este elemento llamado carousel/slideshow.

## Cuando usarlo  
+ Utilízalo cuando tengas que mostrar una larga lista de elementos, pero quieres concentrar la atención del usuario solo en el elemento que seleccione por poco tiempo.
+ Utilízalo cuando quieras hacerle saber al usuario que hay más elementos delante que quieres mostrarle.
+ Utilizalo cuando no tengas suficiente espacio para mostrar todos los elementos a la vez.
+ utilízalo cuando tengas elementos muy visuales para mostrar, cómo carteles de películas, portadas de álbumes, productos, etc.
+ No lo utilices cuando los elementos no sean visuales como links a artículos de texto, documentos PDF etc.
+ No lo utilices cuando el contenido vinculado no es inmediatamente identificado por una imagen.

Aquí te dejo el resultado de un sencillo ejemplo con solo html y css, que como puedes ver se pueden obtener buenos resultados.
{% codepen https://codepen.io/ismaeldevmw/pen/ZEzXyZQ %}
How I "Unfollowed All" in twitter... 
Tags: twitterunfollow
Published: 2019-09-03 15:13:41

tldr; 

var lst = document.querySelectorAll('section .css-1dbjc4n > .css-1dbjc4n > div.css-18t94o4');
var arr1 = [];
lst.forEach(x => arr1.push(x));
arr1.map(x => x.click());

This script will trigger click event for all the Unfollow button in following page of twitter.

Hey everyone, hope you are having a great day. 
So today I logged into my long abandoned twitter account and found myself following a lot of people whom I didn't know. Hmmm... very suspicious. I found that some random apps had access to my account so maybe they did it. Whatever the scenario I wanted to unfollow everyone. Of course twitter developers made the process of unfollowing VERY painful by adding a confirmation popup and no option to do a quick "Unfollow All". So this left me with no choice but to tinker with developer tools...

"Back to hardware mode"

I tried googling but no answer worked for me. Out of desperation I created the above script to trigger click event on all Unfollow button concurrently so all the confirmation popups will open one after another. It still required me to click 132 times on the confirmation button but still it was easier. I hope this helps anyone else who is trying to do this same thing and is frustrated by not having a "unfollow all" button...

Have a good day..
Code Story E6: Jonathan Perichon on Making Early Mistakes
Tags: podcast, codestory
Published: 2019-09-03 15:09:26

{% youtube dM4Y-iCvTdw %}

Through a chance internship in LA, Jonathan Perichon made his way from France to the United States. In doing so, he fell in love with the culture and opportunity. After working for a startup requiring background checks for its users, he saw first hand how antiquated and slow the process can be. After about 6 months, he and his co-founder set off to build an API driven solution, facilitating the submission, reporting and workflow of background checks for candidate workers… and much more. 

In the above clip, Jonathan Perichon let us know why it's important to make early mistakes. If you like what you hear, check out the full episode below.

{% podcast https://dev.to/codestorypodcast/e6-jonathan-perichon-checkr %}
Weekly Links – 9/3
Tags: links, weekly
Published: 2019-09-03 19:16:08

---
title: Weekly Links – 9/3
published: true
tags: Links,weekly
canonical_url: 
---

Hello All, I’m a little late getting this out the door, but a fully sick family, complete with a side-helping of pneumonia for me didn’t help this weekend. But here it is.

![See the source image](https://thechive.files.wordpress.com/2017/01/ive-got-a-fever-for-memes-about-being-sick-20-photos-216.jpg?quality=85&strip=info&w=600)

## Development:

- [Redesigning Configuration Refresh for Azure App Configuration](https://devblogs.microsoft.com/aspnet/redesigning-configuration-refresh-for-azure-app-configuration/)
- [How the .net team uses azure pipelines to produce docker images](https://devblogs.microsoft.com/dotnet/how-the-net-team-uses-azure-pipelines-to-produce-docker-images/)
- [Enabling DevSecOps with Synopsys and Microsoft](https://devblogs.microsoft.com/devops/enabling-devsecops-with-synopsys-and-microsoft/)

## Cloud:

- [Azure Load Balancer becomes more efficient](https://azure.microsoft.com/en-us/blog/azure-load-balancer-becomes-more-efficient/)
- [Harnessing the Power of the Location of Things with Azure Maps](https://azure.microsoft.com/en-us/blog/harnessing-the-power-of-the-location-of-things-with-azure-maps/)
- [Microsoft Azure Available from new cloud regions in Switzerland](https://azure.microsoft.com/en-us/blog/microsoft-azure-available-from-new-cloud-regions-in-switzerland/)
- [PyTorch on Azure: Full Support for PyTorch 1.2](https://azure.microsoft.com/en-us/blog/pytorch-on-azure-full-support-for-pytorch-1-2/)

## Video and Audio:

- [.net Rocks – Performance is a Feature with JD Trask](https://www.dotnetrocks.com/default.aspx?ShowNum=1650)
- [Visual Studio Toolbox – The State of Mobile Development](https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/The-State-of-Mobile-Development)
- [Azure Friday – Protect your web applications using WAF with Azure Front Door](https://channel9.msdn.com/Shows/Azure-Friday/Protect-your-web-applications-using-WAF-with-Azure-Front-Door)
- [AI Show – Anomaly Detector v1.0 Best Practices](https://channel9.msdn.com/Shows/AI-Show/Anomaly-Detector-v10-Best-Practices)
- [Data Exposed – vnet Firewall Rules for SQL Database](https://channel9.msdn.com/Shows/Data-Exposed/Data-Exposed--Demo--Vnet-Firewall-Rules-for-SQL-Database)
Explain This Unsigned Int Meme Like I'm Five
Tags: explainlikeimfive, c, devmeme
Published: 2019-09-03 15:05:39

---
title: Explain This Unsigned Int Meme Like I'm Five
published: true
tags: explainlikeimfive , c , devmeme
cover_image: https://thepracticaldev.s3.amazonaws.com/i/8mxal3socj7qgbu7rav7.jpg
---
Please Explain This meme?

![Explain This Meme](https://thepracticaldev.s3.amazonaws.com/i/8mxal3socj7qgbu7rav7.jpg)

Where's the extra `-1` coming from?
Account Kit By Facebook 👍
Tags: android, webdev, javascript, react
Published: 2019-09-03 14:59:45

![Account Kit by Facebook](https://pocketnow.com/wp-content/uploads/2016/04/account-kit.jpg)
During the development of the mobile and web application, I was in search of authentication service which could incur **zero charges** and has **unlimited OTP's generated.**

I tried Auth0, Firebase but they were not so much promising. Then, later on, I came across **Facebook's Account Kit** which is absolutely free for 
* Android 
* iOS
* Web Clients


Account Kit by Facebook is a hassle-free **Passwordless Authentication System**

![Account Kit by Facebook](https://static.xx.fbcdn.net/rsrc.php/v3/y9/r/xKWTidtSQqa.png?_nc_x=Ij3Wp8lg5Kz)

**Pre-requisites**

* Facebook Developer Account
* Account Kit Client Token
* Account Kit App Secret

After setting up the developer account, you need to deploy the server code and integrate the SDK into your app or website. Facebook, this year has also introduced Whatsapp verification which is easier than mobile verification.

Several **BIG Companies** that have integrated Facebook's Account Kit in their core technology are 🏆

* Tinder
* Saavan Music
* Fynd

**Useful Resources** ⚡️

* [Official Docs](https://developers.facebook.com/docs/accountkit/)

* For React Native Developers - 
Read this [Passwordless Authentication in React Native using Facebook Account Kit](https://medium.com/react-native-training/passwordless-authentication-in-react-native-using-facebook-account-kit-part-1-8d83e92077e9)

* For Android - Watch this video on Youtube [Setup Account Kit By Facebook on Android](https://www.youtube.com/watch?v=4mRMTcmb_V8)

* [Setup Facebook Account Kit](https://auth0.com/blog/facebook-account-kit-passwordless-authentication/)

**Github Repo** 🚀

* [Account-Kit-Samples-for-Android](https://github.com/fbsamples/account-kit-samples-for-android)

* [Account-Kit-Samples-for-iOS](https://github.com/fbsamples/account-kit-samples-for-ios)

* [Account Kit for React Native](https://github.com/underscopeio/react-native-facebook-account-kit)

* [Account Kit for React.JS](https://github.com/zsajjad/react-facebook-account-kit)
In Case You Don't Know, Rust is The New "C"
Tags: discuss, programming, webdev, python
Published: 2019-09-03 14:58:21

---
title: In Case You Don't Know, Rust is The New "C"
published: true
description: 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/2yzbkudn5ug1wsavha9q.png
tags: discuss, programming, webdev, python
---

Good read: [“Rust is the future of systems programming, C is the new Assembly”: Intel principal engineer, Josh Triplett](https://hub.packtpub.com/rust-is-the-future-of-systems-programming-c-is-the-new-assembly-intel-principal-engineer-josh-triplett/)



I really couldn't see this before, but Rust is a replacement for C/C++, a clean replacement.

Here is [Redox OS](https://www.redox-os.org):

> Redox is a Unix-like Operating System written in Rust, aiming to bring the innovations of Rust to a modern microkernel and full set of applications.

![redox](https://www.redox-os.org/img/redox-orbital/large.webp)

And Wasmer is pretty promising for the web world:

{% github wasmerio/wasmer %}


Even it might takeover current big C/C++ implementations like this one:

{% github RustPython/RustPython %}

### What other Rust potential use-cases do you see?
What does a good Resume/CV look like for an aspiring Web Dev?
Tags: career, webdev, help
Published: 2019-09-03 14:32:41

Hello!

I was wondering as someone trying to transition from a support role into a development role what should my CV look like when I am applying for Junior/Dev roles? What do I emphasize? 

I have been creating some projects on the side while learning to code (at various levels) do I list all these inside my CV? Should I have a single portfolio and list them on that?

Does the community have any advice on how I should present myself to hiring companies with my CV/Portfolio?

Thanks!
Angular — Aliases for Import statements
Tags: angular
Published: 2020-07-15 09:33:31

---
title: Angular — Aliases for Import statements
published: true
date: 2019-09-03 14:19:04 UTC
tags: angular
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*SoOEKsd9wkb6rw1XzxOjMA.png)<figcaption>Aliases for Import statements</figcaption>

### Angular — Aliases for Import statements

This is one of the coolest features of angular. Every developer comes across situations where imports of the angular applications are messy and difficult to read.

You might come across something like:

import UserService from '../../../../Services/user-service;   
 import UserComponent from '../../../../components/user.component;

It would be more helpful if we have aliases for relative paths which improves the readability of the code.

To achieve this in your angular application, what all you need to do is update the tsconfig.json file.

![](https://cdn-images-1.medium.com/max/385/0*cl3ZD8SY6qrIDXJq.png)

If you look at the above configuration, the default property of the baseUrl property was updated to ‘src’ directory. Then, we added a new property called paths, which is an object containing key-value pairs representing aliases defined for the paths in our application.

Above code can be rewritten as below:

import UserService from '@core/Services/user-service;   
import UserComponent from '@modules/user/components/user.component;

This way code is much cleaner and easier to read.

_Originally published at_ [_http://techmonks.org_](http://techmonks.org/angular-alias-paths/) _on September 3, 2019._

* * *
RxSwift workshops
Tags: ios, workshops, rxswift
Published: 2019-09-03 09:37:29

> Do you want us to run a professional RxSwift training in your company? Contact us at [projects@elpassion.com](mailto:projects@elpassion.com).

The mobile team at **EL Passion** is very enthusiastic about reactive programming. The reactive approach helps us build the apps thinking about the functionalities, not about technical matters of keeping the internal state in sync.

In fact, we use reactive programming so extensively that we'd decided to share the knowledge with others. We've held two editions of RxSwift workshops during which we've mentored almost **40 iOS developers** through their first steps with the framework and reactive programming in general!

## Content

The workshop was aimed towards people who are familiar with iOS development but never had a chance to try RxSwift. It was divided into three modules:

1. Introduction to Functional Reactive Programming and basic RxSwift operators.
2. UI bindings with RxCocoa.
3. Reactive networking.

Each module consisted of a theoretical introduction in form of the presentation and a set of the practical exercises focused on implementing the most common tasks in the reactive fashion.

## Agenda

- **9:00 - 9:30** Project setup
- **9:30 - 11:30** FRP and basic RxSwift operators
- **11:30 - 12:00** Coffee break
- **12:00 - 14:00** UI bindings in RxCocoa
- **14:00 - 15:00** Lunch break
- **15:00 - 17:00** Reactive API calls
- **17:00 - 17:15** Experiences & closing thoughts

## Attendees' reviews

Review #1:

> I've visited EL Passion during the RxSwift training. I work in software development for over 15 years, and I have to admit that I've never seen such a well-organized workshop ran free of charge. I was impressed by how professional the whole organization had been.

Review #2: 

> Thanks to iOS team for professional and well prepared RxSwift workshop.

Review #3:

> I took part in RxSwift training ran by EL Passion. Very substantive workshops, great preparation and held in a nice atmosphere.

You can read more reviews on [our Facebook page](https://www.facebook.com/pg/elpassion/reviews/).

## Pictures

|Pictures|
|:-:|
|![Photo 1](https://github.com/elpassion/Showcase/raw/master/content/RxSwift-workshops/photo1.jpg)|
|![Photo 2](https://github.com/elpassion/Showcase/raw/master/content/RxSwift-workshops/photo2.jpg)|
|![Photo 3](https://github.com/elpassion/Showcase/raw/master/content/RxSwift-workshops/photo3.jpg)|
|![Photo 4](https://github.com/elpassion/Showcase/raw/master/content/RxSwift-workshops/photo4.jpg)|

Check out more pictures at [our Facebook page](https://www.facebook.com/elpassion/posts/2080492595363174).

## License

Copyright © 2019 [EL Passion](https://www.elpassion.com)
Distinguished Devs #2: John Leider - creator of Vuetify
Tags: career, productivity, motivation, podcast
Published: 2019-09-03 14:02:07

John Leider is the creator of [Vuetify](https://vuetifyjs.com/en/).

A few years ago, John was frustrated with the options available for rapidly prototyping and developing new applications. He started Vuetify as a side project for himself, and never intended to release it. After a friend persuaded him to make it an open source project, Vuetify has become one of the most popular (possibly the most popular) front-end frameworks for Vue.

In this interview, John talks about learning, workflow, and how he got into programming.
We also talk about John's approach to running a large open source project and how it differs from others.

{% soundcloud https://soundcloud.com/distinguished-devs/2-john-leider-creator-of-vuetify %}

The Distinguished Devs podcast is available on iTunes, Spotify etc.

The next episode will be an interview with Martijn Pieters, the top StackOverflow Python contributor, so don't forget to hit follow.
Which React visualization library to use?
Tags: react, visualization, svg
Published: 2019-09-03 13:54:14

What I am looking for is a react library that can deliver awesome visualizations with minimum effort but are also customizable as the platforms scales
My top 3 choices in order of preference are: 
- Recharts
- react-vis
- victory 

Criteria that I have set for choosing the best is :
- Easily Responsive
- Plenty of examples
- Good documentation
- Should be popular
- Flexible

So far recharts has won because it is super popular but I think I have developed a bias so expecting some experienced view on the same.
HELP ME OUT GUYS!!!
Daily Challenge #56 - Coffee Shop
Tags: challenge
Published: 2019-09-03 13:45:35

---
title: Daily Challenge #56 - Coffee Shop
published: true
description: 
series: Daily Challenge
tags: challenge
---

Today, your [challenge](https://www.codewars.com/kata/59e85dd50a2bff00da00007f) is to help Bob with his coffee shop!

> Bob's coffee shop is really busy, so busy in fact that if you do not have the right amount of change, you won't get your coffee as Bob doesn't like waiting for people to sort change. Drinks avaialble are Americano £2.20, Latte £2.30, Flat white £2.40 and Filter £3.50

Write a function that returns, "Here is your "+type+", have a nice day!" if they have the right change or returns "Sorry, exact change only, try again tomorrow!"

***
_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_

_This challenge comes from victoriabate on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_