teleren/devto huggingface dataset:
Microtasks
Published: 2021-05-15 16:52:05

Event Loop is used to perform asynchronous function in JavaScript. Event Loop monitors message queue and the execution stack to make sure that the callback functions are executed just after the execution stack gets empty. The callback functions are divided into macro-tasks and micro-tasks.
We will see the execution of microtask in the blog.

###How is microtask executed?
Event Loop has a task queue also called macro-task. Once the callback in the message queue starts executing, it executes one macro-task first. When the macro-task gets executed then it goes to execute the micro-task queue. During the execution of the micro-task queue, if any additional microtasks gets added to the end of the queue then it is also executed at that same execution. Once the micro-task gets empty, it starts executing the macro-task queue.
<img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2aefeebf5fe641258f65ce5fb02f0d8d~tplv-k3u1fbpfcp-zoom-1.image" />


#####Problems with Micro-task
It might happen that the micro-task keep queuing more micro-tasks and get stuck in an infinite loop. Render is also blocked during the execution of the micro-task queue. So if infinite loop is created or execution of microtask is taking too long, then the page will become unresponsive.  

To avoid this, JS limits the  simultaneous number of micro-tasks execution to 1000. This means that after 1000 micro-tasks, it has to pick up a macro-task and after the execution get back to the micro-task queue.

###Promise callbacks as Micro-task
Promise callbacks should be queued as micro-task. This is because if we queue promise callbacks as macro-tasks then it may lead to performance problems, as callback may be unnecessarily be delayed by task-related thing such as rendering. It also causes *non-determinism* due to interaction with other task sources, and can break interactions with APIs.

###Conclusion
 We discussed about the execution of micro-task and the merits and demerits related to it.
Laravel php artisan inspire command
Tags: laravel, artisan, webdev
Published: 2021-05-15 17:16:54

Hello Friend !

in this short tutorial we will see Laravel unique command which will inspire you. each time when you run

```
php artisan inspire
```

