teleren/devto huggingface dataset:
I've just completed a front-end coding challenge from Frontend Mentor.
Tags: webdev, beginners, tutorial, css
Published: 2022-02-26 09:01:41

I've just completed a front-end coding challenge from Frontend Mentor.

You can see my solution here: https://lnkd.in/gqDGh5dZ

Any suggestions on how I can improve from front-end devs in my network are very welcome. Thanks! #frontend #coding #network #codechallenge #codenewbie
Sending GET and POST requests in PHP using CURL
Published: 2022-02-26 08:46:14

## GET

```
<?php
$url = "https://example.com";
$AccessKey = "123";

//initialize curl
$curl = curl_init();

//set the url
curl_setopt($curl, CURLOPT_URL, $url);

//setting custom headers
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'AccessKey: $AccessKey'));

//return the results as a string rather than printing them on the screen
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

//send the request
$curl_response = curl_exec($curl);
var_dump($curl_response);

//if result is a JSON, convert it into an array
$res = json_decode($curl_response, true);
var_dump($res);
```

## POST

```
$AccessKey = "123";

$url = "example.com";

//initialize curl and set url
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);

//set custom headers
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type:application/json", "AccessKey: $AccessKey"));

//return the results as a string rather than printing them on the screen
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

//enable POST and set POST data
$curl_post_data = array(
    "foo" => 'bar',
);

$data_string = json_encode($curl_post_data);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);

//send the request
$curl_response = curl_exec($curl);
var_dump($curl_response);
```
Docker, Containers & Confusions
Tags: docker, cloud, kubernetes, aws
Published: 2022-02-26 08:44:57

![Container Echo System](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0y4gzhqb47um13t4oxo.jpg)

There is a lot of confusion about following common questions around Docker, Containers, Kubernetes and related technologies and tools.

What is Dockershim ?
What is a Container Runtime ?
Why did Kubernetes use Docker ?
What is the difference between Docker, Containerd, CRI-O ?
What is RunC ?
What are OCI and CRI specifications ?
What are different Container Runtimes available ?
Why did Kubernetes remove support for Docker ?
What alternative Container tools are available ?
What is the difference between Docker and Podman ?

Take a look at this article for clarifying details from basics to today's container world - https://faun.pub/docker-containers-confusions-2e2768530144?source=friends_link&sk=da2c8099b6db1bbe88e377da086ac111
This week’s newsletter is out! (26-02-2022) - Branding, marketing, the future of tech and cyberwar
Tags: javascript, tech, webdev, discuss
Published: 2022-02-26 08:10:06

---
title: This week’s newsletter is out! (26-02-2022) - Branding, marketing, the future of tech and cyberwar
published: true
description: Another week of great javascript, tech and web development links.
tags: javascript, tech, webdev, discuss
---

Branding, marketing, the future of tech and cyberwar

https://markjgsmith.substack.com/p/mark-smiths-newsletter-26-02-2022

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Linux Drivers, a New Hope
Tags: linux, ubuntu
Published: 2022-02-26 08:08:12

10 years ago (before learning programming) I switched to Linux, but drivers issues made me revert back to Windows. The problem was with my NVIDIA card.

