teleren/devto huggingface dataset:
Youtube: Recreational coding channel
Tags: javascript, codenewbie, beginners, programming
Published: 2022-11-15 04:57:49

Hi all,

I want to present you my recreational coding youtube channel.
It contains videos about JavaScript w/p5.js in an online coding environment.

Until now I uploaded an almost complete javascript course and some coding projects.

(link at the bottom)


![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lr6rwa903518rgz75no.jpg)

For instance, these are the lessons in the coding course:

1/24: Introduction to coding
2/24: Drawing shapes on canvas using p5.js in codeguppy
3/24: Named colors | Draw with code project
4/24: RGB colors
5/24: Exploring built-in assets | Greeting card with code
6/24: Variables, Expressions and Operators
7/24: For loops
8/24: Nested for loops
9/24: Conditional statements and boolean variables
10/24: Functions and scope of variables | Pi day projects
11/24: Animations on the canvas | Fun projects
12/24: Keyboard and Mouse | Mini game projects
13/24: Arrays in JavaScript | Practical examples
14/24: Strings in JavaScript | Caesar cipher
15/24: Objects in JavaScript
16/24: Make games with sprites
17/24: Makes games with custom sprites
18/24: Music in abc notation
19/24: while loops | Bubble sort
20/24: Functions as data | Arrow functions
21/24: Functions inside objects
22/24: JavaScript Closures
23/24: JavaScript Classes. Basics
24/24: JavaScript Classes. OOP Inheritance

🎥 You can find all the lessons in this YouTube playlist:

https://www.youtube.com/playlist?list=PLZld0zbNGbZRfjut6JI7ZLx8ZbTDa5zn-


In addition, I also uploaded a few coding projects using same language and coding environment. These are fun projects.

🎥 You can find the projects in this other YouTube playlist:

https://www.youtube.com/playlist?list=PLZld0zbNGbZSLmJhOam5QRKn7xGHgK0c0


I hope you like it. Make sure to explore the channel to discover other videos that you may like.
TILT: Things I learned Today
Published: 2022-11-15 03:46:02

Worked on photogram Sign in and learned:

ActiveRecord and Creating (or removing) a table column:

- First you need to put a migration file in the console:

- rails g migration AddPasswordDigestToUsers. This creates a correctly-named file in DB migration folder with a Class and Method

- In the migrate/#####_add_password_digest_to_users.rb folder we add instructions to construct database:
	add_column :users, :password_digest, :string
	      (table name), (table column), (data type)

- In the console we type rails db:migrate command to run the unrun database and add the password_digest column to the User Model. 

- In User.rb folder we make a declaration called has_secure_password in our ActiveRecord<ActiveRecord Model. has_secure_password #When we put in this declaration, it makes sure the password is there AND it matches the password confirmation. #We are able to assign .password and .password_confirmation even when they're not colums in the table - that's because has_secure_password is doing attr_accessor:password and attr_accesor:password_confirmation and it stores both in there for us. 


- The Gem file holds a list of libraries that the application is dependent on - including Rails.
Gem = Ruby’s lines of code borrowed from others. 
	The Gem bcrypt and the has_secrure_password Method in Users Models it will define password and .password attributes and secures it. 

- Layouts/aplication.html.erb file houses markup that we want to appear on every single page. We put our render pages in there.
Dropbox.com landing page clone using NextJS, TpeScript and TailwindCSS
Tags: nextjs, tailwindcss, typescript
Published: 2022-11-15 03:36:41

