teleren/devto huggingface dataset:
Migrating from Node-Sass to Sass (Dart-Sass) with npm
Tags: css, sass, migration, npm
Published: 2022-03-25 19:02:51

## Tired of node-sass ?
For 2 years now, LibSass and `node-sass` has been deprecated. A lot of reasons led the core team to this decision.
Above all, no functionality added since 2018 and a lack of support for new CSS features like `calc()`.

I'm in charge of refactoring some legacy CSS and I was tired of not being able to handle modern CSS correctly and seeing :

```
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (64)
```

## So, how to migrate node-sass to sass ?

> Requirements:
> - Minimum Node 12 👍
> - A computer 😃

First, remove all node_modules folder or just the node-sass folder :

`rm -rf node_modules/node-sass`

Second, in your package.json, replace :

```
"devDependencies": {
    "node-sass": "version_installed"
}
```
by
```
"devDependencies": {
    "sass": "^1.49.9"
}
```
and run `npm install` / `npm i`

or

delete the dependencies of `node-sass` in the package.json and install `sass` :

`npm install --save-dev sass` / `npm i -D sass`

Third, if you have some npm scripts as I do, it goes from this :

![node sass scripts](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9jite9hz71c1kykxx2x.png)

to this :

![sass scripts](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gevx6dufj5tkrs5bvd70.png)

If you want to generate some source maps, it doesn't change from `node-sass` to `sass`.
If you don't want them, just add `--no-source-map` in your script

One change is about output & minify css file.
With `node-sass` you had to add :

`--output-style compressed`

now, what you do is:

`--style=compressed`

If like me, you have some CSS dependencies from another repo, the way you import it differs a little bit.

With `node-sass`, it was easy to link to a node module:

`@import 'node_modules/some_repo/scss/index/scss'`

Now, you have to add a load path to your npm script :

`sass --load-path=node_modules/ scss/index.scss dist/index.css`

Then in your `index.scss`, change your import by 

`@import "some_repo/scss/index.scss";`

⚠️ `@import` is deprecated and should not be used even if it's still maintained.
In my case, doesn't have a chance to use the new `@use` and `@forward` coming from `sass`

Take a look here : [At rules](https://sass-lang.com/documentation/at-rules)

That's it ! Hope you enjoyed this quick tutorial.

_cover: @der_maik / unsplash_
Amazon Web Services — Budgets
Tags: aws, awscommunity, optimization
Published: 2022-03-25 19:01:18

If you aren’t familiar, head on over and visit the AWS Billing & Cost Management Dashboard — https://console.aws.amazon.com/billing/home. Under Cost management, select Budgets, this is where you will build your very own AWS budget.
The first step in creating an AWS budget is to decide what type of budget you are looking for. For this example, I will be using a Cost budget.

Next you will need to fill in a few details for your budget. I have decided to show you both the fixed monthly amount and the monthly budget planning. The monthly budget planning allows you to set a starting amount and then budget for a % of growth per month!

You may also decide to include some additional and optional budget parameters. If you have already established a solid key/value tagging scheme, this can be really helpful to scope per workload, product or service.

Next, you will configure thresholds such as your budget threshold, set up notifications, and any budget actions which is truly magic!
Remember, if you do decide to use Budget actions, there are some specific IAM permissions that are required to execute an action on your behalf. More info on the IAM permissions is available below.

Budget Action
For this example, I have configured a budget action, where once the budget threshold I set is reached, the specific EC2 instance will be stopped and I will be notified via email, Amazon SNS or even using AWS Chatbot Alerts!

IAM Role Permissions
Trust Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "budgets.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
Permissions policies
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstanceStatus",
        "ec2:StartInstances",
        "ec2:StopInstances",
        "iam:AttachGroupPolicy",
        "iam:AttachRolePolicy",
        "iam:AttachUserPolicy",
        "iam:DetachGroupPolicy",
        "iam:DetachRolePolicy",
        "iam:DetachUserPolicy",
        "organizations:AttachPolicy",
        "organizations:DetachPolicy",
        "rds:DescribeDBInstances",
        "rds:StartDBInstance",
        "rds:StopDBInstance",
        "ssm:StartAutomationExecution"
      ],
      "Resource": "*"
    }
  ]
}