2 years ago I tried Ubuntu 20 again and faced [NVIDIA driver issues](https://www.youtube.com/watch?v=i2lhwb_OckQ) yet again. would make my system crush upon recovering from sleep. Additionally, my earbuds would not connect to the PC properly. So I started using Ubuntu in a VirtualBox.

Last year I did it for the third time and solved the NVIDIA issue ([with this script](https://gist.github.com/makar2/df799d9a154a903c5bde4a5e67175e8b)) after hours of digging the internet. My PC would still not connect to my earbuds properly, but I could at least start using a natively installed Ubuntu.  

Today I tried out Ubuntu 21 from USB and what a surprise -- both NVIDIA and earbuds drivers work out of box :tada: :tada: :tada:

Looking forward to upgrading to Ubuntu 22 this April!
Handling nodejs errors in a NestJS application using a telegram bot as an example
Tags: kaufmanbot, node, nestjs, errors
Published: 2022-02-26 08:04:46

Update file **apps/server/src/main.ts**

```ts
import { Logger } from '@nestjs/common';

const logger = new Logger('Application');

//do something when app is closing
process.on('exit', exitHandler.bind(null, { cleanup: true }));

//catches ctrl+c event
process.on('SIGINT', exitHandler.bind(null, { exit: true }));

// catches "kill pid" (for example: nodemon restart)
process.on('SIGUSR1', exitHandler.bind(null, { exit: true }));
process.on('SIGUSR2', exitHandler.bind(null, { exit: true }));

//catches uncaught exceptions
process.on('uncaughtException', exitHandler.bind(null, { exit: true }));

import { NestFactory } from '@nestjs/core';
import env from 'env-var';
import { AppModule } from './app/app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  const globalPrefix = 'api';
  app.setGlobalPrefix(globalPrefix);

  const port = env.get('PORT').default(3333).asPortNumber();
  await app.listen(port);
  logger.log(
    `🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
  );
}

try {
  bootstrap().catch((err) => {
    logger.error(err, err.stack);
  });
} catch (err) {
  logger.error(err, err.stack);
}

function exitHandler(options, exitCode) {
  if (options.cleanup) {
    logger.log('exit: clean');
  }
  if (exitCode || exitCode === 0) {
    if (exitCode !== 0) {
      logger.error(exitCode, exitCode.stack);
    } else {
      logger.log(`exit: code - ${exitCode}`);
    }
  }
  if (options.exit) {
    process.exit();
  }
}

```
![Console with error](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/615bjnj837mtbfta67x4.png)
Today's Daily Humor For Devs - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-02-26 08:00:03

---
title: "Today's Daily Humor For Devs - Daily Developer Jokes"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259b6d7a73.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_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:___ Did you hear about the programmer that was scared of IDEs?

___A:___ They retreated back into their shell
 -->
Day 33/100 Java
Tags: 100daysofcode
Published: 2022-02-26 07:58:05

Another Section Down

Day 33/100

**Language:**
JAVA

**Time Period Spent:**
1 hrs

**Course Taken:**
Udemy: Java Programming Masterclass - Tim Buchalka

**Today's Learning:**
- Naming Conventions
- Packages

- Code Challenges:
	- Generic Classes

**Additional Notes:**
Today I focused on doing less of this language. I was only able to get one hour done with the prospectus of doing another hour later on. There are a few projects that I wanted to fulfil with swift so learning this on the side and apart form the main challenge. If you want to see my progress on this too let me know and I will add my thoughts and journey of this too. Now that I have the fundamentals down I feel like I can carry this across to any language. Always learn the fundamentals!
Day 32/100 Java
Tags: 100daysofcode
Published: 2022-02-26 07:53:38

Another Section Down

Day 32/100

**Language:**
JAVA

**Time Period Spent:**
2 hrs

**Course Taken:**
Udemy: Java Programming Masterclass - Tim Buchalka

**Today's Learning:**
- Generics
- Generic Classes 1
- Generic Classes 2
- Generic Classes 3

- Code Challenges:
	- Abstract Class

**Additional Notes:**
I feel like productivity today was well versed. There is a lot I covered I was able to continue with the course with ease. I feel like the fundamentals and the theory of a language is always important. Although the fun stuff of creating projects is always what we want it is important to learn the fundamental concepts that we can then move and reproduce in any other language.
Best Freelance Mean Stack Developer | Larvel & Mongo DB Expert
Tags: meanstackdeveloper, developer, mongodb, larvel
Published: 2022-02-26 07:43:42

I Provide Hight Quality Services for [Mean Stack Development | Larvel & Mongo DB](https://www.mymeanstackdeveloper.com/). Are You in Need of an enthusiastic mean stack developer You are at the right place.

Being a [Freelance Meanstack Develope](https://www.mymeanstackdeveloper.com/)r, I am experienced and adept with all the latest technologies when it comes to creating appealing development solutions.

I am a skilled MEAN stack developer and perfect for your organization to deliver amazing projects with expertise in web development in web customization.
[Know More...](https://www.mymeanstackdeveloper.com/)
Cron Job: Node Js
Tags: javascript, node, beginners, webdev
Published: 2022-02-26 07:20:15

###### _Experience is the mother of all teachers, as they say._ (...Anonymous)
I was assigned a small project to do.
It was about a prediction app that needed to be able to update its fixtures on the go.

🌳 I was advised by a senior back-end developer to use the cron job concept or the worker process. 

We want to write a task scheduler in a nutshell. Here's how to use Node Js to run `simple task scheduler`. 

Steps:
* Install node-cron : <kbd>npm install node-cron  </kbd>

* Install shell for windows : <kbd>npm install shelljs </kbd>--> This is a Unix shell commands for Node.js

---
So let's write a simple function that runs every seconds

```javascript
const cron = require("node-cron");
let shell = require("shelljs");

cron.schedule("* * * * * *", () => {
  console.log("Scheduled");
  if (shell.exec("dir").code !== 0) {
    console.log("Something went wrong");
  }
});

```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2t5wbi6of0sxas4ql3v.PNG)
 
---


##### Send automated emails with Node-Cron
```javascript
let cron = require('node-cron');
let nodemailer = require('nodemailer');
let shell = require('shelljs');


// e-mail message options
let mailOptions = {
  from: 'enter your mail here',
  to: 'enter receipient's email here',
  subject: 'Email from Node-App: A Test Message!',
  text: 'Some content to send',
};

// e-mail transport configuration
let transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: 'your user email here',
    pass: 'Your password here',
  },
});

