teleren/devto huggingface dataset:
Consent Management with Auth0 Marketplace
Tags: marketplace, security, identity
Published: 2020-10-31 00:04:01

Let's look at some of the ways you can implement consent management in your application using the Auth0 Marketplace.
[Read more...](https://auth0.com/blog/consent-management-with-auth0-marketplace/?utm_source=content_synd&utm_medium=sc&utm_campaign=auth0_maketplace)
How to send a message from the cluster master process to the worker process in Node.js?
Tags: node
Published: 2020-10-31 00:00:00

---
  title: How to send a message from the cluster master process to the worker process in Node.js?
  published: true
  tags: Nodejs
  date: Sat Oct 31 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/sent-message-from-master-to-worker-process-nodejs
  cover_image: https://melvingeorge.me/_next/static/images/main-3e7c933ed06b485d88598a4e69160aaa.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/sent-message-from-master-to-worker-process-nodejs)
  
### This blog is related to a previous blog called [How to run the Node.js server on every CPU core?](https://melvingeorge.me/blog/run-nodejs-server-on-every-cpu-core). Go check that out first if you want to learn more about the `Master and Worker process`.

To send a message from a `master` process to the `worker` process, you can use the `send()` method on the `worker` process object.

Let's say we forked a worker process like this,

```js
if (cluster.isMaster) {
  // This block of code is where the master process lives

  // fork a single worker
  const worker = cluster.fork();
} else {
  // This block of code is where worker process lives
}
```

Now let's use the `send()` method to send a message to the forked worker.

```js
if (cluster.isMaster) {
  // This block of code is where the master process lives

  // fork a single worker
  const worker = cluster.fork();

  // send a messsage from master process
  // to the wroker process
  worker.send({ data: "Hi Worker!" });
} else {
  // This block of code is where worker process lives
}
```

Now to receive the message in the `worker` process, we have to listen for any messages from the `master` process.

This can be done using the `message` event on the `process` object like this,

```js
if (cluster.isMaster) {
  // This block of code is where the master process lives

  // fork a single worker
  const worker = cluster.fork();

  // send a messsage from master process
  // to the wroker process
  worker.send({ data: "Hi Worker!" });
} else {
  // This block of code is where the worker process lives
  process.on("message", (msg) => {});
}
```

Inside the `msg` object, you can check for the `data` property where the message is located.

```js
if (cluster.isMaster) {
  // This block of code is where the master process lives

  // fork a single worker
  const worker = cluster.fork();

  // send a messsage from master process
  // to the wroker process
  worker.send({ data: "Hi Worker!" });
} else {
  // This block of code is where the worker process lives
  process.on("message", (msg) => {
    // check for data property
    // on msg object
    if (msg.data) {
      console.log(`Message received to worker from master: ${msg.data}`);
    }
  });
}
```

We have successfully passed our message from the `master` process to the `worker` process 🔥.

### Feel free to share if you found this useful 😃.

---
How I solve weird CLS issue: more than 0.25
Tags: seo
Published: 2023-04-03 15:30:58

---
title: How I solve weird CLS issue: more than 0.25
published: true
date: 2020-10-31 00:00:00 UTC
tags: seo
canonical_url: https://kevinhq.com/how-i-solve-weird-cls-issue-more-than-0.25/
---

If you don’t know, CLS is one of the main factors in SE now. It stands for Cumulative Layout Shift. Google on web.dev has explained it in detail. But, even following all the guidelines, the CLS score is still nearly 1. How I solve this weird CLS problem? Let’s inspect them one by one. Images without dimensions The page has no images. So, this doesn’t apply at all. I have checked the Network tab on the Chrome dev console.
`rbenv install -l`. How can I update it?
Published: 2020-10-30 23:11:17

---
title: `rbenv install -l`. How can I update it?
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

## 1. if you use the Homebrew

```sh
brew update
brew upgrade ruby-build
```

## 2. if you use rbenv plugin

```sh
cd ~/.rbenv/plugins/ruby-build
git pull origin master
ruby-build --version
```
Hacktoberfest 2020: My Progress and Contributions
Tags: hacktoberfest, opensource, github
Published: 2020-10-30 23:10:38

### Introduction:

Hacktoberfest is an annual event that encourages developers to contribute to open source projects. This year, I decided to participate in Hacktoberfest for the second time and share my progress and contributions in this article.


### Progress

I'm still in progress, but I'm working hard to complete my Hacktoberfest goals. It's been a great opportunity for me to learn and contribute to new projects.


### Contributions

I have been focusing on contributing to HTML and Javascript projects, as these are technologies that I enjoy working with. However, I have also tried to branch out and explore new areas of open source development.


### Reflections

Hacktoberfest 2020 has been different from last year in a number of ways. One of the biggest changes has been the emphasis on quality over quantity. It's important to avoid spamming and focus on making meaningful contributions to open source projects. Overall, I'm excited to see what the rest of Hacktoberfest has in store and to continue learning and growing as a developer.
Using fetch in TypeScript with typestate pattern 
Tags: typescript, javascript, pattern, tutorial
Published: 2020-10-30 22:15:23

If You want to write generic class for server requests this post is for You.

I preffer code examples over the words and funny images, so You will not spend a lot of time here.

Let's define our allowed endpoints and constraints:
```typescript
const enum Endpoints {
    users = '/api/users', // GET | POST       
    notes = '/api/notes', //  POST | DELETE   
    entitlements = '/api/entitlements' // GET 
}
```
Let's assume that backend developer allowed You to make:
- `GET` | `POST` requests for `users`
- `POST` | `DELETE` requests for `notes`
- `GET` requests for `entitlements`

Now, we can also define allowed methods for each endpoint :
```typescript

interface HandleUsers {
    get<T>(url: Endpoints.users): Promise<T>;
    post(url: Endpoints.users): Promise<Response>;
}

interface HandleNotes {
    post(url: Endpoints.notes): Promise<Response>;
    delete(url: Endpoints.notes): Promise<Response>;
}

interface HandleEntitlements {
    get<T>(url: Endpoints.entitlements): Promise<T>;
}
```
Now, we can define our main class:
```typescript
class Api {
    get = <T = void>(url: Endpoints): Promise<T> => fetch(url)
    post = (url: Endpoints) => fetch(url, { method: 'POST' })
    delete = (url: Endpoints) => fetch(url, { method: 'DELETE' })
}
```
For now, `class Api` does not have any constraints.
So let's define them:
```typescript

// Just helper
type RequiredGeneric<T> = T extends void
    ? { __TYPE__ERROR__: 'Please provide generic parameter' }
    : T

interface HandleHttp {
    <T extends void>(): RequiredGeneric<T>
    <T extends Endpoints.users>(): HandleUsers;
    <T extends Endpoints.notes>(): HandleNotes;
    <T extends Endpoints.entitlements>(): HandleEntitlements;
}
```
As You see, `HandleHttp` is just overloading for function. Nothing special except the first line. I will come back to it later.

We have `class Api` and overloadings for function. How we can combine them? Very simple - we will just create a function which returns instance of `Api class`.

```typescript
const handleHttp: HandleHttp = <_ extends Endpoints>() => new Api();
```
Take a look on generic parameter of `httpHandler` and `HandleHttp` interface, there is a relation between them.

Let's test our result:
```typescript
const request1 = handleHttp<Endpoints.notes>() // only delete and post methods are allowed
const request2 = handleHttp<Endpoints.users>() // only get and post methods are allowed
const request3 = handleHttp<Endpoints.entitlements>() // only get method is allowed
```
Wait, what if I forgot to set generic parameter for `handleHttp`?
Trust me, this is not a problem :) Just hover the mouse on `request`. Now You, why I used `RequiredGeneric`