**Complete article and others here** https://voice.michaelwahl.org/amazon-web-services-budgets-4f99ce3d17b1
SonarQube Analysis with Community Edition in a Docker Container on Mac M1
Published: 2022-03-25 18:58:09

If you don't already have docker installed, this link has more information for Mac and Windows. https://docs.docker.com/desktop/
I am using a Mac with an Apple M1 chip, so I was successful using this command:
docker run -d -p 8084:9000 mwizner/sonarqube:8.7.1-community
Rubymine running Rails with Foreman
Tags: rubymine, foreman, ruby, rails
Published: 2022-03-25 18:55:36

---
title: Rubymine running Rails with Foreman
published: true
description: 
tags: Rubymine, Foreman, Ruby, Rails
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oabyaejq8f479ht4mna4.png
---

Rails 7 has made `foreman` the standard way of running Rails. Rubymine's default project configuration will only start the Rails server and not the additional applications in the `Procfile.dev`. The Rubymine documentation solves the problem with RVM and gemsets but what if you don't use RVM? How can you get Rubymine to start via Foreman?

At the command line make sure you have foreman. [You should not add foreman to the Gemfile!](https://github.com/ddollar/foreman/wiki/Don%27t-Bundle-Foreman).

`gem install foreman`

You then create a new configuration for running or debugging the application. RubyMine doesn't have a configuration for Foreman so we will have to make it ourselves.

1. In the main menu, go to Run | Edit Configurations, click the Add icon, and select Gem Command from the list.

2. In the Run/Debug Configurations dialog, specify the following settings:

![Run/Debug Configurations dialog configured for foreman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3q4udsc1su3v8p9gqq3h.png)

- Name: Enter the run/debug configuration name, for example, foreman start.
- Gem name: Specify the foreman gem here.
- Executable name: Select the foreman executable.
- Arguments: Specify an argument for running the application using Foreman, for example, start.

Click on Bundler

![Run/Debug Configurations dialog Bundler tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tquaqsjl22mopy4uow8b.png) 

- Disable bundle exec
  - bundle exec stops you finding Gems outside of the Gemfile bundle. If you've followed the instructions faithfully then foreman won't be in the bundle.

Click OK.
 
You should now be able to run the `foreman start` configuration from within Rubymine.

### References
[Foreman manual](http://ddollar.github.io/foreman/)
[Bundler - bundle exec](https://bundler.io/man/bundle-exec.1.html)

### Thanks

Thanks to the Reddit Rails community and jakefillsbass for the tip!
How to get file extension from path in Laravel 9?
Tags: programming, php, laravel, node
Published: 2022-03-25 18:51:12

## we will write simply get pathinfo(). how to get file extension from path in laravel. extension is here the define pathinfo(). location of your image to uplaod in your laravel code.

we will use pathinfo(). and PATHINFO_EXTENSION  use this extension word after get this extension confortable.

AND WE WILL use this code get extension. laravel framwork

## Example – 1 how to get file extension from path in laravel?

```
$_GETEXTENSTION = pathinfo(storage_path('/uploads/image.png'), 

PATHINFO_EXTENSION);

dd($_GETEXTENSTION);
```

Example 2:

```
$_PATH_INFO = pathinfo(public_path('/uploads/image.png')); 

$_EXTENSTION = $_PATH_INFO['extension'];

dd($_EXTENSTION );
```

If you have file object from request then you can simply get by laravel framwork function.

```
$_EXTENSTION = $request->file->extension(); 

dd($_EXTENSTION);
```

## If you have file object from request then you can simply get by laravel framwork function.

```
$_EXTENSTION = $request->file->getClientOriginalExtension();

dd($_EXTENSTION);
```
#Day 6 of solving 450 questions.
Published: 2022-03-25 18:48:44

📅Day 6 : March 25,2022
Problems solved today :

[MERGE_INTERVALS](https://leetcode.com/problems/merge-intervals)

-Got 20/45 test cases correct.
-Need to learn better time management while solving.

[Count Pairs of sum:K](https://afteracademy.com/blog/check-for-pair-in-an-array-with-a-given-sum)

Very bad day, tried 5 different problems was able to solve 0.

Will try again tomorrow.
Quick Tip: Importing new license – Docker Container | Business Central
Tags: docker, dynamicnavbc, powershell, expired
Published: 2022-04-20 17:38:21

---
title: Quick Tip: Importing new license – Docker Container | Business Central
published: true
date: 2022-03-25 18:41:47 UTC
tags: Docker,DynamicNAVBC,Powershell,expired
canonical_url: 
---

A few days ago, I’ve faced the following error when I attempted to open my Business Central instance from my Docker Container:

_Your program license has expired._

Let’s see what steps I’ve adopted to import the license on my Docker Container.

First, I’ve copied the license, that I want to import, from my host to my Docker Container by doing the following command:

![](https://toolgbrmaker.files.wordpress.com/2022/03/image-11.png?w=944)
_Docker cp “C:\Bruno_s Documents\Licenses\license.flf” bcsandbox17:c:\Run\license.flf_

Before moving on, a quick check if the command was well succeeded…

![](https://toolgbrmaker.files.wordpress.com/2022/03/image-12.png?w=748)

Now that I’m sure that the license file is there, on my container, is time to import it to the aimed instance, by using the following cmdlet:

![](https://toolgbrmaker.files.wordpress.com/2022/03/image-13.png?w=1024)
_Import-NAVServerLicense -LicenseFile “C:\Run\license.flf” -ServerInstance bc -Force_

By executing the above cmdlet you’ll end with your license imported, but to see reflected the upload in the Business Central you’ll require to restart your instance. If you don’t remind how to do it please jump until the following **[post](https://dev.to/toolgbrmaker/get-service-cmdlet-continuation-powershell-59p)** and you’ll be able to find how to do it.

I hope that this helped. Stay safe!
Create Tooltip in React
Tags: react, reactnative, webdev, beginners
Published: 2022-03-25 18:36:28

A tooltip is mostly used to define the extra information about data(text,image or videos). Tooltip shows when the user moves the mouse pointer or tap over an element. Tooltip can be placed Top, Right, Bottom, Left. Here we will create tooltip in react applications by using the package [React tooltip-lite](https://www.npmjs.com/package/react-tooltip-lite). It is a A lightweight and responsive tooltip package, you can [read in detail here](https://www.npmjs.com/package/react-tooltip-lite).

## Create Tooltip in React

## Install with NPM
```ssh
npm install react-tooltip-lite
```

## Import into your react Component
Now, we can use **&lt;Tooltip /&gt;** Component by importing it in our class or functional component.

```typescript
import Tooltip from 'react-tooltip-lite';

<Tooltip 
content="React Tooltip" 
direction="right"
tagName="span"
className="target"
>
    <a href="http://w3courses.org">Visit Tutorials</a>
</Tooltip>
```
There are many props available for this react tooltip component, you can [see here](https://www.npmjs.com/package/react-tooltip-lite).

## Style React Tooltip in React
You can apply some css to react tooltip. Here below is an example.

```css
.react-tooltip-lite {
  background: #000000;
  color: white;
}

.react-tooltip-lite-arrow {
  border-color: #333;
}
```

---

Please like share subscribe and give positive feedback to motivate me to write more for you.

For more tutorials please [visit my website](https://www.w3courses.org/tutorials/).

Thanks:)
Happy Coding:)
You Win Some, You Lose Some: Life in Tech From the Perspective of a First-Gen American Latina
Tags: latina, shecodes, beginners, firstgenerationintech
Published: 2022-03-25 18:20:11


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cvmcxx3zs2rduigqt60.jpeg)

It was early September in 2021 when I quit the only job I knew and left to Oaxaca, Mexico. As I basked in the purity that produced my childhood, aiding and accompanying my aging mom and grandmother, I was plagued by the concept of existence and mortality. It dawned on me how time was truly something so priceless and preeminent in the face of everything ephemeral. I thought about how many years I had spent away from my family in hopes to become financially independent but really just lived paycheck to paycheck— not to mention how the pandemic put the frailty of my livelihood into perspective.
I had heard many testimonies from friends and strangers alike how their life in tech had allowed them to take the reins of their life through an arduous but rewarding path. And so that September, after a lot of research, I had my heart set to take on the challenge of being a woman in STEM by taking a fast track. A one way ticket to sleepless nights (i’m being sliiiightly dramatic, prioritize your health!)and a whirlwind of technical curiosities with a door swung open to programming languages I never imagined I could become fluent in.
Everything comes at a price given price but being a double minority in the tech world comes with a little extra. There’s an air of presumed incompetence not only by potential employers and colleagues, but within ourselves as well. In Latino families, the socio-political climates respective to our countries have heavily impacted our relationship to money conditioning us to merely survive. The thought of living comfortably or even surpassing that has always seemed something unfeasible.
So here, as I begin my software engineering journey, I stand before the opportunity to tackle statistics that do not speak for minorities. Who else but ourselves to change them? And so I remind myself, who else but me? As a Mexican-American, I am able to provide new insight to problems and break cultural barriers in the tech community. Who knows? Maybe even be at the forefront of something even more revolutionary than where we are today.
But for now, let’s be students. Let’s be the best versions of ourselves, and take it one day at a time. There is an infinite amount of knowledge at our finger tips. We hold so much power within ourselves. Everyday is a challenge, and everyday there is a stone to turn. There will never be a day when one can actually claim to fully understand a language as integral as Javascript but it’s fun to pretend. As my cohort at Flat Iron come to find, everyday is a challenge and a win.
Space Battle
Tags: java, algorithms, 100daysofcode, programming
Published: 2021-12-30 11:16:33

# [Description](https://binarysearch.com/problems/Space-Battle/solutions/7145958)

There are a bunch of rockets in space lined up in a row.

You are given a list of integers `nums` representing each rocket's size and direction. If the number is positive it's going right, and if it's negative it's going left. The value of the number represents the rocket's size.

If two rockets collide, the smaller one will disappear and the larger one will continue on its course unchanged. If they are the same size and they collide, they'll both explode (both numbers are removed). If two rockets are moving in the same direction, they will never collide. The rockets start out equally spaced in the given order and all move at the same speed and become harmless after exploding.

Return the state of the rockets after all collisions.

**Constraints:** 

- `n ≤ 100,000` where `n` is the length of `nums`

## Example 1

### Input

```
nums = [1, 5, 3, -6]
```

### Output

```
[-6]
```

### **Explanation**

```
The last rocket will collide with everything to its left.
```

---

## Example 2

### Input

```
nums = [1, 5, 3, -6, 7]
```

### Output

```
[-6, 7]
```

### **Explanation**

```
-6 and 7 are going in separate directions, and the -6 rocket will destroy everything to its left.
```

---

# Intuition

use a stack to store rocketswe need to do it from left to right, because only one chance the rockets will collide, which is `-> <-`

1. if you find this rocket is going to right, you put it into stack directly
2. if you find this rocket is going to left, you need check all rockets in stack
    - if stack.peek is to right, and its size smaller than current rocket, just pop it out;
    - after that, here will be 3 situation:
        1. stack is empty -> push current rocket in
        2. stack peek is same negative (same direction right to left) -> push current rocket in
        3. stack peek size is equal current rocket size and direction is opposed -> push peek rocket out

# Implementation

```java
import java.util.*;

class Solution {
    public int[] solve(int[] nums) {
        Stack<Integer> stack = new Stack<>();

        for (int rocket : nums) {
            if (rocket > 0) {
                stack.push(rocket);
            } else {
                while (!stack.empty() && stack.peek() > 0 && stack.peek() + rocket < 0) {
                    stack.pop();
                }
                if (stack.isEmpty() || stack.peek() < 0) {
                    stack.push(rocket);
                } else if (stack.peek() + rocket == 0) {
                    stack.pop();
                }
            }
        }

        int[] ans = new int[stack.size()];
        for (int i = ans.length - 1; i >= 0; i--) {
            ans[i] = stack.pop();
        }
        return ans;
    }
}
```

## Time Complexity

- Time: O(n)
- Space: O(n)
How to build a programming project?
Tags: programming, productivity
Published: 2022-03-25 17:56:21

Programming without planning will result in poor software.  

Programming without planning is how you become a weak developer. 

This is my current programming process:

### Define the process

Reflect on the current process to use it as it is, or make changes. 

### Learning

I read code, books, articles, documentations, … I watch lectures, tutorials, … I learn a new programming language or technology … I do a combination of that based on the project I will build. 

### Programming

I create the first version of the project, and take notes of things I should learn. 

### Second learning

I learn the things I was ignorant about. 

### Review

After acquiring the knowledge I needed I read my code and takes notes of what I should change. 

### Editing

I feel the gaps, I improve existing parts of my code, and make my project ready to shipping.
Create swap file in Ubuntu
Tags: ubuntu
Published: 2022-03-25 17:46:03

Create a swap file to let OS use when the physical memory is not big enough. Make the swap file as 1~2x big as your physical memory.

## How much swap size do you need

Based on your physical memory size, here is a chart you can use:

* 1G -> 2G
* 4G -> 6G
* 6G -> 8G
* 8G -> 11G
* 16G -> 20G
* 32G -> 38G

## Create swap file

CreateSwap.sh:

```bash
#!/usr/bin/env bash

fallocate -l 12G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
```

Then use `swapon --show` to check current swaps.

If your system already configured other swaps, you can use `swapoff` to remove it, for example:
```bash
swapoff /dev/sdb
```
Also remember to remove it in the `/etc/fstab` file such that it won't get used when system rebooted next time.

## Reference
* [how to add swap space on ubuntu](https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/)
* [how much swap size do you need](https://itsfoss.com/swap-size/)
Day-51 Training At Ryaz
Tags: beginners, programming, github
Published: 2022-03-25 17:43:31

- Date:25/03/2022
- Day:Friday

Today, I started at about 11:30 am as I was done with all basic crud operations so, I had a meet with my mentor so, he asked to implement the jwt tokens i.e JSON Web Token  is an open standard used to share security information between two parties — a client and a server.and this help us to identify the distinct user we would understand this with an example so, as we see if we host a party and allow the entry of party with an distinctive pass so, every user that enter the party would have unique toke and get the entry if user would not have an unique token so, his entry would be disabled same is with JWT token once we implement it when ever user create the source would be assigned with unique token and his enrt and exit would be viewed and this will help us to maintain security and would be easy to get identity that have created the source so, now I have to implement it in my crud app so,today I learnt all about JWT tokens. soothes way my day ended up.
How I bought rinegade.sol domain and turned it into NFT?
Tags: web3, solana, bonfida, nft
Published: 2022-03-25 17:33:15

1. Go to https://naming.bonfida.org/#/
2. Click register domain
3. Search for domain you like
4. Buy it, if you don't want to use it for website url, you can keep space to 1KB
5. Total would cost ~$20
6. Once you bought it you can wrap it and tokenize into NFT and sell on the market! https://naming.bonfida.org/#/profile?view=nfts
How to learn Solana/Anchor and become Web3 Developer in 2 days?
Tags: anchor, solana, rust, web3
Published: 2022-03-25 17:11:03

### Day 1:
#### first 4h:
- read readme https://docs.solana.com/developing/programming-model/overview
- understand that everything in solana is an account, both program data and program logic will be separate solana accounts
- read book and setup environment - https://book.anchor-lang.com/

take a rest

#### second 4-6h:

- read https://www.brianfriel.xyz/understanding-program-derived-addresses/
- follow everything in anchor book tutorial and write all code
- install https://www.soteria.dev/software and try to test your example
- try to refactor your example, break into files

### Day 2:

#### first 4h:

- read soteria blog fully https://www.soteria.dev/post/from-ethereum-smart-contracts-to-solana-programs-two-common-security-pitfalls-and-beyond

take a rest

#### second 4-6h:
- open 100 different repos here and read through code
https://github.com/project-serum/anchor/network/dependents?package_id=UGFja2FnZS0xNzU0MDMwMzQw

### Day 3:
- you wake up and can read and understand any anchor project
- try to read any other existing solana protocol and learn about what practices they are using or how they work

P.S. for total newbies, try this https://github.com/ilmoi/solana-onboarding