cron.schedule('* * * * *', async () => {
  // Send e-mail
  await transporter.sendMail(mailOptions, function (error, info) {
    if (shell.exec('dir').code !== 0) {
      console.log('Something went wrong');
    }
    if (error) {
      console.log(error);
    } else {
      console.log('Email sent: ' + info.response);
    }
  });
});
```

Thanks fro reading....

## Resources
[Node cron](https://www.npmjs.com/package/node-cron)
[Shell](https://www.npmjs.com/package/shelljs)
Trichofol Reviews Natural 100% Trusted Hair Support Formula
Tags: health
Published: 2022-02-26 06:58:34


To be honest, grow up! There's more where it came from. I don't understand why I should not simply try to keep far, far, away from it anyway. This is a fabulous edition. That is a ground floor opportunity. In the past this was a problem. My next installment will provide you with a guide. That was only inhuman. Granted, doing it heavily complicate matters, but it's not this cut and dried. I have a strong hold on my [Trichofol](https://ipsnews.net/business/2022/02/08/trichofol-review-is-it-really-stop-hair-fall-or-waste-of-money-real-customer-results-and-review-after-30-days/). Using it rapidly became popular in America. I took the bait on that. If you're weak and can't handle the heat, you're likely to find Trichofol is not very pleasant. I may not be more than a little confused by it. Yep, that would be their predisposition. You might gather that I'm not the sharpest knife in the cabinet. That's how to get rid of these beliefs. It's the moment to go for it. We will take a bold look at some unit. 

[https://ipsnews.net/business/2022/02/08/trichofol-review-is-it-really-stop-hair-fall-or-waste-of-money-real-customer-results-and-review-after-30-days/](https://ipsnews.net/business/2022/02/08/trichofol-review-is-it-really-stop-hair-fall-or-waste-of-money-real-customer-results-and-review-after-30-days/)
Tailwind Css : Getting Started
Tags: tailwindcss, webdev, css, codenewbie
Published: 2022-02-26 06:56:41

First of all what's tailwindcss actually?-
 It's a utility-first Css framework in which you can directly   apply    css styles to  elements using classes made for it.Eg:-  for text looking small _text-sm_ can be used, To make it look very   big text-2xl can be used , for making a element having display   flex ,only _flex_  class can be used, and so on...,

**Its not just another Css framework**
Tailwind css is fully customize-able framework which gives you full freedom over design. What you want,how should website look ..,is all in your hands.

 <u>Now you have a basic idea about how tailwindcss works & what it is actually, but now I'll tell you how to get started,i.e installation & usage.</u>

1.) First of all you'll need -
   

- [Nodejs ](nodejs.org/)installed (Npm) [To check node is installed properly enter command ` node -v` &` npm -v`]

- A code editor ([VS-code](code.visualstudio.com) is highly recommended,Other editors are [Sublime-Text](sublimetext.com),[Atom](atom.io),etc)

2.) Now in VS-code press _Ctrl+`_ to open a integrated terminal OR Open a terminal Manually on your machine.

3.) After a terminal is opened navigate to your project folder or make one by entering ' `mkdir your-folder-name` ' & then enter ' `cd your-folder-name` ' 