this command you got motivational and  inspirational quote. let see [Read more...] (https://larainfo.com/blogs/laravel-php-artisan-inspire-command-that-can-inspire-you)
Random cheat sheet for IOS-Developer
Tags: ios, swift, uikit, cheatsheet
Published: 2021-05-15 17:15:53

### Access Control
Access modifiers serve not only to encapsulate our code. But they can also speed up the runtime of our application. These modifiers are `private` and `final`. The `final` I use for all classes.
[More information here](https://developer.apple.com/swift/blog/?id=27)

### Structure
Try to use structures instead of classes. Because structures are more secure ([passing by value, not by reference](https://developer.apple.com/swift/blog/?id=10)) and structures are stored in a `stack`, which is much faster to access than the `heap` (where our objects are stored). Also, because the structure is stored in a `stack`, it does not increase the `ARC` counter.

### Clousure
**Non-escaping**
1. Better optimized
2. Do not increase ARC counter

**Escaping**
1. When you assign clousure become escaping
2. Require `self` to capture context

### Exception
Swift has no exceptions like other languages, the only exceptions left are in Objective-C, the main reasons are unstable operation, horrible performance and memory leaks

### Layout and AutoLayout
Layout - responsible for placing the view on the screen, and also serves as a process for calculating the frame.
AutoLayout - Almost the same, but the calculation process is automatic.


How often do you crash because of AutoLayout? And memory problems? And a console full of AutoLayout errors?

These are the main reasons why auto layout is evil, but unfortunately it is very common, but nevertheless try to use the normal Layout.

But please do not mix both in one project :)

### UIView responsibility
1. Display.
2. Animations.
3. Layout and AutoLayout.
4. UIResponder.
5. Hierarchy views

### CALayer
The two items in the UIView's area of responsibility are handled by CALayer. The main reasons for using it: 
1. Optimizing
2. Caching
3. Using GPU

### UIResponder
Handler of any user input in the UIKit application
49 Days of Ruby: Day 49 -- Putting It All Together
Tags: ruby
Published: 2021-05-15 17:09:16

---
title: 49 Days of Ruby: Day 49 -- Putting It All Together
published: true
description: Join us on a 49 day learning journey through Ruby!
series: 49 Days of Ruby
tags: #ruby
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9m73qaetuse3nm3y3it8.png
---

**Welcome to day 49 of the 49 Days of Ruby! 🎉**

Today is the last day of your seven-week, forty-nine-day, journey through Ruby!

If you have made it this far you have learned quite a lot about how to get set up, creating methods, classes, pattern matching, testing, APIs, and a whole lot more.

However, you may have also realized there is still **a lot** more to learn. One of the most amazing things about software is the learning journey never ends.

Thank you for joining along in this ride these past seven weeks. I hope you enjoyed them! Keep on learning and sharing with others.

**Thank you for joining us on this 49-day journey! Continue the conversation on Twitter with the hashtag [#49daysofruby](https://twitter.com/hashtag/49daysofruby).**
Authenticating GitOps with U2F keys
Tags: github, fido, ssh, cryptography
Published: 2021-05-15 16:50:55

Alright let's clock in, it's 9:23 am.

I was excited last week to find out Github now supports SSH keys with FIDO or, err, Yubikeys (was it U2F keys?), anyways, [here's the official post](https://github.blog/2021-05-10-security-keys-supported-ssh-git-operations/).

I can't say I am a huge advocate, however I do use the keys quite a bit for my most critical stuff. 

I was introduced first to the standard by finding out about Google's Advanced Protection Program (more on that [here](https://landing.google.com/advancedprotection/)). On the other hand and from experience, I can say it's a very promising authentication factor.

----
### Back to business

According to Github, I just need to: 

- Run

```bash
ssh-keygen -t ecdsa-sk -C <email address>
```

(note on the `-sk` there: that seems to instruct OpenSSH we're using an external key; which is cool and seamless).

- Finish set up by plugging and touching the key thingie
- Add my public key to github
- Profit

Let's see if it's as easy as that!
Also by the way, I'm on MacOS 🤠

... 

Word or warning: You need OpenSSH 8.2 or newer to do this...

Got an error: `Key enrollment failed: invalid format.` Gonna try plugging the key... Works!

Exporting the key to github is easy too; just follow [this](https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account).

And then finally just trying to clone a random repo would confirm if that worked...

It worked!

![Screen Shot 2021-05-15 at 10.17.45](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jic6yq83nwuuslpoz2z7.png)
 
This is so easy I am astounded. Gonna tell my friends at work.

P.S. 
### This can be a big deal for security 
Imagine for example a company wanting to enforce SSH security protocols for users accessing their corporate networks, but then an engineer uses a weak passphrase or none at all for their key. 

Compromising that single private key can turn out into a raging fire inside the company. With this, your private key never exits the physical USB drive, that's the reason it's so cool!

Anyways, clocking out; it's 10:21am and I even got a chance to take a snap of my FIDO key for the cover image. Sweet. Now back to Kingdom Hearts.

P.S. 2
^ Re Cover Picture: Bet most your friends would be scared to share a pic of their private key, hah.


See you next time.
Create Huge Amount of Mock Data from Schema Without Writing a Single Line of Code
Tags: fakerjs, mockdata, api, javascript
Published: 2021-05-15 16:28:02

Faker.JS is a great tool for creating mock data, and it serves the purpose. However, to create a structured dataset you need to write too much code, and sometimes it gets boring. This is why I have created [this project](https://github.com/hasinhayder/fake-data-generator-from-schema) that can automate the mock-data creation process without you writing a single line of code. It was actually created for my personal projects and then I thought that it can add value to many other projects, especially those in need of mock data, and save a lot of time for everyone. Let me show you why this project is a necessary one in your toolkit and how it can be used in this short video tutorial.

Did I tell you that this software is really fast? It can create 1 million records in less than 15 seconds in most cases.  

{% youtube 40cfvvrvmJg %}

you can even use **auto increment values** in your schema, just like this one 

```js
//schema.mjs
export default {
  // random 20 people with autoincrement id
  output:'./output.json',
  total:20,
  structure:{
    id:'autoIncrement',
    firstName: 'maleFirstName',
    lastName: 'maleLastName',
    email:'emailFromDomain,firstName,lastName,test.com',
    fullName:'joinerSpace,firstName,lastName',
  }
}

```

The github repository is located at https://github.com/hasinhayder/fake-data-generator-from-schema where you can find some example schemas in the `example-schemas` directory. 

Pull requests, feature suggestions and issues are very welcome.
How To Capture More than Group When Using BigQuery Regex
Tags: sql, bigquery
Published: 2021-05-15 16:21:07

I have been working on a particular task that required me to extract dates from a pool of text that was stored Big query. Trust me when I say that the data was quite messy and every date format you can imagine was in attendance.

Hence I got to work. Went through the big query docs and the function that was more suitable for my task was  `REGEXP_EXTRACT`. How it was supposed to work was that I would specify the date format I wanted to extract in the regex function and it would extract it for me.
Something like this:

`SELECT REGEXP_EXTRACT('210118164541-1/18/2021',r"(0[1-9]|1[0-2])(/)(0[1-9]|[12]\d|30|31)(/)(\d{4})")`

In this case, the date was `1/18/2021` and the job of the regex function was to extract the date.

The issue I encountered was that the `regex_extract` function doesn't work with more than one capturing group. What I mean by capturing group is mainly due to the fact that I could not predict the date format in the data and each part of the date needed a different capturing group. Something like 
`DD/MM/YY or MM/DD/YY`
 
Unfortunately, the regex extract function only accepted one capturing group. 

Citing that `Regular expressions passed into extraction functions must not have more than 1 capturing group`


Did so some google and Stackoverflow searches before was able to figure out a solution. 

The solution was that since `REGEXP_EXTRACT` only takes one capturing group you had to make the other groups non-capturing using `?:`. This allows the function to capture more than one group.

The code below shows this in practice.

`SELECT REGEXP_EXTRACT('210118164541-1/18/2021',r"(?:0[1-9]|[12]\d|30|31)(?:.)(?:0[1-9]|1[0-2])(?:/)(?:\d{4}|\d{2}")`

The code above would perfectly extract the date `1/18/2021` as needed.

In conclusion, if you ever encounter a task that requires you to extract more than one capturing group using regex on BigQuery remember that you have to make the other groups non-capturing using the `?:` notation and you are good to go.
Usage Limit CI/CD from Popular Platform
Tags: cicdtools, cicdplatform, cicdpipeline
Published: 2021-05-15 16:33:23

---
title: Usage Limit CI/CD from Popular Platform
published: true
date: 2021-05-15 16:14:32 UTC
tags: cicdtools,cicdplatform,cicdpipeline,cicdpipeline
canonical_url: https://berviantoleo.medium.com/usage-limit-ci-cd-from-popular-platform-cbe1aeee856c
---

This one is just want to compare the limitation.

> The limit maybe changes in the next year, next month, or next day. So this is only valid for limited time. This limitation report take when **May 15th, 2021**.

This comparison only for the free usage. If you want more, you can check the price for each platform.

#### Gitlab

Limit:

- **2000** minutes (per account — individual project), or
- **400** minutes (per organization — organizational project)

![](https://cdn-images-1.medium.com/max/401/1*PNlP-tKq-bAigplWodvZKA.png)<figcaption>Gitlab — Organization</figcaption>

![](https://cdn-images-1.medium.com/max/256/1*b36pAjkBqz2dMERaJJapzg.png)<figcaption>Gitlab — Individual</figcaption>

#### Bitbucket

Limit:

- 50 minutes

![](https://cdn-images-1.medium.com/max/470/1*bvjFAL2Hrs4ZcHMfRVZ4lw.png)<figcaption>Bitbucket Pipeline — Free</figcaption>

#### Travis

Limit:

- 10000 credits (I’m not sure how they count this, seems build minutes \* [times] 10) — about 1000 minutes
- But the credit count also depend on OS (operating system) that you use.

![](https://cdn-images-1.medium.com/max/685/1*nISkKh1PgQ9kEJYFIFW7_g.png)<figcaption>Example Usage</figcaption>

![](https://cdn-images-1.medium.com/max/904/1*Jzn69a-822PpwWRcI1EEZA.png)<figcaption>Deduction Explanation</figcaption>

**Github**

Limit:

- Free/No Limit (Public Repository)
- **2000 minutes** (Private Repository)

![](https://cdn-images-1.medium.com/max/775/1*1Vd8ngwuRwa5eS8gcj6LRA.png)<figcaption>Github Action — Price</figcaption>

#### Azure Pipelines

Limit:

- Free — Public projects
- 1800 minutes — Private projects

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

### Summary

I prefer to use Github Action for now (public and private projects). I’m not sure how long they can provide that free (not limit) for the public repositories. I also ever tried Gitlab CI before Github Action with free limit, but now (Gitlab CI) have some limitation, I understand we can’t too much hope have free build pipeline time. :)

This is my ranking:

1. Github Action
2. Azure Pipelines
3. Gitlab CI/CD
4. Travis CI
5. Bitbucket Pipeline

Because I’m the explorer and limited resources, those public CI/CD platform are really helpful! I’m not compare with the UI/UX things, it will be complex.

![](https://cdn-images-1.medium.com/max/1024/0*OGsC4s9jUnHrK8UX)<figcaption>Photo by <a href="https://unsplash.com/@etiennegirardet?utm_source=medium&amp;utm_medium=referral">Etienne Girardet</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Thank you for reading. How about you? Which platform do you recommend? Let’s share!
Specifying MySQL Index Size in Laravel
Tags: laravel, indexing
Published: 2021-05-15 18:15:04

---
title: Specifying MySQL Index Size in Laravel
published: true
date: 2021-05-15 16:06:23 UTC
tags: laravel,indexing
canonical_url: https://adithya.dev/specifying-mysql-index-size-in-laravel/
---

 ![Specifying MySQL Index Size in Laravel](https://adithya.dev/content/images/2021/05/carbon--1-.png)

When writing migrations, if you've come across an error `specified key was too long; max key length is 3072 bytes`, this might help you as it did when I faced this issue on my [job board](https://arbeitnow.com/).

Laravel's Blueprint $table accepts a raw statement, so you can define it this way

```
Schema::table('table_name', function (Blueprint $table) {
    $table->index([DB::raw('field_name(50)')], 'index_name');
});
```

`index_name` is optional as Laravel neatly prefixes table name to field name, so it becomes `table_name_field_name`

As to why this error occurs and finding the ideal index size, this is a great answer on [Stackoverflow](https://stackoverflow.com/a/8747703)
Using Serverless Framework building Simple AWS Infrastructure
Tags: serverless, framework, aws, cloudformation
Published: 2021-05-15 15:23:47

# Serverless Framework
Serverless is the first framework developed for building applications on AWS Lambda, a serverless computing platform provided by Amazon as a part of Amazon Web Services. Currently, applications developed with Serverless can be deployed to other function as a service provider, including Microsoft Azure with Azure Functions, IBM Bluemix with IBM Cloud Functions based on Apache OpenWhisk, Google Cloud using Google Cloud Functions, Oracle Cloud using Oracle Fn, Kubeless based on Kubernetes, Spotinst and Webtask by Auth0.
Frontend Developer needed
Tags: reactnative, ios, android
Published: 2021-05-15 15:14:40

My name is Trevis Craig. I am one of the co-founders and CEO of PluggNation. We are based in Queens NY currently working on putting our first app out called PLUGG. The app is a location- based mobile application that not only connects you to bars, lounges, and special events throughout your city.

Right now I am currently looking for a frontend mobile developer with proven skills in cross platform technologies such as React Native, Flutter, or Ionic Framework. Specifically we will be using React Native to build out the PLUGG app. In addition to those skills the developer would have to be skilled in Oauth, Oauth2 consumption of restful apis, security, IOS, Android, HTML, JavaScript, Angular and general knowledge of http.”
We currently have a backend developer and a lead designer. A lot of the backend and designs for the app is complete.

If anyone is interested please contact me at trevis.craig22@gmail.com
Power of super in Java
Tags: java
Published: 2021-05-15 15:13:16

# Java
Java is a High Level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

# Inheritance
In object-oriented programming, inheritance is the mechanism of basing an object or class upon another object or class, retaining similar implementation. Also defined as deriving new classes from existing ones such as super class or base class and then forming them into a hierarchy of classes. 

# Subclass and Superclass
In Java, it is possible to inherit attributes and methods from one class to another. We group the "inheritance concept" into two categories:

- subclass (child) - the class that inherits from another class
- superclass (parent) - the class being inherited from
To inherit from a class, use the extends keyword.

# `super` keyword
The super keyword refers to `superclass` (parent) objects. It is used to call `superclass` methods, and to access the `superclass` constructor. The most common use of the super keyword is to eliminate the confusion between `superclasses` and `subclasses` that have methods with the same name.

# Uses
Suppose you have a class `A` which  have a member `int top`. You have another class `B` which inherits `A` and it also has a member `top`. Now, if you are initiating an instance of `B` and you want to get the `top` member of `A` from `B` instance. Do you think you can get this without `super`?

Let's see:
```java
class A{
	int a;
	int top=90;
	A(int a){
		this.a = a;
	}
}
class B extends A{
	int b;
	int top = 40;
	B(int a, int b){
		super(a);
		this.b = b;
	}
}
```

You have the class `A` and `B`. Let's create an object.
```java
B obj = new B(4,5);

obj.a // 4
obj.b // 5
obj.top // 40
```
Now, you want to get the `top` member of `A`. For this you need to use `super` keyword. 

> Modify B as needed

```java
class B extends A{
	int b;
	int top = 40;
	B(int a, int b){
		super(a);
		this.b = b;
	}
	
	int getATop() {
		return super.top;
	}
}
```

Call the member:
```java
B obj = new B(4,5);
obj.top // 40
obj.getATop() // 90
```

# Note
- `super` can access members from any level of hierarchy
- if inside hierarchy any member or method overriden by any class, then calling super will get the member or method from the class just one level up.

# Thanku
Mongoose Unique Not Working
Tags: monogdb, mongoose, node, database
Published: 2021-05-15 15:07:18

You have a user schema and you want the email field to be unique

```js
import { Schema } from 'mongoose';

const userSchema = new Schema({
    password: { type: String, required: true },
    email: { type: String, required: true, unique: true },
});

export default user schema;
```

but it doesn't work! , here are some reasons because which this wouldn't work

## 1. Duplicate documents already created in DB before defining this property

You might have already added some duplicate data in the database so mongoose and MongoDB simply doesn't check unique field because it's already messed up

Delete the messed data from the MongoDB collections page to solve it

## 2. Auto Indexing or Create index is false

If you wouldn't have specified to auto index the data
which means to check for uniqueness, mongoose wouldn't do that

Simply make them to true while connecting to the database

```js
mongoose
    .connect('connection url', {
        useUnifiedTopology: true,
        useNewUrlParser: true,
        useCreateIndex: true, //make this true
        autoIndex: true, //make this also true
    })
    .then(() => {
        console.log('Connected to mongoDB');
    });
```

Thanks for reading, hearts ❤️ , and unicorns 🦄 if you liked it, follow if you loved it
Amazing Button Hover Using HTML & CSS
Tags: html, css, webdev, beginners
Published: 2021-05-15 15:07:10

Hello Guys,

Today I created a Glowing Button Hover Effect Using HTML & CSS. this hover effect is simple but it looks amazing. I hope you like this also comments about your thoughts.

For more content follow me on Instagram  [@developer_nikhil27](https://www.instagram.com/developer_nikhil27/).

Thank you!

{% codepen https://codepen.io/NikhilBobade/pen/vYxKLaP %}
PatchNote du 15/05/2021
Tags: celestiam, news, minecraft, french
Published: 2021-05-15 14:50:02

Cela risque de faire des heureux:




- Avoir une durabilité inférieur à ~250 sur l'armure protège autant qu'en avoir ~800. En clair vous n'avez plus à craindre le fait d'avoir une durabilité basse, vous ne mourrez plus en 2 coups juste parce que votre casque à 150 de durabilité.
- Diminution des dégâts de toutes les épées, mais aussi de la résistance des armures (0.5 -1 cœur par coup en force 2). 
- Mélange entre pvp drop et pvp broke

Vous pouvez déjà venir sur le serveur pour constater ce changement. D'autres équilibrages sur les dégâts des épées et sur les résistances des armures pourront être mis en place
A boilerplate for node TS packages
Tags: npm, typescript, node, github
Published: 2021-05-15 14:37:11

I make use of NPM packages extensively since they provide a convenient and nice way to encapsulate modules and manage versions independently from the rest of the codebase.

However, I found myself copying code from other repo over and over to get to an acceptable boilerplate. So I decided to write a github templates so I could create a new package in a matter of seconds (at least get a decent boilerplate).

It is available here: https://github.com/Nexysweb/boilerplate-node-package

I would love feedbacks or contributions
WEM widgets
Tags: wem, nocode
Published: 2021-05-15 14:16:25

---
title: WEM widgets
published: true
description: WEM is a no-code application development platform. Asked to work on widgets for a client, I entered the ecosystem.
tags: wem, nocode

---

WEM is a no-code application development platform. Asked to work on widgets for a client, I entered the ecosystem.

Conditionals in WEMscript that I wrote (with CSS):

`<? if (@A > @B) then ?>transform: rotateY(180deg);<? end ?>`

Using MacOS with a Chrome browser, the most annoying thing I encountered was not being able to confidently cut/copy/paste (these) code snippets inside the WEM V3 widget editor. Which meant all characters had to be typed in manually! Tip: use another browser.


References:
- Video training to build your first application (go to: Training): <https://my.wem.io/>
- Documentation for understanding Widgets: <https://wem.io/documentation/reference/wemscript>
- Examples: <https://widgets.live.wem.io/>
- Forum: <https://my.wem.io/forum?categoryid=15>