Hi guys, I recreated dropbox.com landing page using NextJS, TypeScript and TailwindCSS. Here is the [source code](https://github.com/peteregbujie/dropbox.com_landing_page) and [demo](https://dropbox-landing-page-clone.vercel.app/). Feedback is welcome.
![Screenshot](https://user-images.githubusercontent.com/14050333/200680158-6461bbc8-fa30-4572-ac06-27e3e96e7b71.png)
Polymorphism in Golang
Tags: go
Published: 2022-11-15 02:59:31

1.


```
package main

import "fmt"

//creating class
type PersonClass struct {
	name  string
	age   string
	color string
}

//person one have class properties and function
type Person1 interface {
	Walking() string
	Runnig() string
}

//person two have class properties and Person1 function and extra function
type Person2 interface {
	Person1
	Sleping() string
	Dringking() string
}

//
//person tree have class properties and Person1 function and Person2 ,extra function
type Person3 interface {
	Person2
	Learing() string
}

func (p PersonClass) Walking() string {
	return "walking :" + p.name
}
func (p PersonClass) Runnig() string {
	return "runnig :" + p.name
}

func (p PersonClass) Sleping() string {
	return "Im sleping :" + p.name
}
func (p PersonClass) Dringking() string {
	return "Im drinking :" + p.name
}

func (p PersonClass) Learing() string {
	return "Learing :" + p.name
}

func main() {

	w := []Person1{
		PersonClass{"mr.Boom", "24", "Oraange"},
	}

	x := []Person2{
		PersonClass{"mr.Hello", "22", "brown"},
	}
	p := []Person3{
		PersonClass{"mr.kk", "21", "red"},
	}
	fmt.Println("Person 1")
	for _, v := range w {
		fmt.Println(v.Runnig(), v.Walking())
	}
	fmt.Println("Person 2")

	for _, v := range x {
		fmt.Println(v.Dringking(), v.Runnig(), v.Sleping(), v.Walking())
	}
	fmt.Println("Person 3")
	for _, v := range p {
		fmt.Println(v.Walking(), v.Runnig(), v.Dringking(), v.Sleping(), v.Learing())
	}
}

```
Making sure izyum is fresh
Tags: opensource
Published: 2022-11-15 01:47:56

## Overview
This week's objective was to set up a unit test environment for [izyum](https://github.com/Myrfion/izyum) and write some unit tests in order to cover core functionality.

## Testing engine 
Two testing engines are usually used for testing purposes in the ECMAScript world which are [jest](https://jestjs.io/) and [mocha](https://mochajs.org/). I had previous experience with both of them and to be honest I don't see big differences between them on the basic level. I decided to go with it just because it is more popular and I did use it with typescript before so I did know it had good types of support.

## Installation
The installation process was pretty straightforward and I just followed the official tutorial. On the top of basic jest package, I had to install some additional packages that provide typescript support. I faced a minor issue trying to run the first test, but StackOverflow as always came in handy and I just had to add a small [config](https://github.com/Myrfion/izyum/blob/main/jest.config.json) which helped me to resolve this issue.

## Writing tests
I decided to write tests for my [generated-file](https://github.com/Myrfion/izyum/blob/main/__tests__/generated-file.spec.ts) module where all my "core" functionality was. The code there wasn't structured where good so I change the business logic a little bit. For example, before the module was provided with a file path and was fetching the file from the file system itself but after some refactoring, I extracted that functionality out of the module and now it just consumes the input string. Some tests that I wrote were to test conversion from txt input and MD input which is the main thing app does. 

## Watch mode
The good thing jest has out-of-the-box is the "watch" functionality. So if you run tests with a command like `jest --watchAll` your tests would be rerun every time your change something, which is extremely useful, especially when you do some sort of TDD. So I ended up adding it as a command to package.json.

## Coverage
Another thing that jest has is a coverage report. It shows how many lines of code are covered by tests and it provides a good idea about the weak spots of tests and some scenarios that are not covered. Users can get the coverage report by running `npm run coverage`. 

## CONTRIBUTING.md
I updated the [CONTRIBUTING.md](https://github.com/Myrfion/izyum/blob/main/CONTRIBUTING.md) with new testing functionalities that I introduced in these updates, where I described how to use all new commands. 

## Conclusion
When I was done I squashed all commit and [rebased](https://github.com/Myrfion/izyum/commit/cf78d84ee794f33844e4e3d9d66b08c6fe2cceaa) to the main. Overall, I enjoyed doing it and extending the environment of my project with some nice unit testing possibilities.
PayPal Developer - November 15th San Jose CA
Published: 2022-11-15 01:29:09

PayPal is hosting a free meetup in person at the PayPal campus in San Jose, CA. This is a face-to-face event, and no live stream will be available.

We look forward to discussing your favorite developer topics with some of our talent at PayPal. In this session, you’ll connect with PayPal’s Developer Relations, Engineering, and leadership teams.

Please register [here](https://www.meetup.com/paypal-developer-community/events/288827257/).
Using Github Actions to automate my tests
Tags: github, actions
Published: 2022-11-15 01:12:55

This week I improved my SSG by using Github Actions. I added a script that automatically runs my tests so I can test if my main features still work after adding things to my code. After that, I added tests to Tong's SSG [SSGifier](https://github.com/liutng/SSGifier) so I can help test his Github actions script

# What I did to my Repo

[d8b2df5](https://github.com/P-DR0ZD/pdrozd-ssg/commit/d8b2df5abb8a940eef4b06a7c1d3886b5af07165)

First I added a .yml script that runs my script on Github actions every time I run my script.

[97a8be4](https://github.com/P-DR0ZD/pdrozd-ssg/commit/97a8be4280b76a6ff4d116162a13135d54223e4a)

Then I added a new test to test my script. Afterwards, I broke it and then fixed it to see if it works.

# What I did to Tong's Repo

[8c581ff](https://github.com/liutng/SSGifier/commit/8c581ff8d515cbab6b02e2c64502b23a34d32e8d#diff-077859f67c621cec7f31993d28e1256ef4f4a5de81968c69cb63c7f7ce140fe9)

After reading Tongs contributing.MD file I set up my testing framework and started work on a new test. I decided to test to see if his markdown files were working properly.

# What I learned

Using Github actions allows for a lot of automation in things like testing and code formatting. It's good to use it because if someone is contributing you can focus on their things rather than the main features.
Python For Beginner Series|Day-12
Tags: python, programming, datascience, tutorial
Published: 2022-11-15 00:24:04

What is a Randomization?

- It is any sort of programming language really useful to create games or if we want to get the result randomly.
- Randomization helps to create computer programs that have a degree of unpredictability, especially in games
- In order to access the randomness in our program we can import the random module in the code
- By using a random module we can generate pseudo-random numbers for various aspects.

https://medium.com/p/b32cd872090f
Solve any data structures and algorithms problem instantly with AI
Tags: tooling, career, machinelearning
Published: 2022-11-14 23:58:42

I just built this [tool](https://leetdesign.com/tools/algo_solver?utm_source=devto&utm_medium=social) that solves any Data structures instantly leveraging AI

Check it out!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikkpeawc7pxw2e59ezpr.jpg)



I explained how I built it [here](https://twitter.com/DannyHabibs/status/1591189160257556480?s=20&t=_sAhbK6TR7TZpwawxMb8Bg)
Code Smell 179 - Known Bugs
Tags: webdev, javascript, beginners, programming
Published: 2022-11-14 23:39:56

*Every software has a list of known bugs. Why?*

> TL;DR: Don't track bugs. Fix them.

# Problems

- Hard to-track lists

- Technical Debt

- Functional Debt

# Solutions

0. Stop calling it a [Bug](https://dev.to/mcsee/stop-calling-them-bugs-57gl)

1. Reproduce the [Defect](https://dev.to/mcsee/stop-calling-them-bugs-57gl).

2. Cover the scenario with automation

3. Make the most straightforward fix (even hardcoding solutions)

4. Refactor

Welcome to TDD!

# Context

We don't like to be interrupted. 

Then, we create lists and delay fixes and solutions.

We should be able to change software easily.

We need to improve our software if we can't do quick fixes and corrections. 

Not by creating To-Fix lists.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/352ade4d98a059ed49e4312ae3bab44e)
```php
<?

function divide($numerator, $denominator) {
  return $numerator / $denominator;  
  // FIXME denominator value might be 0
  // TODO Rename function
}
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/d1323654df40648970e8058c0cbd55cc)
```php
<?

function integerDivide($numerator, $denominator) {
  if (denominator == 0) {
    throw new DivideByZero();
  }
  return $numerator / $denominator;  
}

// we pay our debts
```

# Detection

[X] Automatic 

We need to avoid creating bugs and issues.

# Tags

- Technical Debt

# Conclusion

We need to discourage bugs and issue trackers on the engineering side.

Of course, customers need to track their findings and we need to address them ASAP.

# Relations

{% post https://dev.to/mcsee/code-smell-148-todos-5gn9 %}

# More Info

[Famous Bugs](https://en.wikipedia.org/wiki/List_of_software_bugs)

{% post https://dev.to/mcsee/stop-calling-them-bugs-57gl %}

# Disclaimer

Code Smells are just my [opinion](https://dev.to/mcsee/i-wrote-more-than-90-articles-on-2021-here-is-what-i-learned-1n3a).

# Credits

Photo by [Justin Lauria](https://unsplash.com/@justinlauria) on [Unsplash](https://unsplash.com/s/photos/bug)
  
* * *

> In general, the longer you wait before fixing a bug, the costlier (in time and money) it is to fix.

_Joel Spolsky_

{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
How to search array of arrays with JavaScript?
Tags: javascript
Published: 2022-11-14 23:35:23

To search array of arrays with JavaScript, we use the array `some` and `every` methods.

For instance, we write

```
const ar = [
  [2, 6, 89, 45],
  [3, 566, 23, 79],
  [434, 677, 9, 23],
];

const val = [3, 566, 23, 79];

const bool = ar.some((arr) => {
  return arr.every((prop, index) => {
    return val[index] === prop;
  });
});
```

to call `some` with a callback that searches every element of the nested array to check if they're equal with `every`.

We call `every` with a callback that check the index of `arr` to see if it's equal to `prop` in the nested array.
How to remove item from array using its name / value with JavaScript?
Tags: javascript
Published: 2022-11-14 23:35:02

To remove item from array using its name / value with JavaScript, we use the `filter` method.

For instance, we write

```
const COUNTRY_ID = "AL";

countries.results = countries.results.filter((el) => {
  return el.id !== COUNTRY_ID;
});
```

to call `filter` with a callback to return an array within the `countries.results` array without the object with `id` not equal to `COUNTRY_ID`.
How to alert an array with JavaScript?
Tags: javascript
Published: 2022-11-14 23:34:08

To alert an array with JavaScript, we convert it to a string before calling `alert`.

For instance, we write

```
alert(JSON.stringify(aCustomers));
```

to call `JSON.stringify` to convert the `aCustomers` array to a JSON array string.

Then we call `alery` with the string to show an alert box with the array string.
How to find if object property exists in an array with Lodash and JavaScript?
Tags: javascript
Published: 2022-11-14 23:33:50

To find if object property exists in an array with Lodash and JavaScript, we use the `has` method.

For instance, we write

```
const countries = { country: { name: "France" } };
const isExist = _.has(countries, "country.name");
```

to call `has` with the `countries` object and the property to look for in each object.

Therefore, `isExist` is `true` since `country.name` is in the `countries` object.
How to move to prev/next element of an array with JavaScript?
Tags: javascript
Published: 2022-11-14 23:33:22

To move to prev/next element of an array with JavaScript, we can define our own array class.

For instance, we write

```
class TraversableArray extends Array {
  next() {
    return this[++this.current];
  }
}

```

to define the `TraversableArray` class that extends the `Array` class.

In it, we add the `next` method that returns the object at the `current` index after incrementing it by 1.
Working with DOM in a front end framework?
Tags: discuss, webdev, javascript
Published: 2022-11-14 23:12:08

Now I know this feels like an anti pattern, but when is it okay to use the DOM? I think it is okay to work in the DOM under the following circumstances:

- what your trying to achieve could be done with `data-‘ and you can’t find another way
- you need to select an element on the page by its location. ‘document. elementFromPoint(0,0);`
- any xpath query
- getting values from css variables into JS
- it significantly reduces complexity without reducing performance too 🎭

So am I wrong 😑?
Ninja Rules of Self-Identification
Tags: culture
Published: 2022-11-14 22:13:43

**A ninja does not self-identify as a ninja.**

<rant>
In our field, a lot of folks will call themselves "ninjas" or "10x devs" or "experts," but they're not always terribly correct in doing so.

The simple truth I have found is that if you _are_ in fact an expert, or a "ninja," (leaving aside the really problematic ideas of a 10x developer) others will tell you. There's no need for self-identification.

Accordingly, if someone does self-identify as a ninja, they probably aren't. A ninja does not self-identify as a ninja.
</rant>
Function to mask numbers and strings in PHP
Tags: php, mask
Published: 2022-11-14 22:05:01

```php

function mask (string $placeholder, string $value, string $char = '#'): string 
{
    $template = strtr($placeholder, [$char => '%s']);

    return sprintf($template, ...str_split($value));
}
```

## Explanation

The `$template` variable receives the value of `strtr` that replaces `#` to `%s`. The `%s` is a representation of string in `sprint` function.

For example, the string `'(##) ####-####'` will be replaced by `'(%s%s) %s%s%s%s-%s%s%s%s'`.

The `str_split` will transform the `$value` string in a array of characteres. In `sprintf`, the result of `str_split` call is applied as argument of `sprint` with `...` *Spread Operator*.

## Watch the video

{% embed https://www.youtube.com/watch?v=rpBpWFDB-eA %}
if/else
Tags: dart
Published: 2022-11-14 21:43:19

 

## - Na imagem abaixo:



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psud2kgajv5n2n45ubqd.png)

O if/else irá testar caso a condição seja verdadeira e executar uma determinada ação ou caso a mesma não seja, executar outra

Resultado:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ez0sawskbvjhj9dmddko.png)

**Obs: o Random() gera números inteiros aleatórios**
How to Connect and Manage MariaDB via MySQL WorkBench
Tags: mariadb, mysql, mysqlworkbench, database
Published: 2022-11-14 21:26:53

---
title: How to Connect and Manage MariaDB via MySQL WorkBench
published: true
description: Let's see if MySQL Workbench is a good choice for MariaDB.
tags: #mariadb #mysql #mysqlworkbench #databases 
# cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ex2a53batnrrqmz4uilg.png
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-14 21:19 +0000
---
MySQL Workbench is a very suitable tool for working with MySQL and is popular with experts. But when working with MariaDB, it may not be as good as one might expect. MariaDB, despite being similar to MySQL, requires a different approach in some aspects.
So let's discover what is the best MySQL Workbench alternative for MariaDB - https://codingsight.com/how-to-connect-mysql-workbench-to-mariadb-html/
Developing on AWS-Steps.
Published: 2022-11-14 21:20:10


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ntr17n2yea28dxrompsq.jpg)
To get started developing on AWS, you need the following:
**1. AWS Account**
Create an AWS account to provide you with  development environment, to start building your projects on AWS. AWS offers you a free account with tons of resources and services to practice with for the first 12 Months.
**2. IAM User with Permissions**
One of the AWS best practices, is not use Root User Account for daily routine because it has **complete access to all AWS services and resources in the account**, instead create an IAM users and grant only permissions needed. Therefore Create a developer account using AWS Identity and Access Management Service(IAM). 
Then with the developer (IAM user) account, set relevant permission and roles to AWS services and resources that you will need,  while developing on AWS.
**3. Install Development Environment**
Set up your Integrated development environment. You can use either Cloud9,or any other IDE supported by AWS i.e.MS Visual Studio, Eclipse, IntelliJ, MS Visual studio Code(VS Code), Pycharm etc.
Also install programming languages to be used and their Software Development Kits(SDK)s i.e. Boto3 SDK for Python Programming language. 

**4. Yay! you are good to go**
Finally after Creating an AWS account, creating an IAM user and defining their roles, installing and setting up IDEs and SDKS, you are good to get started developing on AWS. Yay!
Video: Show a user’s emails in an ASP.NET Core app using Microsoft Graph
Tags: aspnetcore, microsoftgraph, csharp, microsoftcloud
Published: 2022-11-14 21:08:46

---
title: Video: Show a user’s emails in an ASP.NET Core app using Microsoft Graph
published: true
tags: ASPNETCore,MicrosoftGraph,CSharp,MicrosoftCloud
canonical_url: https://blog.codewithdan.com/video-show-a-users-emails-in-an-asp-net-core-app-using-microsoft-graph
---

I’ve been working a lot with [.NET Core](https://dot.net) and [Microsoft Graph](https://aka.ms/ms-graph-docs) lately and decided to put together a short video based on a [Microsoft Learn module](https://aka.ms/learn-msgraph-email) covering how the technologies can be used together. If you haven’t used Microsoft Graph before, it provides a secure, unified API to access organizational data and intelligence (data stored in Microsoft 365 for example).   
  
So why would you ever want to access a signed in user’s emails and include them in your custom app? The simple answer is, “Bring organizational data where your users need it everyday!”. Instead of users switching from your app to find a relevant email, calendar event, Microsoft Teams chat (and more) by jumping between various productivity apps, you can pull that type of data directly into your custom app. This allows users to work more efficiently and make more informed decisions all while minimizing context shifts.

In this video I’ll introduce you to:

- The role of security in making Microsoft Graph calls.
- Microsoft Identity and Microsoft Graph Middleware configuration.
- The role of permissions/scopes and access tokens.
- The Microsoft Graph .NET Core SDK and how it can be used.
- How to create reusable classes that handle making Microsoft Graph calls.
- Dependency injection and how it can be used to access a GraphServiceClient object.
- How to retrieve a batch of email messages using the UserMessagesCollectionRequest class.

## Show a user’s emails in an ASP.NET Core app using Microsoft Graph

{% embed https://www.youtube.com/embed/acnFrkBL1kE?feature=oembed %}
MySQL Performance Tuning: Top 5 Tips for Blazing Fast Queries
Tags: mysql, database, dbforge
Published: 2022-11-14 20:45:44

---
title: MySQL Performance Tuning: Top 5 Tips for Blazing Fast Queries
published: true
description: The article will be useful if you have taken MySQL performance tuning as your goal.
tags: #mysql #database #dbforge
# cover_image: ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjk9uiqml8nnv82s80zr.png)
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-14 20:40 +0000
---
This article provides an introduction to MySQL database and query performance tuning. This is a beginner's guide because optimization is one big chapter in the official guide - https://www.hackread.com/mysql-performance-tuning-blazing-fast-queries/