4.) Atlast let's install tailwindcss in your project
 

- Enter commands-

 ```
 npm install -D tailwindcss
 npx tailwindcss init
 ```

- In your tailwind.config.js add path to all of your template files-

 ```
 module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    extend: {},
  },
  plugins: [],
 }
 ```

- Create a _src_ folder where you'll write all source code & then create a _input.css_ file , open input.css and add following code-

 ```
 @tailwind base;
 @tailwind components;
 @tailwind utilities;
 ```

- Create index.html(in _src_ ) file and add some boiler-plate with link to style-sheet file-

 ```
 <!doctype html>
 <html>
 <head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-   scale=1.0">
  <link href="/dist/output.css" rel="stylesheet">
 </head>
 <body>
  <h1 class="text-3xl font-bold underline">
    Hello world!
  </h1>
 </body>
 </html>
 ```

- Create dist folder in your root and in it create output.css file to produce all output css

- And then lastly build your css using-
 `npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch`

**_Hurray!.., you should see your design changes in browser by opening index.html there_**

Thats all! you've installed tailwindcss successfully & Now can create beautiful elegant web-pages using it.

ThankYou for reading this post and if it helped you please share  :)
_Suggestions to improve this posts are welcomed!_
Profile Page Application using HTML CSS  & JavaScript 
Tags: javascript, css, html, programming
Published: 2022-02-26 06:32:12

We build a user profile application using HTML CSS and JavaScript.
Have implemented Sidebar Navigation and on click of any navigation link, we show corresponding page on right side main section.

Explained how to implement slide animation on hover and how to load the page with animation where page enters from left to right.

I promise that you will be learning many Css and JavaScript concepts after watching this video and it will be a perfect Project for beginners and even for web developers.

🔥🔥🔥🔥🔥🔥🔥🔥
Timeline :
00:00 what we are building
00:38 Create the Skeleton - HTML
03:02 Styling Starts Here-CSS
06:22 Slide Background On Hover
14:05 Lets load Page on Click- JavaScript

{%youtube hLUNmOtr3KI%}
React `useImperativeHandle` Magic
Tags: react, typescript, tutorial, elm
Published: 2022-02-26 06:22:21

<!-- trick -->


*Blog post by [Artur Czemiel - Aexol](https://dev.to/aexol/)*

---


### Intro

I am a full-stack TypeScript developer and I've been learning the Elm language a lot recently. Will I switch to Elm? Definitely not. However, the learning process helped me understand and demand more things in React.

Today I will show you a React anti-pattern that will allow you to **share state outside components**. Why would you do this? Why not use a hook? etc. etc. I will show you an example with a small form.

**Note:** This is not a "real-world" example. In production env I am using this hook to create synchronized S3 File browser, but it might be too much for the sake of this article.

### The Hook

So this combination of State and Callback is to connect the ref function later and listen when the ref changes:
```tsx
import { useState, useCallback } from "react";

export const useImperativeRef = <T>() => {
  const [refState, setRefState] = useState<T>();
  const ref = useCallback((n: T | null) => {
    if (n) {
      setRefState(n);
    }
  }, []);
  return [refState, ref] as const;
};
```

### The form

We don't need anything fancy for this example so we will use a simple form with 2 inputs:

```tsx
import React, {
  useImperativeHandle,
  useState,
} from "react";


interface FormValues{
	username: string;
    password: string;
}

export interface MyFormHandle{
	values: FormValues
}

export const MyForm = React.forwardRef(({},ref: React.ForwardedRef<MyFormHandle>) => {
	const [values,setValues]  = useState<FormValues>({
		username: "",
        password: "",
	})
	useImperativeHandle(
		ref,
        () => ({
            values
		})
    )
	return <div>
		<input type="text" value={values.username} onChange={e => 
        	setValues({
                ...values,
                username: e.target.value
            })
        } />
		<input type="password" value={values.password} onChange={e => 
        	setValues({
                ...values,
                password: e.target.value
            })
        } />
    </div>
}) 
```

### Using the form
Et voila! We can listen to state changes of components underneath:

```tsx
export default () => {
	const [values,setRef] = useImperativeRef<MyFormHandle>()
    useEffect(() => {
    	console.log(`Values changed!, Values: ${JSON.stringify(values,null,4)}`)
    }, [values])
  	return <div>
		<MyForm ref={setRef} />
	</div>	
}
```

Of course, we can pass change functions and values, but let's be true - that's Yuck! In my opinion, this way is much more elegant and codeless in many cases.
Laravel 9 HTTP Guzzle Client Request Example
Tags: laravel
Published: 2022-02-26 05:59:35

Hi,

Here, I will show you how to work laravel 9 http request example. if you want to see an example of laravel 9 http client request example then you are the right place. step by step explain laravel 9 guzzle http client example. This tutorial will give you a simple example of php laravel 9 http client request. you will do the following things for laravel 9 http Client post request.

Laravel 9 provides an inbuilt HTTP Client using guzzlehttp/guzzle package. you can easily run HTTP client requests using HTTP facade. you can send GET, POST, PUT, DELETE requests with you can easily get responses with text and JSON too. you can also pass header and authentication tokens easily.

Here, I will give you very simple examples of how to run a call HTTP API request from laravel 9?

1) Laravel 9 HTTP cURL GET Request Example

