teleren/devto huggingface dataset:
Js Node (Helmet.js)
Tags: node, javascript, helmet, depedencies
Published: 2021-05-23 14:50:23

Hello there guys!


As the days going through and summer is near a lot of you, have done with projects,couple of 'em created in node/express.js environment and probably you think  this is
the time to force some extra functionalities ,with some external
libraries-packages. :D :D

Today, i will focus in one dependency, is called Helmet.js exist also an open repo
on gitghub,check here [helmet-repo](https://github.com/helmetjs/helmet) which helping us provide some
additions in our express server,those parameters are focused on the security of your app.

You can use npm or yarn i will head with npm so simple we can install it `npm install helmet --save` and save it globally.


So if you already have an express server running,you can just
simple require the helmet, see bellow :
 
```
const express = require("express");
const helmet = require("helmet");

const app = express();

app.use(helmet());

// ...
```

#What is helmet?

Helmet is a function used as  middleware and is wrapping 11 smaller middleware's,sets HTTP Headers,origin validations and some other stuff to avoid multiple attacks on your website-webapp.

So the above `app.use(helmet());`  is equivalent to this
```
app.use(helmet.contentSecurityPolicy());
app.use(helmet.dnsPrefetchControl());
app.use(helmet.expectCt());
app.use(helmet.frameguard());
app.use(helmet.hidePoweredBy());
app.use(helmet.hsts());
app.use(helmet.ieNoOpen());
app.use(helmet.noSniff());
app.use(helmet.permittedCrossDomainPolicies());
app.use(helmet.referrerPolicy());
app.use(helmet.xssFilter());
```
 All setting headers to your content, to your loading balances and predifined actions to verify the actions of the clients verifying like this who is who,is a sugar to your application not the core of your security build.

Let's see two examples
1. ```app.use(
  helmet({
    referrerPolicy: { policy: "no-referrer" },
  })
);
//Set custom options for referrer policy
```
2. ```
// Sets "X-XSS-Protection: 0"
// Disables browsers buggy cross-site scripting filter by setting //the X-XSS-Protection header to 0


app.use(helmet.xssFilter());



```
```
// Sets "X-Content-Type-Options: nosniff"
//Sets the X-Content-Type-Options header to nosniff. This mitigates //MIME type sniffing which can cause security vulnerabilities
app.use(helmet.noSniff());



```
That's all we have for today for more information check the documentation on github link.

Have a nice workday guys, in case for further explanation do not hesitate to contact me or find me in github or linkedin.
GitHub : https://github.com/feco2019
Linkedin : https://www.linkedin.com/in/dimitris-chitas-930285191/
Comandos básico - Git
Published: 2021-05-23 14:48:38

Hello world,

Abaixo está uma lista de comandos básicos do GIT, com suas explicações, espero com esse post ajudar vocês de alguma forma.
Aqui deixo um repositório do GITHUB com outros comandos GIT: https://gist.github.com/leocomelli/2545add34e4fec21ec16


**Setar usuário**
```
> git config --global user.name "seu_nome"
```

**Setar email**
```
> git config --global user.email "seu_email"
```

**Cria um novo repositório**
```
> git init
```

**Mostra o estado atual do repositório atual**
```
> git status
```

**Prepara um arquivo para o commit**
```
> git add nome_do_arquivo
```

**Prepara todos os arquivos para o commit**
```
> git add .
```

**Adiciona mensagem com alterações do commit**
```
> git commit -m
```

**Substitui o último commit**
```
> git commit --amend
```

**Lista o histórico de commits**
```
> git log
```

**Redefine a preparação dos arquivos para o commmit mais recente**
```
> git reset
```

**Desfaz as alterações**
```
> git revert nome_do_arquivo
```

**Lista toda as branchs no repositório**
```
> git branch
```

**Deleta uma branch**
```
> git branch -D
```

**Alterna para uma branch**
```
> git checkout
```

**Mescla uma branch especifica**
```
> git merge
```

**Mostra arquivos não rastreados**
```
> git clean
```

**Conecta com um repositório remoto**
```
> git remote add
```

**Envia conteúdo de repositório local para repositório remoto**
```
> git push
```

**Busca um repositório**
```
> git pull
```

**Clona um repositório**
```
> git clone
```

**Mostra a diferença entre a cópia local e o índice sincronizado**
```
> git diff
```
Begin with C#
Tags: csharp, beginners, dotnet, programming
Published: 2021-05-23 14:37:25

C# has been around for quite some period, and it continues to develop, obtaining more enhanced features.


## Learning Objective

* How to install Visual Studio

* How to write your first C# program

## Prerequisites

The article is beginner level, so previous coding experience is not required.

## Getting Started

C# is an object-oriented programming language which allows developers to build various kinds of reliable and healthy applications.

Programming language C# is used to develop following applications

* Desktop based application: For example WinForms, WPF and many more.

* Mobile based applications: using Xamarin cross platform development.

* Web applications: using ASP.Net MVC and ASP.Net Core MVC.

* Web services: via ASP.Net Web API, ASP.Net Core Web API and WCF services.

* Games: Unity framework

* and much more.

### Software Dependency

To begin, go to [VisualStudio.com](https://visualstudio.microsoft.com/) and download the free community 2019 edition. The visual studio IDE supports multiple programming language template, choose required components.

For example, for C# development for console and web application, select the below-highlighted components.

![](https://cdn-images-1.medium.com/max/2568/1*Ya9hmKZbhsJoSzbFKhD3pw.png)

For .Net Core cross-application development, select the following module.

![](https://cdn-images-1.medium.com/max/2544/1*WJiIAt_WmmARYOwXu591_A.png)

After selection, install the Visual Studio IDE and follow the below steps to write the first C# “Hello World” program.

## Hello world Console Application

Open visual studio and go to menu item File > New > Project and select console application(.Net Framework)

![](https://cdn-images-1.medium.com/max/2058/1*VZS7bEAMWa6g7nv4ZN80zg.png)

Click Next, and visual studio will create a console application template. Write the following code to write “Hello World” inside the main method, which outputs the same message in the console window.
```
class Program
{
  static void Main(string[] args)
  {
	Console.WriteLine("Hello World!");    
  }
}
```
### Run/Debug

Now hit the play button on the IDE menu or hit the F5 key to run the program in **debug mode**.

To run things quicker, hit “Ctrl + F5” and run the program in **release mode**.


Thank you for reading, and I hope you liked the article. Please provide your feedback in the comment section.

Follow on following channels to stay tuned on upcoming stories on C#

[C# Publication](https://medium.com/c-sharp-progarmming), [LinkedIn](https://www.linkedin.com/in/sukhpinder-singh-532284a2/), [Instagram](https://www.instagram.com/sukhpindersukh/), [Twitter](https://twitter.com/sukhsukhpinder), [Dev.to](https://dev.to/ssukhpinder), [Pinterest](https://in.pinterest.com/ssukhpinder/_created/), [Substack](https://sukhpinder.substack.com/), [Wix](https://www.csharp-dotnet.com/)
MERN simple authentication
Tags: express, react, passport, node
Published: 2021-05-23 13:50:29

Hello everyone. I am beginner MERN stack. I learn what need and this day try create simple MERN login/register app. I use passportjs for authentication and passport-local-mongoose for plugin database. When I send data using postman all successfully: user loginned registered and logouted. But when I send in frontend I get only currect message in login. But req.user cannot get.
this is my code: https://github.com/Feruz00/travel-mern-app/tree/master
If someone have simple project this method please write comment or send link video or project. Thanks very much!!!
A better `typeof`
Tags: javascript, todayilearned
Published: 2021-05-23 13:49:41

The `typeof` operator is a really useful one but it has a few pitfalls:

```js
typeof ["an", "array"] // object
typeof /regex/g // object
typeof null // object
typeof NaN // number
typeof Number('I am not a number!') // number
```

Ok, that's a lot of pitfalls;

But there is a way to get more detailed types using `Object.prototype.toString.call()` on a value: 

```js
// This statement basically means: "Call the toString method of the object prototype on whatever value you like"
Object.prototype.toString.call({ object: "true" }) // the infamous [object Object]
Object.prototype.toString.call(["an", "array"]) // [object Array]
Object.prototype.toString.call("a string") // [object String]
Object.prototype.toString.call(1n) // [object Bigint]
Object.prototype.toString.call(new Date()) // [object Date] really
Object.prototype.toString.call(new Error("an error")) // [object Error]
Object.prototype.toString.call(function () {}) // [object Function]
Object.prototype.toString.call(function* () {}) // [object GeneratorFunction]
Object.prototype.toString.call(/regex/gi) // [object RegExp]
Object.prototype.toString.call(Symbol()) // [object Symbol]
Object.prototype.toString.call(NaN) // it's not perfect: [object Number]
```

Of course, this could be made a function (with a few finishing touches from [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#real-world_usage))

```js
  function type(obj, showFullClass) {

    // Whether to return the whole type
    if (showFullClass && typeof obj === "object") {
        return Object.prototype.toString.call(obj);
    }

    if (obj == null) { return (obj + '').toLowerCase(); } // implicit toString() conversion

    // Removed, see comments
    // if (isNaN(+obj)) return "nan";
    if (Object.is(obj, NaN)) return "nan";

    var deepType = Object.prototype.toString.call(obj).slice(8,-1).toLowerCase();
    if (deepType === 'generatorfunction') { return 'function' }

    // Prevent overspecificity (for example, [object HTMLDivElement], etc).
    // Account for functionish Regexp (Android <=2.3), functionish <object> element (Chrome <=57, Firefox <=52), etc.
    // String.prototype.match is universally supported.

    return deepType.match(/^(array|bigint|date|error|function|generator|regexp|symbol)$/) ? deepType :
       (typeof obj === 'object' || typeof obj === 'function') ? 'object' : typeof obj;
  }
```
Understanding undefined, null, undeclared in Javascript
Tags: javascript, frontend, interview, codenewbie
Published: 2021-05-23 13:38:19

---
title: Understanding undefined, null, undeclared in Javascript
published: true
description: Staring into Javascript's Emptiness
tags: #javascript #frontend #interview #codenewbie
cover_image: https://images.unsplash.com/photo-1573499571774-7aca8dc8cf1b?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80
---

1. **undefined**
  - It's a primitive data type in Javascript.
  - Any variable which has been declared but has not been assigned any value has the value undefined. 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9g0g17re7lzgc2olz23b.png) 
  - During the memory creation phase of the execution context, every variable is assigned the value of `undefined` by the JS Engine.


2. **null**
  - It's a primitive data type in Javascript.
  - A variable can be assigned the value `null`.
  - Although `null` is itself a data type, but on checking it's type using `typeof` we get `"object"`.
  ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g596u5w21t0wg6f6jz7l.png)
  - [Why is typeof null “object”?](https://stackoverflow.com/questions/18808226/why-is-typeof-null-object)
 

3. **undeclared (not defined)**
  - This occurs when we try to access a variable which hasn't been declared or initalized yet.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sh48snqrcmtqzy0grc7v.png)
  - If we try to `console.log(undeclaredVar)` the error will be raised as shown above, so especially for this a try{...} catch(e){...} block has to be written. But if we instead use `"use strict"` pragma we can fix these errors during compile phase itself rather than during runtime.
  - `typeof` operator is the only operator that can reference a variable that hasn't been declared and not throw an error.  
`typeof undeclaredVar //"undefined"`


4. **uninitialized (TDZ)**
  - It was introduced with ES6.
  - It's based on the concept of Temporal Dead Zone.
  - Variables which are block scoped (declared using `let` or `const`) are initially _uninitialized_. They can't be accessed unless they're in the temporal dead zone or intialized.
  ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/boibbzk87j0r7px2pw09.png)
 


References & Further Reading:
1. [6 ECMAScript Data Types and Values] (https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values)
2. [How to check if a variable is undefined versus it is undeclared in javascript?](https://stackoverflow.com/questions/64406377/how-to-check-if-a-variable-is-undefined-versus-it-is-undeclared-in-javascript)
3. [ECMAScript 5 Strict Mode, JSON, and More](https://johnresig.com/blog/ecmascript-5-strict-mode-json-and-more/)
How to Make an E-Learning Platform in Python & Django 3.0
Published: 2021-05-23 12:39:41

Hello Devs, 
In this post, you can learn how to make an E-learning website in Django 3.0, after reading this you can easily create an e-learning platform in django and check my GitHub repository and learn how to create an e-learning website in django and python.

The Most Popular Examples of E-learning Platforms

1) Udemy

Everyone knows about this platform, udemy is the largest e-learning platform, in which we can buy or purchase courses, this platform is advanced and has top-notch features like user progress tracking and download certificates, udemy has 4-5 Interfaces or panels like Teacher Panel, in which teacher upload their courses and video or certificates and second is user panel in which user create a profile and purchase a course and start learning.
and after completing the course we get our certificate.

2) Edureka 

3) Desire2Learn

4) Docebo

5) Simplilearn and there are many other platforms.
  
Live Link:-

```  
https://edurekanet.herokuapp.com/   
```

Features of My E-learning Platform code:-
Dynamic Slider

User Login/ Registration

Add To Cart / Remove From Cart

Add Coupons

Payment Gateway Integration

Custom Admin Panel

User Panel

Search bar

Image Size Compressor


a) User Panel

-> Purchase Courses

-> Download Certificate after completing the course

-> Watch Videos

-> Edit Profile

-> Change Password

 -> Order History

-> Add To Cart, Remove from Cart.

-> Calculate Total Amount 


b) Custom Admin Panel

-> Upload Video for Particular course

-> Add Post

-> Category, Sub Category, and Sub Sub Category

-> Autoslug

-> Add Multiple Sections like FAQ or Price or Features

-> Add Discount Coupons

-> All Orders

-> All Users

-> Allow Certificates to Users, Admin has permission to enable or disable the certificate.

-> Index Categories and Post (Move post and Categories)

-> Add Dynamic Sections on Homepage

-> Add latest offers on banners

-> Add Blogs 

and many other functionalities in this project...

Before running the project, run these commands, 

```
1) pip install -r requirements.txt   

2) python manage.py migrate   

3) python manage.py runserver  
``` 

GITHUB LINK:- 

```
https://github.com/ShivamRohilllaa/E-learning-Django-  
```
Day 4/30 : Side Navigation Bar using HTML and CSS
Tags: html, css, webdev, tutorial
Published: 2021-05-23 12:16:27

Welcome to Day 4 of this [Challenge](https://dev.to/somanathgoudar/30dayschallenge-30-days-extreme-html-css-challenge-50k1). This is what I created today. 

**➜ Here is the Demo :**
![Side Navigation Bar](https://1.bp.blogspot.com/-X-XiEpwyj9g/YKOZDmWKgrI/AAAAAAAAABQ/IQtKfivTKo0W6uixFDyzrjwLt5fI0FxcgCLcBGAsYHQ/w320-h292/p4.gif)

**➜ Video Tutorial :**

{% youtube W6G458BAAYY %}
**➜ Source Code :**
https://www.futurecodersweb.com/2021/05/how-to-create-modern-side-navigation.html


**➜ Instagram Post and Reel for Day 4 :**
[See Post and Reel](https://www.instagram.com/future_coderss/)

------------------------------------------------------------------

Hey, If You don't know what is happening here. Don't Worry, I am doing a crazy challenge 😅. Read More about it from the post below.

{% link https://dev.to/somanathgoudar/30dayschallenge-30-days-extreme-html-css-challenge-50k1 %}

**Support Me :**
👉 Buy me a Coffee: https://www.buymeacoffee.com/somanathgoudar
👉 [Follow Me on Instagram](https://www.instagram.com/somanath_goudar/)
👉 [Follow Future Coders on Instagram](https://www.instagram.com/future_coderss/)
👉 [Subscribe to My Main Channel](https://www.youtube.com/channel/UC_nTrhTr5fnBGjOxnkPUmmA)
👉 [Subscribe to Channel Created for this Challenge](https://www.youtube.com/channel/UCzGSyMOf2jPt1MkNBB3SJ3g)

------------------------------------------------------------------
My Dev Journey: Week 3
Tags: javascript, codenewbie, beginners, bootcamp
Published: 2021-05-23 12:14:46

*`this`* is my entry for my second week of JavaScript fundementals at the Northcoders bootcamp.  *`this`* week has been a big one, as we were introduced to a new paradigm in the form of Object Orientated Programming.

```jsx
if (readerLikesContent === true) {
	followOnGitHub: fearneyork;
}
```

Check me out on [GitHub](https://github.com/fearneyork).

## What I've learnt *this* week

### Recursion, recursion, recursion ♽

Before this week, getting to grips with recursion seemed like a much bigger mountain to have to climb. After hearing how other devs view recursion, I had built it up in my head to be something far more challenging than what it very simply boils down to be; a function that calls itself.

I'm looking forward to finding use cases for recursive functions in my code to see how I can use it!

### And I OOP!

The latter half of the week was all to do with switching up the way we work, and instead on relying on pure functional programming, we are started by looking into Factory Functions and learning about the implicit binding of *`this`*.

### Pseudo-classical design, constructors, and prototypes

This part of the week was definitely a mind-bending ride. Thinking I understood the concept I set out solving the challenge given to us, of creating a class that would take arguments and return a Pokemon object with all of the fields filled in.

What I tried to do was enter a single argument of the Pokemon name, and have a separate libraray of infomation that would be pulled in and added to the properties to be returned out of the function. And what I found was that manually creating this library of information is a pretty arduous task. My mind then went to look if there was any way to outsource this task to somewhere else, and started to think about using an API to pull this infomation in.

The PokeAPI seemed like the solution to all of my problems and I had thought about trying to implement it. BUT, it turns out I was overcomplicating the task that needed to be done and at this stage of the bootcamp the instructors were happy with all of the information being passed in, and assuming that if someone else was to input the information that it was all being done so correctly.

WOOPS. 🤦🏻‍♂️

Oh well, I enjoyed it all the same 😅

## Resources I've found useful *this* week

I've not come across any brand new ones this week, nut I did still use the Northcoders notes, [JEST docs](https://jestjs.io/), and [MDN](https://developer.mozilla.org/en-US/) as usual!
Ruby on Rails: New SupeRails Youtube channel!
Tags: rails, ruby, beginners, tutorial
Published: 2021-05-23 12:00:30

---
title: Ruby on Rails: New SupeRails Youtube channel!
published: true
description: 
tags: rails, ruby, beginner, tutorial
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7p9zzzvegkjv7td7diud.png
---

You are a Ruby on Rails fan? Here is new Rails channel to add to your subscribe list. 

This guy is pretty new but have made some goods video so far.

I do this post to give him a little help. Everyone have to start somewhere... So show him some community love!

Here the channel link: https://www.youtube.com/c/SupeRails/videos
Daily Developer Jokes - Sunday, May 23, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-05-23 12:00:04

---
title: "Daily Developer Jokes - Sunday, May 23, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Sunday%2C%20May%2023%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259316ab83.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ What are the three hardest problems in computer science?

___A:___ Naming things and off-by-one errors
 -->
Create production ready React+Rails applications
Tags: react, rails, webdev, showdev
Published: 2021-05-23 10:46:20

**This is a base project to quickly spin up a React+Rails application.**
 
If you want to create a react application with rails backend then most basic and important thing is authentication. And with this api template you don't need to worry about authentication.
In rails app, token based authentication is implemented by using devise gem.

# Built with
- Front-end library - [Reactjs](https://reactjs.org/)
- Back-end - [Rails](https://rubyonrails.org/)
- UI components - [Chakra UI](https://chakra-ui.com)
- Data management - [Context Api](https://reactjs.org/docs/context.html)
- Authentication - [Devise gem](https://github.com/heartcombo/devise)
- Front-end validations - [Formik](https://formik.org/)
- Animation library - [Framer Motion](https://www.framer.com/motion/)

## Live Link
[Quickstart](https://auth-app-front.herokuapp.com/)
**Email:** test@test.com
**Password:** password

## Github Repos
**Front-end:** [React](https://github.com/MA-Ahmad/auth-app)
**Back-end:** [Repo](https://github.com/MA-Ahmad/auth-app-backend)

## Show your support

Give a ⭐️ on Github if you like this project!