```typescript
const request = handleHttp() // 'Please provide generic parameter'
```
You will not able to call any method without generic parameter.
P.S. I believe I used here typestate pattern.

It is the end folks)
Using New Relic APM with Rails on AWS Lambda
Tags: serverless, aws, observability
Published: 2020-10-30 21:53:54

> ℹ️ 2021-07-06 - Updated code block with [LambdaPunch](https://dev.to/aws-heroes/asynchronous-background-processing-for-ruby-or-rails-using-aws-lambda-extensions-59bh) asynchronous background job processing.

Custom Ink has been using Rails for as long as the framework has been around. For many of those years we have used New Relic's awesome [Application Performance Monitoring (APM)](https://newrelic.com/products/application-monitoring) tool to observe and debug dozens of our critical services.

In the past I have have [shared on Twitter](https://twitter.com/metaskills/status/1280977542510501891) that that New Relic Ruby Agent did not work when using [Rails on AWS Lambda](https://lamby.custominktech.com). I think my assumption was based on how the agent's collector needed a daemon process on the server or was tightly coupled to certain web servers like Passenger and thus not compatible with Lamby's Rack adapter under API Gateway. 

Thankfully I was wrong! Here is how we got New Relic & Rails working this past week with [Lamby](https://lamby.custominktech.com).

1. Use the `NEWRELIC_LICENSE_KEY` environment variable. This will ensure that the RPM gem can assign it to the `license_key` config as needed during initialization. Ensure this is [present before Rails loads](https://lamby.custominktech.com/docs/environment_and_configuration#using-dotenv-rails).
2. Add the `log_file_path: STDOUT` to your config yaml file.
3. Optionally, ensure that New Relic flushes your data after each request.

When your Lambda experiences a cold start, the agent should log that it too is starting and using Rack and whatever instrumentation hooks it finds within your application. Here is an example of the `config/newrelic.yml` file.

```yaml
common: &default_settings
  app_name: MyAppName
  log_level: fatal
  log_file_path: STDOUT
  ssl: true

development:
  <<: *default_settings
  monitor_mode: false

test:
  <<: *default_settings
  monitor_mode: false

production:
  <<: *default_settings
```

Now add the [LambdaPunch](https://github.com/customink/lambda_punch) gem to your project and change the handler method to ensure data is flushed to New Relic after each request. LambdaPunch ensures this happens after your Rails application response is sent.

```ruby
def handler(event:, context:)
  Lamby.handler $app, event, context
ensure
  LambdaPunch.push { NewRelic::Agent.agent.flush_pipe_data }
end
```

Lastly, thanks so much to the New Relic team for always improving their products and providing an awesome service.
Day 246 : What It's Like
Tags: hiphop, code, coding, lifelongdev
Published: 2020-10-30 21:45:16

_liner notes_:
- Professional : Had a pretty good day. Mostly meetings. Sat in on a talk about Web Components that I saw someone post on Twitter. My new blog post went live today! Got invited towards the end of the day to play "Among Us" with coworkers. I've only seen it played on YouTube. Never knew what it's like to actually play. Pretty fun! haha Great way to end the week.

- Personal : Went through a bunch of tracks for this week's radio show. Think that was pretty much it. haha.

![A lake in Three Brothers, California with snow on the shore surrounded by a forest and cloud covered mountains in the distance](https://dev-to-uploads.s3.amazonaws.com/i/zv7hvy1ngcq60eo0z336.png)

Going to finish up the pre-show work for the radio show and maybe do some code on my side project. Think that's it.

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube h0-hCeObeJw %}
Rename column with laravel migration
Tags: laravel
Published: 2020-10-30 21:41:19

First of all, you need to install package `dbal`. 
```
composer require doctrine/dbal
```
When it's done, now you need to make one migration like this

```
php artisan make:migration rename_column_user_name_to_username_in_users_table --table=users
```
Now open that file inside `migrations` folder and start to modify it.

```php
public function up()
{
    Schema::table('users', function (Blueprint $table) {
        $table->renameColumn('user_name', 'username');
    });
}

public function down()
{
    Schema::table('users', function (Blueprint $table) {
        $table->renameColumn('user_name', 'username');
    });
}
```

Now you can migrate it `php artisan migrate`

And you're done.
🍦 VANILLA JS INFINITE SCROLL
Tags: javascript, html, css
Published: 2020-10-30 21:32:00

In this post I would like to share a codepen I created with an infinite scroll demo. For this demo I don’t use any library or framework – only vanilla JS, plain CSS and HTML. I wanted to spice up my demo, so I created an image masonry grid and a simple loader. The images grid gets populated with more images once you scroll down. So, there are some “unessential” elements to this demo, and when reading the code, I suggest focusing on the JS part of things.

The basic “plan” for the code is this:

1) Listen to a scrolling event

2) If the user scrolled all the way down (or your preferred scrolling distance), fetch more resources (images by  [picsum.photos](https://picsum.photos/)  in this case)

3) Append fetched resources to DOM

And here it is:

<iframe height="265" style="width: 1000px;" scrolling="no" title="🍦 VANILLA JS INFINITE SCROLL" src="https://codepen.io/yossi_abramov/embed/WNxzzEq?height=265&theme-id=light&default-tab=result" frameborder="no" loading="lazy" allowtransparency="true" allowfullscreen="true">
  See the Pen <a href='https://codepen.io/yossi_abramov/pen/WNxzzEq'>🍦 VANILLA JS INFINITE SCROLL</a> by Yossi Abramov
  (<a href='https://codepen.io/yossi_abramov'>@yossi_abramov</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>

✍ For more posts:
[https://yossiabramov.com/](https://yossiabramov.com/)
Likes System for Wordpress
Tags: wordpress, php, html, javascript
Published: 2020-10-30 21:26:12

Hi everyone, 

I want to present to you the WP plugin: Likes System for Wordpress.

This is an independent solution for your website, so that means it doesn't require you to connect anything with your social media profiles or with your apps on social media.

That is why I love to say: "INDEPENDENT SOLUTION", that can bring more fun to your website.

As you probably suppose and maybe have seen on the cover image, this plugin comes with social share buttons too.

I decided to add this feature to the plugin because it can bring more fun and interactions with your content.

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

More of that is that you're able to choose between four different styles or you can upload your own image if you want :)

I have to mention that you can use font awesome icons too.

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

One important thing that I want to mention is that you're able to add these buttons (Wordpress likes & social share) on your archive pages, category pages, custom list, etc.

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

Wordpress Likes System plugin support custom post types so you are not limited about that :)

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


I have to say that these features are very unique and it's very hard to find a plugin that can allow you to do all these things together.

We're not even close :)
I'm just kidding, but before the end, I want to say that this plugin (Likes system for Wordpress) is completely compatible with woocommerce.

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

I will share with you the short video where I explained about this plugin so you will get the point and all these features easier :)

https://www.youtube.com/watch?v=NI5vt7eoDJw

Final, if you ask me I would love to say that this plugin is:

 - Very easy to integrate and use
 - You will get more interactions with your visitors
 - Visitors don’t need to be registered, they can put a thumb up as guests
 - Custom post types are supported
 - Working with WooCommerce as well
 - Possibility to show on archive/category pages

Now it's time to show you where you can find Wordpress likes system plugin :)

**Free version**: https://wordpress.org/plugins/likes-and-share-system-free/

**PRO version**: https://conic-solutions.com/wp-plugins/likes-system/


**How it looks at the frontend, see below**:

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

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

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


**Free version**: https://wordpress.org/plugins/likes-and-share-system-free/

**PRO version**: https://conic-solutions.com/wp-plugins/likes-system/
VS Code Stories - New Extension
Tags: vscode, news, webdev
Published: 2020-10-30 21:14:03

_Do you ever just wake up in the morning, open up VS Code, and think to yourself "Wow I wonder what other coders are doing around the world, what are they coding on?"._

That's how Ben Awad starts his [video](https://www.youtube.com/watch?v=ApR-kNXxLUs) where he introduces VS Code stories, an extension for [Visual Studio Code](https://codepulse.blog/top-10-keyboard-shortcuts-for-visual-studio-code/) which adds stories to VS Code.

![vs code stories in action](https://dev-to-uploads.s3.amazonaws.com/i/tn2jz46zdvntx41fh3m8.png)

He literally created an extension for VS Code that you can use to view Instagram like stories and upload your own ones for others to see. I think this was just hilarious and at the same time super awesome!

If you haven't already, be sure to check out the extension and his [video](https://www.youtube.com/watch?v=ApR-kNXxLUs) introducing the extension, it is hilarious! All the code for the extension is [open source](https://github.com/benawad/vscode-stories).

That's all for now, I just wanted to share this with you guys because I think this was super funny and worth showcasing extension. 

Comment below what do you think about the stories for VS Code?
Week 5: Forem Hacktoberfest Twitch Events Recap
Tags: hacktoberfest, opensource, meta
Published: 2020-10-30 21:03:22

---
title: Week 5: Forem Hacktoberfest Twitch Events Recap
published: true
description: 
tags: hacktoberfest, opensource, meta
series: ThePracticalDev Twitch Events recap
---
This week, the Forem team wrapped up our Hacktoberfest streams on Twitch! Here is a recap of what we discussed...

## Monday Oct 26th: Gratitude Stream.
{% youtube MIPxVZwnbLA %}
[Nick Taylor]([https://dev.to/nickytonline](https://dev.to/nickytonline)) and [I](https://dev.to/coffeecraftcode) gave shoutouts to the DEV community members who contributed to Forem last week. We had over 15 PRs merged from 10 different folks 🥳
{% link https://dev.to/devteam/hacktoberfest-week-five-thank-you-to-our-contributors-on-forem-3l82 %}

We will have one more Hacktoberfest Gratitude stream next Monday. Be sure to check it out!

## Tuesday, Oct 27th: Forem and Raise.dev Hacktoberfest Helpdesk
{% youtube uu5-i1SUrZ4 %}
Nick Taylor and I took over the [raise.dev](https://raise.dev/) Hacktoberfest Helpdesk to talk about accessibility and No Mouse Fridays. This open issue would prevent developers at Forem from using their mouse on Fridays so that they can better understand how important keyboard accessibility is on the site.

## Friday, Oct 30th: Walkthrough Wednesday(Friday Edition) with Levi Sharpe.
{% youtube  h8VjCvhNsPo %}
Levi Sharpe, is a Senior Podcast Producer and Sound Designer at Forem.
Levi joined Nick Taylor and I to answer questions about podcasting and what he does as a podcast producer at Forem.

Thanks so much to all our viewers who joined the streams and chatted with us this week and the whole month of October! It was a blast connecting with you live in the name of open source 🎉 

As we wrap up Hacktoberfest, we will be transitioning to one or two streams a week for the next few months. I hope to see you there!

Keep an eye on [ThePracticalDev Twitch](https://www.twitch.tv/thepracticaldev) channel for our streaming schedule.
The Final PR... Face Palm Worthy. What a disaster!
Published: 2020-10-30 21:01:01

The Hactoberfest nightmare begins...First I tried to run this [dotnet/aspdotnetcore](https://github.com/dotnet/aspnetcore/issues/17840) but I could not because it was not able to read my versions of SDK.  I downloaded the correct version and still had the same issue.  My gut told me to talk to tech support but no not me, I like to do things the hard way.  So I get this idea to uninstall VS19 (Visual Studio 2019) and then re-install it after with needed software to open the project.  Unfortunately a file was corrupted and I was unable to uninstall the software despite repairing it.  Eventually I figured out that all I had to do was go into add/remove programs and choose to modify, then pick the version I want added to VS19.  Yep, I did that.  I had a back-up plan... in fact I had two.  I go to look at the first "back-up" issue to discover it had been closed.  Oh well, I will go to the second one.  Low and behold it was closed too.  Oh boy, now what?

Back to the [Hacktoberfest](https://hacktoberfest.digitalocean.com/) website and find something not C#, feeling a little defeated.  I found something.  [opendrinks](https://github.com/strawberries73/opendrinks/tree/Issue-725), they were requesting contributors to include a drink recipe and/or fix some errors. The Chef in me said YES! Well... I know it is no where near as difficult as my third PR but at this point, time was an issue. I searched in the project to see what they had and then had to figure out what to include. Once I found my recipe, a "Galaxie" cocktail that changes colors. I went to work testing the program and looking through to find errors I can fix.  I found a few.  Missing information, a URL that did only led you to a 404 page and some inconsistencies that could be fixed to help the outcome be much nicer.  I finished and did my [PR](https://github.com/alfg/opendrinks/pull/998/). It wasn't over yet though.  One of the files I fixed had a conflict. I fixed the conflict and then everything cleared.  Edits and additions were [merged](https://github.com/alfg/opendrinks/commit/97fab36340fbb93f256005e26fe207f1778fa61b)!  

I should be happy, but I still feel defeated.  I was looking forward to doing more C# but due to software issues, I had to step away and go back to javascript.  It's like something in the Universe keeps telling me to get into javascript. When I get my VS19 fixed, I will seek the opportunity to contribute to that original project.  At the end of this Hacktoberfest, it was an enjoyable experience.  I definitely plan to do this again.... only next year I'm going to get my son to participate as well!  He is in his first semester of Computer engineering.  Oh you should see the faces of my family members when we start chatting about coding!  Haha!