teleren/devto huggingface dataset:
custom Mouse with javascript
Tags: javascript, html, css
Published: 2022-07-19 08:00:28

here we wanna make a custom mouse with javascript, first step is to make a context for mouse:

```JAVASCRIPT
import React, { createContext, useState } from "react";

export const CursorContext = createContext();

const CursorContextProvider = (props) => {
  const [cursor, setCursor] = useState({ active: false });

  return (
    <CursorContext.Provider value={[cursor, setCursor]}>
      {props.children}
    </CursorContext.Provider>
  );
};

export default CursorContextProvider;
```
then we make a component for our mouse shape:
```JAVASCRIPT
import React from "react";
import useMousePosition from "./useMousePosition";
const Cursor = ({ color, color1, scroll, left, right, drag, pos }) => {
  const { clientX, clientY } = useMousePosition();

  return (
    <div
      style={{
        position: "fixed",
        top: 0,
        bottom: 0,
        left: 0,
        right: 0,
        zIndex: 9999,
        pointerEvents: "none",
      }}
    >
      <svg
        width={500}
        height={500}
        viewBox="0 0 50 50"
        xmlns="http://www.w3.org/2000/svg"
        style={{
          position: "absolute",
          transform: "translate(-50%, -50%)",
          color: '#000',
        }}
      >
        <circle
          cx="25"
          cy="25"
          r="7.5"
          fill={ "#000"  }
          id="cursor"
        />
      </svg>
    </div>
  );
};
export default Cursor;

```
then we use them in a component

```JAVASCRIPT
        <CursorContextProvider>
          <Cursor
          />
          {props.children}
         <div>
           mouse shape
        </div>
        </CursorContextProvider>
```
322. Leetcode Solution in cpp
Tags: cpp
Published: 2022-07-19 07:54:28

```
class Solution {
 public:
  int coinChange(vector<int>& coins, int amount) {
    // dp[i] := fewest # of coins to make up i
    vector<int> dp(amount + 1, amount + 1);
    dp[0] = 0;

    for (const int coin : coins)
      for (int i = coin; i <= amount; ++i)
        dp[i] = min(dp[i], dp[i - coin] + 1);

    return dp[amount] == amount + 1 ? -1 : dp[amount];
  }
};
```


#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/coin-change/
198. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-19 07:52:58