2) Laravel 9 HTTP cURL POST Request Example

3) Laravel 9 HTTP cURL PUT Request Example
4) Laravel 9 HTTP cURL DELETE Request Example

5) Laravel 9 API with Response

Let's see one by one example

[Laravel 9 HTTP Guzzle Client Request Example](https://www.codecheef.org/article/laravel-9-http-guzzle-client-request-example)
Maximum Product Subarray
Tags: dsa, python
Published: 2022-02-26 05:55:30

##Instructions
Given an integer array nums, find a contiguous non-empty subarray within the array that has the largest product, and return the product.
A subarray is a contiguous subsequence of the array.

####Example

```python
Input: nums = [-2,0,-1]
Output: 0
Explanation: The result cannot be 2, because [-2,-1] is not a subarray.
```
##Approach
If you have solved the [Maximum SubArray Sum](https://dev.to/wanguiwaweru/maximum-subarray-sum-3g7), then you have some idea of how we can solve this problem.

We keep track of the minimum and maximum product of the numbers visited so far. Then we can make comparisons and update the variables appropriately.

##Python Implementation

```python
def maxProduct(self, nums: List[int]) -> int:
    if len(nums) == 0:
       return 0
    max_so_far = nums[0]
    min_so_far = nums[0]
    result = max_so_far
    for i in range(1, len(nums)):
        curr = nums[i]
        temp_max = max(curr, max_so_far * curr, min_so_far * curr)
        min_so_far=min(curr, max_so_far * curr, min_so_far * curr)
        max_so_far = temp_max

        result = max(max_so_far, result)
    return result
```

I hope you found this helpful.
How to create an npm package 👨🏻‍💻⚡
Tags: npm, package, 100daysofcode, github
Published: 2022-02-26 05:43:43

Hello Devs, 

There are 2 ways to use your component library as a package :-
 1. npm package
 2. github actions

## 1. For npm package 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqqdwfge8j2cjb7evrj9.png)
 

🔗 https://docs.npmjs.com/creating-and-publishing-private-packages…

🔗 https://levelup.gitconnected.com/publish-react-components-as-an-npm-package-7a671a2fb7f…

🔗 https://youtu.be/hf6Z8OZanec

## 2. For GitHub actions
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6a5fe1lstqujy8izg51.png)
 

🔗 https://youtu.be/7CNC0QBCY-Y
Laravel 9 REST API Authentication Example using Sanctum
Tags: laravel
Published: 2022-02-26 05:27:41

Hi Dev,

Here, I will show you how to work with laravel 9 sanctum API authentication example. you will learn laravel 9 rest API using sanctum. you can see laravel 9 sanctum spa API example. you can see laravel 9 sanctum API example.

Laravel 9 Sanctum provides a simple authentication system for SPAs (single page applications), mobile applications, and simple, token based APIs. Sanctum also allows each user of your application to generate multiple API tokens for their account.

If you also want to create API for your mobile application then you can follow this tutorial for how to create the rest API step by step with laravel 9 and sanctum. If you are new then don't worry about that I wrote the tutorial step by step.

Follow bellow few steps to create a restful API example in the laravel 9 app.

[Laravel 9 REST API Authentication Example using Sanctum](https://www.codecheef.org/article/laravel-9-rest-api-authentication-example-using-sanctum)