teleren/devto huggingface dataset:
JS Test #2: How to create an array in JavaScript
Tags: programming, beginners, codenewbie, javascript
Published: 2021-02-02 13:00:06

![code-snippet](https://learn.coderslang.com/js-test-2.png)
What's the correct way to create an array in JS?	

<!--more-->

.

.

.

.

.

.

.

.

.

.

.

.

.

The first array, `a1` is declared using an empty array literal. There are no issues with it. In fact, it’s one of the most common ways of declaring an array in JS.

The second one, `a2` is created by calling `Array` as a function. It’s fine and it creates an empty array as well.

The third array, `a3` is created using an explicit call to the `Array` constructor as we use the `new` keyword there.

---

**ANSWER**: All arrays are created correctly

[Learn Full Stack JavaScript](https://js.coderslang.com)
TYPO3 Talk with Marc Willmann: Leader of TYPO3 Education Committee
Tags: typo3, typo3talk, typo3community
Published: 2021-02-02 12:24:16

This time we're honored with an interview of Marc Willmann, Head of TYPO3 Development at F7 Media GmbH in Hamburg and also Leader of the TYPO3 Education Committee. Of course, he is also certified as TYPO3 CMS Certified Integrator (TCCI), Developer (TCCD), and Consultant (TCCC).

This is an interesting TYPO3 talk, grab the cup of coffee to explore Marc's insights about his views, history, and potential of TYPO3 and the open-source community, and how we can build a better TYPO3 Eco-system together!

Let’s explore his journey with TYPO3, and a lot more!

Review on the complete interview at- https://t3terminal.com/blog/typo3-talk-with-marc-willmann-leader-of-typo3-education-committee/
How to add Google Fonts in Vue Styleguidist
Tags: vue, javascript, styleguidist, fonts
Published: 2021-02-02 12:22:41

Few days ago I worked on a [vue-styleguidist](https://github.com/vue-styleguidist/vue-styleguidist) project and I had to use a Google Font.

**Side note**: `vue-styleguidist` is the "Vue version" of the more famous [react-styleguidist](https://github.com/styleguidist/react-styleguidist), _a component development environment with hot reloaded dev server and a living style guide_.

In a static page, I would add the font in a classic way using a `<link>` tag:

```html
<html>
  <head>
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Raleway:100,400,800">
    <style>
      h1 {
        font-family: 'Raleway', sans-serif;
        font-size: 48px;
      }
    </style>
  </head>
  <body>
    <h1>Whoa! I'm in Raleway 📝</h1>
  </body>
</html>
```

But hey, in Styleguidist we are writing components into the "Styleguidist box" 📦!

Styleguidist takes care of creating the fancy and functional box around our components, while we only have to write what is strictly necessary for the component (its structure, its styles, and its logic)

To add a `<head>` property to the "Styleguidist box" we have to use the `react-styleguidist` [template property](https://react-styleguidist.js.org/docs/configuration/#template) which lets us change the HTML of the Styleguidist application.

To find out `template` supported properties, I deep dive into `mini-html-webpack-template-plugin` [extended options](https://www.npmjs.com/package/@vxna/mini-html-webpack-template#extended-options). There I found that it is possible to add an `head` property with an array of `links`... awesome! 😼

| Name         | Type      | Default     | Description                             |
|--------------|-----------|-------------|-----------------------------------------|
| `head.links` | `{Array}` | `undefined` | Array of objects with key + value pairs |

So, to add Raleway Google Font in our project we have to add to the `styleguide.config.js` file a  `template` object:

```js
// styleguide.config.js

module.exports = {
  title: 'My awesome styleguide',
  components: 'components/**/[A-Z]*.vue',
  ...
  template: {
    head: {
      links: [{
        key: 'stylesheet',
        value: 'https://fonts.googleapis.com/css?family=Raleway:100,400,800',
      }, ],
    },
  },
}
```

that turns out in

```html
<head>
  <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Raleway:100,400,800">
</head>
```

Now, in our components files we can use the Google Font 😏

```html
// My component.vue

<template>
  <h1>My awesome title</h1>
</template>

<script>
  export default {
    name: 'MyComponent',
  }
</script>

<style>
  h1 {
    font-family: 'Raleway', sans-serif;
    font-size: 48px;
  }
</style>
```
TYPO3 Myths Explained (Why They’re Not True)
Tags: typo3myths, typo3gmbh
Published: 2021-02-02 12:17:48

Some of these common TYPO3 myths and misconceptions end up confusing users and leading them to choose the wrong platform. In this article, we take down the hammer like Thor on myths about our favorite TYPO3 CMS.

We will burst misbelief about the top TYPO3 myths with detailed explanations, which might have been dragging you from diving in and experiencing the TYPO3 platform like no other, just so you can see TYPO3 in its utter and sheer glory...

Review on all the TYPO3 myths on- https://t3terminal.com/blog/typo3-myths/
Learning Application Security with Tanya Janca
Tags: security
Published: 2021-02-02 12:10:54

{% youtube 3t4tXDBVQM4 %}

Tanya Janca, who was on the podcast last year, is back! Since the last time we talked, she’s been very busy founding her own company, We Hack Purple. Tanya’s an expert on App Security, and through her company, she’s sharing those skills with online on-demand courses.

In this episode, we talk about…

* Tanya’s new community centered around her online academy, which has been a positive and kind space for discussing related topics.
* Why, if you’re a software developer, you should learn about app security and have a strategy to talk to management to get what you want and legitimize your job.
* Tanya’s book and how she teaches each lesson within it several different ways to make it accessible for various learning styles.
* Tanya’s current free mini-course offering about scaling your security program and security team.
* The best career advice Tanya has ever gotten.
* The importance of mentors in everyone’s careers and why it’s very important to build a community.

Resources from this episode:

* Follow Tanya on [Twitter](https://twitter.com/shehackspurple)
* Check out the [We Hack Purple Academy](https://store.wehackpurple.com/)
* Read Tanya's new book: [Alice and Bob Learn Application Security](https://www.amazon.com/Alice-Bob-Learn-Application-Security/dp/1119687357)
* Join the [We Hack Purple Newsletter](https://newsletter.wehackpurple.com/)
Finest TYPO3 Newsletters to Subscribe Now!
Tags: typo3, typo3newsletter, t3terminal
Published: 2021-02-02 12:04:07

In this busy world in 2021, No one has time to explore social media platforms, variance TYPO3 websites, etc to keep up-to-date on TYPO3 CMS. The TYPO3 community is awesome which beliefs in sharing TYPO3, and many active TYPO3 newsletters spread TYPO3.

What’s going on in TYPO3 & the community? How do you update yourself? There are many ways to get the latest information about TYPO3 CMS. But my favorite is to subscribe to the TYPO3 blog newsletters. Here is the list of TYPO3 newsletters that I’m following;

Explore all the TYPO3 newsletter at - https://t3terminal.com/blog/typo3-newsletter/
Explaining RSpec minimal code style rules in 2 minutes
Tags: rspec, ruby, testing
Published: 2021-02-02 11:32:39

Sometimes I meet code like this:
```ruby
describe "callbacks" do
  describe "before validation" do
    let(:blog) {create(:blog) }
    context "when slug is not set" do
      it "generates it" do
        item = Post.new(blog: blog)
        item.validate
        expect(item.slug).not_to be_nil
      end
    end
    context "when slug is set" do
      it "does not change it" do
        item = Post.new({blog: blog })
        item.slug = 'in the darkness'
        item.validate
        expect(item.slug).to eq 'in the darkness'
      end
    end
  end
end
```

This is very hard to read. And oddities in formatting cause the eye to stumble.

To make the test a hundred times easier to read, stick to the basic rules of hygiene in tests: separate phases and rely on code style.

## Separate phases
The test consists of three phases: setup, exercise, and verify. Separate them from each other with a blank line. Also separate the `context`/`describe`/`it` blocks:

```ruby
describe "callbacks" do
  describe "before validation" do
    let(:blog) {create(:blog) }

    context "when slug is not set" do
      it "generates it" do
        item = Post.new(blog: blog)

        item.validate

        expect(item.slug).not_to be_nil
      end
    end

    context "when slug is set" do
      it "does not change it" do
        item = Post.new({blog: blog })
        item.slug = 'in the darkness'

        item.validate

        expect(item.slug).to eq 'in the darkness'
      end
    end
  end
end
```

## Rely on code style
To write consistent code and not have to remember what quotes to use, add [Rubocop](https://docs.rubocop.org/rubocop/1.9/index.html). Then add [Sublime-Linter](http://www.sublimelinter.com/en/stable/) and [SublimeLinter-rubocop](https://github.com/SublimeLinter/SublimeLinter-rubocop) to see errors right in the editor:

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

And then it will be easier to read and understand the tests:
```ruby
describe "callbacks" do
  describe "before validation" do
    let(:blog) { create(:blog) }

    context "when slug is not set" do
      it "generates it" do
        item = Post.new(blog: blog)

        item.validate

        expect(item.slug).not_to be_nil
      end
    end

    context "when slug is set" do
      it "does not change it" do
        item = Post.new(blog: blog)
        item.slug = "in the darkness"

        item.validate

        expect(item.slug).to eq "in the darkness"
      end
    end
  end
end
```
Umbraco HQ AMA session, get your questions in!
Tags: umbraco
Published: 2021-02-02 11:20:52

During some recent events HQ asked for questions from the community but they never got answered, so I launched an attempt at having an open AMA session.

Will be hosted by the great folks of [Umbracoffee]([https://www.youtube.com/channel/UCF_Ene5-58a3Z55aw8O6Djg)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0pybk0eu2sduyj64o1kq.png)

Get your question(s) in -> [google form](https://docs.google.com/forms/d/e/1FAIpQLScGOrmEkigivmqD3AASepvbHURpYLgpPSfyvPZQFStUI8ZxWg/viewform)
View the current questions -> [google sheet](https://docs.google.com/spreadsheets/d/1aJDxDR-x71A5YjiOVu2fNmE1Xj1Fy1jrY_Yk-XWjSMI/edit#gid=1439331290)
What You Should Learn in PHP Fundamentals
Tags: php, programming, laravel, coding
Published: 2021-02-02 11:18:27

PHP is one of the most used languages on the web. The vast majority of websites you visit are built with PHP on the back-end, and learning PHP is a requirement for writing plugins or themes for a CMS like [WordPress](https://wordpress.org).

PHP is fast, but even better, it's easy to learn and easy to use for writing web applications.

Get started with the world's most widely-used server-side programming language, [**PHP**](https://php.net)

Let's See, what you should learn in PHP Fundamentals:

• Understand the syntax and structural elements of PHP.

• Know how to correctly apply the various control-flow structures.

• Understand PHP data types, type-juggling, and operator precedence.

• Organize code into reusable functions.
• Accomplish tasks using PHP's built-in file system and array functions.

• Understand essential elements of HTTP such as cookies and sessions.

• Understand the basics of validating input and escaping output.

• Build forms to collect information from a user.

• Interact with a database using PHP's MySQL functions.

• Utilize new PHP 7 concepts and language constructs.
• Create database-driven web applications similar to the course applications.

• Leverage object-oriented programming (OOP) techniques in your applications.

• Use built-in objects to interface a database.
• Analyze input data and learn to filter and validate it, and why.

• Request a web service and process the return data.

• Learn how to better recognize inefficient coding practices, and improve them.

• Learn best practices.

• Learn a few concepts called software design patterns.

• How to throw and handle exception objects.

• Design PHP applications using best practices.

• Use Docker in development and production.

• Design and create APIs using PHP.

• Setup continuous delivery and continuous integration systems.

• Write PHP scripts that can be run from the command line and from Cron.

That's All For Today!
#Happy Coding. #Happy Learning


[**ZEND**](https://www.zend.com) — Fundamental's Curriculum Copyright
Windows Virtual Desktop with Travis Roberts
Tags: azure, devops
Published: 2021-02-02 10:55:17

{% youtube zIeEZEN9rHU %}

In this episode we're catching up with Travis Roberts to chat about all things Windows Virtual Desktop, Azure, and a lot more.

In part due to the COVID-19 Pandemic, 2020 saw the use of Windows Virtual Desktop soar. Many companies are in the process of switching their networks over to the Cloud. Mike’s guest today is Travis Roberts, the Senior Networking Systems Administrator at RBA Consulting. Travis has a background of working in corporate IT for over 20 years, but he made a switch when he realized he wanted to focus less on management and more on consulting. He has lots of experience with Windows Virtual Desktop (and more) and creates content online to help others learn how to better utilize this technology.

In this episode, we talk about…

* Travis’s background, how he got into consulting, and what the transition was like coming to that from corporate jobs.
* How Azure has been ramping up and is currently neck and neck with AWS.
* Why, at this point, most Systems Administrators are essentially Cloud Developers, as well.
* How you have to think a bit differently when using ARM templates and PowerShell.
* Why moving to the Cloud can save a business a lot of overhead expenses.
* The mindset shift involved in maintaining a server rack with manual switches and buttons, versus working within Azure.
* Why setting up a virtual network within Windows Virtual Desktop is so much faster than the traditional means.
* Why you need to continuously learn given the way technology is shifting now -and how if you learn it sooner, you can help others as they shift to the Cloud during the next decade.
* How building a brand can help you, and if you’re interested, you should start writing a blog or making Youtube videos.
* The importance of Source Control and how Travis has been using Github.
* The switch from using JSON to using HCL.
* How Travis has been seeing that he’s been needing to learn more about Continuous Integration.

Resources from this episode:

* Travis on [Twitter](https://twitter.com/Ciraltos)
* Travis on[YouTube](https://www.youtube.com/channel/UCuB24cID6NnypDWSLe4gfqA)
* Travis on [LinkedIn](https://www.linkedin.com/in/robertst/)
* Udemy Course Discount: [Zero to Hero with Windows Virtual Desktop](https://www.udemy.com/course/zero-to-hero-with-windows-virtual-desktop/?couponCode=C1A569972876FF39D337)
AWS for Azure Pros: The Ultimate AWS to Azure Service Comparison
Tags: aws, azure
Published: 2021-02-02 10:52:28

{% youtube m94tlNJCjSI %}

Already know Azure but need to learn AWS? In this CloudSkills Community Call replay, MSFT MVP Mike Pfeiffer delivers a one-hour training that maps what you already know in Azure to comparable services in AWS.

Note: Throughout the video Mike mentions an upcoming AWS class at CloudSkills.io; it ended up becoming the Cloud Native DevOps Bootcamp:

https://cloudskills.io/cloudnative
Show costs in self service portals easily
Published: 2021-02-02 10:50:38

Over the last 10 years we’ve seen a lot of shadow IT with AWS being used as the infrastructure provider. The AWS bills were put on company credit cards and expensed. Individual business units could spin up the resources they needed and work in an incredibly agile manner. Unfortunately, for the enterprise as a whole this resulted in shadow spend, less control and security issues. To address these issues, central IT departments built “Self Service” portals with single sign-on (SSO). Business units could still spin up resources as needed, and the enterprise gained some visibility and control.

This caused a new issue. When successful shadow IT projects started consuming more resources, bills went up until the company credit card limits were reached. Then someone would have to go up the ranks to figure out what rules the business unit broke and how to solve it going forward. Self service portals addressed the credit card limit issue by enabling usage, and adding showback and chargeback via spend reports at the end of the month. Optimization was left to the end user to figure out after getting the bill.

A great way to help the end user optimize cloud costs before the showback/chargeback report is to let them see how much resources cost before they are launched. Multiple enterprises have achieved this with Infracost, and I want to share how:

![Self Service Portal](https://dev-to-uploads.s3.amazonaws.com/i/374fkapszts8mrb8af19.png)

#### 1. Show costs in your self service portal to the end user
The first step is to show cost estimates in your self service portal. If you are using Terraform to launch resources, this is easy to do by integrating with Infracost. Read our [API documentation](https://www.infracost.io/docs/infracost_api) for more information. Infracost is free and open source.

#### 2. Set expectations in management and finance
The next step is to set expectations by giving visibility of the cost estimates to management and finance. You can use our [HTML output reports](https://www.infracost.io/blog/terraform-cloud-costs-directly-from-pull-request-to-management) to achieve this.

#### 3. Monitor ongoing costs
Finally, set up alerts and reports for ongoing costs. There are many companies who can help with this, including the cloud providers themselves.
<br/>

Our users have connected their self service portal in a matter of hours. Their end users immediately begin seeing cost estimates. You can start using [Infracost now](https://www.infracost.io/docs/), or email us for a deeper engagement with our team (hello@infracost.io).
LGTM Devlog 30: Sprint 3 Retrospective
Tags: devjournal, github, python, agile
Published: 2021-02-02 10:41:08

Unfortunately, this sprint, I spent the majority of it refactoring multiple times, and ended up doing only half of the planned tasks!

![Sprint](https://dev-to-uploads.s3.amazonaws.com/i/brqoeq2bm7rqfccn35xv.png)

# Retrospective
Was this wise? As I reflect on this, I'm not sure, this is how I feel about it:

**Pros**
* Refactoring has made the code much more consistent. I was annoyed before by the code duplication and inconsistent behaviour of the `Game`, `User`, and `Quest` objects
* Refactoring has made the code much easier to test. Because code is consistent, and because now it is easy to instantiate objects, tests can use these objects directly rather than poll the database to check stuff
* I now have a pattern for making ORM-type subclasses, that I can re-use for future

**Cons**
* Didn't achieve the actual tasks I needed to do
* Didn't increase functionality
* There's a chance I've spent time writing code that would yet again be refactored later

I think on the balance, there are more pros than cons that came out of missing all of the sprint objectives, and although missing objectives is bad, for the right reasons they are allowable. The failure therefore in this case wasn't that I missed the objectives, but that I failed to foresee and plan for these tasks.  In future I should therefore look out for this and plan accordingly rather than put myself under extra pressure to complete a sprint tasks when there were other things that were of benefit to do.
Variables in both CSS and sass;
Tags: todayilearned, todayisearched, sass, css
Published: 2021-02-02 10:34:30

Traditionally variables were only used in programming languages but nowadays even styling languages like CSS and more so preprocessors have adopted the use of variables.
This article highlights the use of variables in both CSS code well as sass code specifically the SASS way.

Variables in CSS and SCSS are used primarily for two reasons that will be quite evident from our examples and subsequent explanation.

- Ease in management of repetitive code in your **CSS**  and **SCSS.**

- Ease in making changes to important and crucial parts of your code from just one snippet. These snippets include colors, fonts, media query viewpoints, box shadows among others.



**1. Variables in CSS;**
variables in CSS can be easily most likely in the root tag and applied anywhere in your CSS file. Example;

```
:root {
  --blue: #1e90ff;
  --white: #ffffff;
}
``` 
Applying these variables is also quite easy  as follows;

```
div {
  background-color: var(--white);
  color: var(--blue);
  border: 1px solid var(--blue);
  padding: 5px;
}
``` 


**2. variables in SCSS;**

Preprocessors are used to take some code in a particular format and render it another format in this instance SCSS to CSS. There are numerous benefits of working with them including;

> Separating your code with production code.

Code written directly to the code editor may become messy and it normally is especially when it comes to styling. Sure, there code refactoring and review which normally takes a lot of time, but instead, a preprocessor does all this for you.


> **Secondly we can use functions and methods built-in SASS;**

 These functions make styling so much faster and also expand the capabilities of CSS without a lot of complications.


> With Sass it's possible to nest code and also utilize partials which means easy management and arrangement of our code.


> Finally, Sass can be expanded and utilize third-party snippets like functions, libraries, mixins, and frameworks which means it can be expanded beyond ordinary CSS capabilities.

This article focuses on variable and let's have a look at an example in SCSS;

```
$primary-color: #28df99;
$max-width: 1280px;
$border-radius: 5px;
$box-shadow: 2px 2px 12px rgba($primary-color,.5);
``` 
These are all variables declared at the beginning of our SCSS file which is the preprocessor of CSS. These variables are applicable in any part of the code by just referring to the variable name. Example;

```
body{
background-color: $primary-color;
max-width: $max-width;
}
div{
  box-shadow: $box-shadow;
  border-radius: $border-radius;
}
``` 
If an adjustment to the color is ever required only the value of the primary color ($primary-color: #28df99;) should be adjusted and the change applies to the entire code where this is applied.

It's important to however note that just like CSS, SASS reads its code in sequence from top to bottom so the variables must be defined before they are ever used in your code otherwise the style will not be applied.