```
class Solution {
 public:
  int rob(vector<int>& nums) {
    if (nums.empty())
      return 0;
    if (nums.size() == 1)
      return nums[0];

    // dp[i] := max money of robbing nums[0..i]
    vector<int> dp(nums.size());
    dp[0] = nums[0];
    dp[1] = max(nums[0], nums[1]);

    for (int i = 2; i < nums.size(); ++i)
      dp[i] = max(dp[i - 1], dp[i - 2] + nums[i]);

    return dp.back();
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/house-robber/
🎉 Upcoming event - Food & Drinks - Get to know dataroots!
Published: 2022-08-03 02:00:30

---
title: 🎉 Upcoming event  - Food & Drinks - Get to know dataroots!
published: true
date: 2022-07-19 07:44:39 UTC
tags: 
canonical_url: https://dataroots.io/events
---

- What: Get to know our dataroots team! - Where: Tiensevest 132, Leuven - Who: Everyone with a passion for data & AI
What is a Jenkinsfile? how to write one?
Tags: jenkins, cicd, devops, build
Published: 2022-07-19 07:40:50

If you know about Jenkins then I am sure you would know about Jenkins pipeline. It is a suite of tasks which are linked to each other and are executed to achieve continuous integration and delivery.

And Jenkinsfile is the heart of this pipeline. It provides Jenkins pipeline a definition, with a text based file which contains everything that Jenkins pipeline needs to know for its execution.

Jenkinsfile is not the only way to define a pipeline, you can also do it in UI. However, it is a best practice to do it using Jenkinsfile and check-in to your SCM.

Here is the most basic pipeline to build, test and deploy a software,
```
pipeline{
	Agent any
	stages{
		stage("build") {
			steps{
				echo"This is the build step"
			}
		}
		stage("test"){
			steps{
				echo"This is the test step"
			}
		}
		stage("deploy"){
			steps{
				echo"This is the deployment stage"
			}
		}
	}
}
```
Mentioning agent is crucial, as it tells Jenkins to provide a host and workspace for execution.

Steps is where you will mention all the commands that needs to be executed for each stage.

As I said, this is a very basic pipeline and we can do much more than this in Jenkinsfile, such as, using environment variables to add conditions for stages/steps or even create your own variables.

We can also run the stages in parallel instead of sequential to increase the performance of pipeline.

I will be writing an in-depth article in a few days, which will cover all the essentials of Jenkinsfile and how we can use it to achieve CI-CD.

Hope this gave you an overview to Jenkinsfile.

Have a great day 🙂

If you want to support my work,

https://www.buymeacoffee.com/manishanaidu
Create Laravel CRUD using Inertia and Vue 3 - list page with search and pagination
Tags: opensource, php, laravelframework, laravel
Published: 2022-07-24 16:28:09

---
title: Create Laravel CRUD using Inertia and Vue 3 - list page with search and pagination
published: true
date: 2022-07-19 07:26:01 UTC
tags: opensource,php,laravelframework,laravel
canonical_url: https://blog.devgenius.io/create-laravel-crud-using-inertia-and-vue-3-list-page-with-search-and-pagination-c4a52b6501c3
---

#### Laravel creates a Vue admin panel from scratch — Part 2

![image](https://cdn-images-1.medium.com/max/1024/1*FPdAN6xHqkbRcof0vJrOcg.png)

In this part, we going to add the permission CRUD list page. We can add a seeder for user, role, and permissions before creating the list page.

1. Create a model
2. Create a seeder and Re-migrate
3. Grant Super-Admin access
4. Add routes
5. Create a controller
6. Create Index view
7. Add pagination component
8. Add a flash message
9. Add permission menu

#### 1. Create a model

We already created a Blade template-based admin panel and this code already available on Github [https://github.com/balajidharma/basic-laravel-admin-panel](https://github.com/balajidharma/basic-laravel-admin-panel)

So we going to copy most of the code from this admin panel. So, copy all the models from [here](https://github.com/balajidharma/basic-laravel-admin-panel/tree/master/app/Models)

#### 2. Create a seeder and Re-migrate

Now, copy [this](https://github.com/balajidharma/basic-laravel-admin-panel/blob/master/database/seeders/BasicAdminPermissionSeeder.php) seeder to our database/seeders folder.
.
.
.
.
###Read full story on [medium.com](https://blog.devgenius.io/create-laravel-crud-using-inertia-and-vue-3-list-page-with-search-and-pagination-c4a52b6501c3)

---

Previous part - Part 1: [Installation and Authentication](https://dev.to/balajidharma/laravel-creates-a-vue-admin-panel-from-scratch-part-1-installation-and-authentication-2j0o-temp-slug-1747070)
Next part - Part 3: [Create Laravel CRUD create and update pages using Inertia and Vue](https://blog.devgenius.io/create-laravel-crud-create-and-update-pages-using-inertia-and-vue-48162d8bf6ee)

* * *
Git basics: Changing your last commit message
Tags: git, github, beginners
Published: 2022-07-19 07:24:55

You might accidentally make a typo while writing your commit message.
Or because you quickly tried to solve a bug, you accidentally left the old commit message and pushed that.

It's a good practice to keep the message meaningful, so you'll know what you change in which commit.

I made a wrong commit message on my GitHub repo to showcase how it works.

![Wrong git commit message](https://cdn.hashnode.com/res/hashnode/image/upload/v1657347172860/0cIuhVSKI.png)

In the image above, we see I committed some changes with the message: "fix: image name wrong message".

Let's see how we can fix that.

## Fixing a non-pushed commit message

If you haven't pushed your code yet, it's easier to fix.

You can run the following command.

```bash
git commit --amend
```

This will open up a vim editor where you can change the commit's message.

![Editing wrong commit message](https://cdn.hashnode.com/res/hashnode/image/upload/v1657347525992/wcl3WPzrY.png)

To edit the text, press the `i` key, and to stop, press `esc` then `wq` to save the file.

However, a faster way is to use the `-m` property, which can be used to amend the commit message.

```bash
git commit --amend -m "fix: image name correct message."
```

We can see the commit message altered without pushing a new commit.

![Altered commit message](https://cdn.hashnode.com/res/hashnode/image/upload/v1657347670214/I9lgb4_pn.png)

## Fixing a pushed commit message

However, what happens if we already pushed the wrong message to GitHub, for instance.

![Wrong commit message on GitHub](https://cdn.hashnode.com/res/hashnode/image/upload/v1657347913051/lGc_stSHQ.png)

No worries, we can still fix it without messing things up.

If we are addressing the last commit, we can again run the following command:

```bash
git commit --amend -m "fix: image name"
```

The next step is to push while overwriting the previous commit message.
For that to work, use the following command:

```bash
git push --force-with-lease origin your-branch

# in my case:

git push --force-with-lease origin master
```

And that's it. We now changed the already pushed commit message.

![Changes pushed commit message on GitHub](https://cdn.hashnode.com/res/hashnode/image/upload/v1657348741134/V2WVkoM_K.png)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
custom Modal with javascript
Tags: javascript, html, css
Published: 2022-07-19 06:16:35

we want to open a modal then open another one inside the first one and close the higher modal with click in outside of the modal.
first we make a component for modal:

```JAVASCRIPT
import React from "react";

function Modal(props) {
  const divStyle = {
    display: props.displayModal ? "block" : "none",
  };
  function closeModal(e) {
    e.stopPropagation();
    props.closeModal();
  }

  return (
    <div className="modal" onClick={closeModal} style={divStyle}>
      <div className="modal-content" onClick={(e) => e.stopPropagation()}>
        <span className="close" onClick={closeModal}>
          &times;
        </span>

        {props.children}
      </div>
    </div>
  );
}

export default Modal;
```
then we use this component where we need it

```JAVASCRIPT
import React, { useState } from "react";
import "./App.css";
import Modal from "./Modal";

function App() {
  const [modal, setModal] = useState(false);
  const [modal1, setModal1] = useState(false);
  const selectModal = (info = "") => {
    setModal((perv) => !perv);
  };


  return (
    <div className="App">
      <p onClick={() => selectModal("Modal A")}>Open Modal A</p>
      <Modal displayModal={modal} closeModal={selectModal}>
        <div>modal1</div>
        <div onClick={() => setModal1("modal a1")}>Open second modal</div>
        <Modal displayModal={modal1} closeModal={setModal1}>
          <div>modal2</div>

          <div>Second modal</div>
        </Modal>
      </Modal>
    </div>
  );
}

export default App;
```
publlish a private npm package by using github packages
Tags: npm, github, javascript, node
Published: 2022-07-19 06:02:14

## BACKGROUND
Sometimes we need publish NPM package for reusing code, and we don’t want stranger to access our package，so we need publish a private npm package.
## HOW TO PUBLISH
1. Create `Your Personal Acess Token` in [github](https://github.com/settings/tokens), plz select `write packages and delete packages permission`.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8pmtqmxuaq9ea71fpxy.png)
2. Login in github registry in your terminal, plz `run npm login --scope=@OWNER --registry=https://npm.pkg.github.com`.If this package is in your team, scope is your team's name.
3. create a .npmrc file in your root dir, and add a line `@OWNER:registry=https://npm.pkg.github.com`.
4. modify package.json file
  - Verify the name of your package in your project's package.json. The name field must contain the scope and the name of the package. For example, if your package is called "test", and you are publishing to the "My-org" GitHub organization, the name field in your package.json should be @my-org/test.
  - Verify the repository field in your project's package.json. The repository field must match the URL for your GitHub repository. For example, if your repository URL is github.com/my-org/test then the repository field should be `git://github.com/my-org/test.git`.
  - Verify the files field in your project's package.json. You should include files that should be published.

5. publish package by running npm publish.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7bsye9knrmedrvvevu1.png)

## How To Install
1. You should follow HOW TO PUBLISH , and complete 1st step , 2nd step and 3rd step. 
2. run `npm install @OWNER/your-components` or `yarn add @OWNER/your-components`.
Important Topics for Frontend Development Interview
Tags: javascript, webdev, programming, 100daysofcode
Published: 2022-07-19 05:50:25

## Topics to master
There are some topics in JavaScript to master if you want to crack any frontend interview.
1. Scoping
2. Hoisting
3. Closures
4. Callbacks
5. Promises
6. Async and Await

## What is Scoping ?
Scoping in JavaScript determines the accessibility of variables, objects and functions.
There are three types of scopes in JavaScript
a. Block Scope
b. Function Scope
c. Global Scope

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

variables declared with let and const have block scope but variables declared with var doesn't have any block scope.

Function scope is when you determine a variable inside a function then you cannot access.

## What is Hoisting ?
Hoisting in javascript is a behavior in which a function or variable can be used before declaration.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqbbinqw9ab8laht8fmy.png)
 
In terms of variables, var is hoisted and let and const does not allow hoisting.
the following code will give you error.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygji7kcfqf20tsht4xj4.png)
 
## What is Closure ?
Closure means that an inner function always has the access to outer function even after the outer function has returned.

```javascript
const hello = () => {
    let greet = "hello & welcome";
    const welcome = () => console.log(greet);
    return welcome;
}

const fun = hello();
fun();

// hello & welcome
```
## What is a callback ?
A callback is a function which is passed as a parameter into another function which is going to be executed after completion of a task.

```javascript
setTimeout(() => {
    console.log("hello, inside boy");
}, 2000);

console.log("hello outside boy");

// hello outside boy
// hello, inside boy
```

## What are promises ?
A JS promise is similar to real life promise will make it happen or we don’t 

JS promise has three states :

- Pending
- Resolved
- Rejected

![https://www.freecodecamp.org/news/content/images/2020/06/Ekran-Resmi-2020-06-06-12.21.27.png](https://www.freecodecamp.org/news/content/images/2020/06/Ekran-Resmi-2020-06-06-12.21.27.png)

## What is async and await
Stop and wait until something is resolved. We use the async keyword with a function to represent that the function is an asynchronous function.

async function returns a promise.

```javascript
const fetchAPI = async () => {
    const res = await fetch('https://api.quotable.io/random');
    console.log(res);
}

fetchAPI();
```
118. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-19 05:48:52

```
class Solution {
 public:
  vector<vector<int>> generate(int numRows) {
    vector<vector<int>> ans;

    for (int i = 0; i < numRows; ++i)
      ans.push_back(vector<int>(i + 1, 1));

    for (int i = 2; i < numRows; ++i)
      for (int j = 1; j < ans[i].size() - 1; ++j)
        ans[i][j] = ans[i - 1][j - 1] + ans[i - 1][j];

    return ans;
  }
};

```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/pascals-triangle/
Text Portrait
Tags: html, css, javascript
Published: 2022-07-19 05:46:53

```HTML
<div class="wrapper">
  <div class="portrait">

  </div
</div>
```

```CSS
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.wrapper {
  height: 100vh;
  background: #000;
  /*This part is important for centering*/
  display: grid;
  place-items: center;
}

.portrait {
  font-size: 10px;
  line-height: 10px;
  background: url('https://markodenic.com/wp-content/themes/blog/images/marko.png') fixed center no-repeat;
  background-size: contain;
}

/* This part is important for the feature itself */
.portrait {
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: rgba(255,255,255,.1);
}
```
{% codepen https://codepen.io/denic/pen/mdXZgMG %}
Outreachy: Mid way blog post
Tags: gnome, outreachy, gtk4, soc
Published: 2022-07-19 05:45:36

> Time flies ! Now I have reached to middle of my outreachy internship. This blog post will throw some light on my journey till now .

---

<br/>
<br/>

## Timeline
Initially when I applied for outreachy I proposed this timeline .
- May 30 - June 13 => replace gtk+-3.0 with gtk4 library and fix all build error which comes while doing so .( 2 weeks)
- June 14 - June 27 => Fix runtime errors ( 2 weeks)
- June 27 - july 18 => Replace libhandy with libadwaita and rewrite needed ui files and fix error which come in doing so ( 3 weeks )
- July 18 - August 1 => Improve custom stlyes to make app work better with dark theme ( 2 weeks)
- August 1 - August 15 => Make app follow Gnome HIG guidelines . (2 weeks)
- August 15 - August 26 => It is the time which I have kept as empty to adjust my timeline above in case I need to .

I think the timeline was fine . But **fixing errors is not that easy as I thought back then** specially the run time errors . For fixing these I usually have to go through code , run the development version of application then edit the code and so on .
And in this cycle I also have to occasionally consult the documentation of different libraries getting used in the project .
We have changed a bit timeline and the new timeline looks like so 

- July 18 - August 1 -> Debug and fix gtk4 branch issues
- August 1 - August 15 -> Clean the MR code and improve the code quality
- August 15 - August 26 -> Document the current gtk4 branch problems and what's left and start a discussion with the community (users, translators and designers) about UI improvements
 
---

## Progress

I have never ported any application from gtk3 to gtk4 before so I wasn't much confident whether I will be able to complete my project or not , how much time I will need ... So I started coding on my end a bit before the outreachy timeline . Therefore , right now I am nearly on my timeline . I have changed the gtk library version from 3 to 4 and also some other libraries with which gtk4 wasn't compatible with. The application can be successfully compiled now ( so all compile time / build time errors have been rectified 😊 but still there are some run time issues and errors ) . 
I removed some functionalities while porting the application ( not the primary functionalities )  as well as there is a lot of code has to be clean . 
In simple words application is now in workable state but not in a complete working state .
Gradient Borders
Tags: html, css, javascript
Published: 2022-07-19 05:42:36


Create gradient borders with the border-image property:

``` CSS
border:4px solid;
border-image: linear-gradient(135deg,#FF0000 0%,... #FF00AB 100%)1;
```
{% codepen https://codepen.io/saba-bg/pen/oNqZwEV %}

```HTML
<div class="stripe-1"></div>
<div class="stripe-1 blue-stripe-1"></div>
<div class="stripe-2"></div>
<div class="stripe-2 blue-stripe-2"></div>
<div class="stripe-1 stripe-3"></div>
<div class="stripe-1 stripe-3 blue-stripe-3"></div>
<div class="stripe-2 stripe-4"></div>
<div class="stripe-2 stripe-4 blue-stripe-4"></div>
```

```CSS
body{background-color:#283470;}
.stripe-1{
    position:absolute;
    top: 10px;
    left: 10px;
    height: 10px;
    width: 98%;
    background: -webkit-linear-gradient(left,rgba(58, 32, 92,1),rgba(58, 32, 92,.0));
    background: linear-gradient(90deg,rgba(58, 32, 92,1),rgba(58, 32, 92,.0));
}
.blue-stripe-1{
  background: -webkit-linear-gradient(left,#17E1E3,rgba(58, 32, 92,.0));
  background: linear-gradient(90deg,#17E1E3,rgba(58, 32, 92,.0));
  z-index:-1;
  top:20px;
  height:5px;
}

.stripe-2{
    position:absolute;
    top:10px;
    left:10px;
    height: 98%;
    width: 10px;
    background: -webkit-linear-gradient(top,rgba(58, 32, 92,1),rgba(58, 32, 92,.0));
    background: linear-gradient(180deg,rgba(58, 32, 92,1),rgba(58, 32, 92,.0));
}
.blue-stripe-2{
  gradient(top,#17E1E3,rgba(58, 32, 92,.0));
  background: linear-gradient(180deg,#17E1E3,rgba(58, 32, 92,.0));
  z-index:-1;
  left:20px;
  width:5px;
}

.stripe-3{
  top:auto;
  bottom:10px;
  right:10px;
  left:auto;
  background: -webkit-linear-gradient(right,rgba(58, 32, 92,1),rgba(58, 32, 92,.0));
  background: linear-gradient(-90deg,rgba(58, 32, 92,1),rgba(58, 32, 92,.0));
}
.blue-stripe-3{
  background: -webkit-linear-gradient(right,#17E1E3,rgba(58, 32, 92,.0));
  background: linear-gradient(-90deg,#17E1E3,rgba(58, 32, 92,.0));
  z-index:-1;
  bottom:20px;
  height:5px;
}

.stripe-4{
  top:auto;
  bottom:10px;
  right:10px;
  left:auto;
  background: -webkit-linear-gradient(bottom,rgba(58, 32, 92,.0),rgba(58, 32, 92,1));
  background: linear-gradient(-180deg,rgba(58, 32, 92,.0),rgba(58, 32, 92,1));
}
.blue-stripe-4{
  gradient(bottom,rgba(58, 32, 92,.0),#17E1E3);
  background: linear-gradient(-180deg,rgba(58, 32,92,.0),#17E1E3);
  z-index:-1;
  right:20px;
  width:5px;
}
```
{% codepen https://codepen.io/BeginHere/pen/NRezXQ %}
Hoichoi Mod Apk 2.3.81 (Premium Unlocked) Latest Download 2022
Tags: beginners, programming, react, tutorial
Published: 2022-07-19 05:40:41

[Hoichoi Mod Apk Pro](https://apktemple.com/hoichoi-mod-apk/) is a video and music streaming app. This app consists of Bengali-talking films and TV indicates, along with first rate music MVs, and songs. You can browse thru extra than 500 exclusive episodes of one of a kind and unique collection with new indicates being brought each week.

You can now watch your movies whenever and on the cross by way of downloading and experience your favourite films absolutely offline. The awesome offline film alternative will let you create your personal series of first-rate Bengali films.
Users can now have amusing with the absolutely localized reports in the app with full subtitle help for English audio system. By using Hoichoi Mod Apk Pro, you could revel in every day up to date movies, music movies, and TV indicates inside the app. All the contents are properly labeled in their very own particular sections, which allowing Android customers to fast search for their preferred indicates and discover themselves fully immersed in the studies.


**How to Download Hoichoi Mod Apk**
In order to download this mod apk file, you have to follow the steps given below:

**Find the required Apk.
**Click on the download button which you can see below the image.
After clicking on it, wait for the countdown.
Click the download button again, your apk will start to download.
Enjoy.
**My Remarks:
**This mod apk is very awesome to use, the player who uses this mod gets a huge advantage out of it. The game is very simple and smooth with good graphics. The play store version requires a lot of hard work but if we download it from apktemple everything gets a lot of easier. The game will also help us to get a lot of fun and enjoy our time.