teleren/devto huggingface dataset:
How to add Magento Cloud users via CLI
Tags: magento, cloud, ecommerce
Published: 2021-05-14 19:55:07

---
title: How to add Magento Cloud users via CLI
published: true
description: If you’re a developer like me, for sure you will prefer to add new users via terminal via Magento Cloud CLI, not just add users, but you can edit it too.
tags: Magento, Cloud, Ecommerce
canonical_url: https://rafaelcg.com/blog/tutorial/magento-cloud-cli/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rgq33azat8fyn4v94o9.png
---

If you're a developer like me, for sure you will prefer to add new users via terminal via Magento Cloud CLI, not just add users, but you can edit, remove, list and edit the permissions via terminal. But in case you want to go to the visual way, I've written the post [How to add new users to the Magento Cloud panel](https://rafaelcg.com/blog/tutorial/add-users-magento-cloud/).

Magento CLI Commands
--------------------

Specifically to control you users you have this available commands.

Add a user to the project

```
magento-cloud user:add
```

Delete a user

```
magento-cloud user:delete
```

List project users

```
magento-cloud user:list [users]
```

View or change the user role

```
magento-cloud user:role
```

The following examples use the CLI to add a user, configure roles, and modify project assignments and assigned user roles.

To add a user and assign roles:

Use the CLI to add the user. `magento-cloud user:add`

Follow the prompts to specify the user email address, set the project and environment roles, and add the user:

```
Enter the user's email address: alice@example.com

Email address: alice@example.com

The user's project role can be 'viewer' ('v') or 'admin' ('a').

Project role [V/a]: a

The user's environment-level roles can be 'viewer', 'contributor', or 'admin'.

development environment role [V/c/a]: c

Summary: Email address: alice@example.com

Project role: contributor

Adding users can result in additional charges.

Are you sure you want to add this user? [Y/n]

Adding the user to the project
```

This operation triggers the Cloud build and deploy process, which takes your site offline until deployment completes. For production environments, we recommend completing this operation during off-peak hours to prevent service disruptions.

After you add the user, Magento sends an email to the specified address with instructions for accessing the Magento Commerce Cloud project.

The following example changes the environment-level role that is assigned to a user:

```
magento-cloud user:role alice@example.com --level environment --environment development --role admin

```

The `magento-cloud list` command displays all the `magento-cloud` CLI commands.
Frontend developer Interview Preparation
Published: 2021-05-14 19:46:43

Hey developers,

Preparing for an interview is the tedious job. 
Can you please help me to prepare for frontend interview?

I have already started revising  JavaScript. Please guide me in learning JavaScript for an interview?

I'm using ReactJs as frontend librar and pretty much experienced in it. But still want to know the types of questions asked in an interview.

Do I need to know Data structures and algorithms?
I'm pretty much familiar with basic data structures.
True Is Not Always True In JavaScript
Tags: javascript, node, webdev, programming
Published: 2021-05-14 19:40:08

Hello everyone👋

In this article, I will try to explain the behavior of the `boolean` data type of JavaScript.

We often use `if` statements in JavaScript to check if a value, that can be of any data type is `true` or `false`. But do you know that these values are not really `true` or `false`, rather they are considered as `truthy` or `falsy` values?

### Explanation

Let's understand this with an example.

```javascript
var val = "blog";
if (val) {
  console.log(true);
}
```
So in the above code snippet, we declared a variable `val` which is storing a string `"blog"`.

In general, `if` statements expect a boolean expression or a boolean condition but here we are passing the variable `val` directly without any boolean expression.

And this `if` statement evaluates the value of `val` to `true` and execute its block. But why?

### Why

In JavaScript, any non-zero number including the negative numbers and non-empty strings are termed as `truthy` values and the `truthy` values are translated to boolean `true` when evaluated in a Boolean context.


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

So in our example, as the value of the variable `val` is a string with data i.e, not empty, it is considered as a `truthy` value which evaluates to `true` in the `if` statement condition.

And the values other than the `truthy` values are termed as `falsy` values.

`falsy` values in JavaScript.

```yaml
- false
- null
- undefined
- 0
- NAN
- ''
- ""
- 0n
- -0
- `` 
- document.all
```

### Conversion

Convert the `truthy` and `falsy` values to boolean `true` or `false`.

You can pass the `truthy` or `falsy` value to the `Boolean()` and it will return `true` or `false`.

```javascript
var val = "blog";
if (Boolean(val)) {
  console.log(true);
}
```

Or you can use the following syntax to convert it to a pure boolean value.

```javascript
var val = "blog";
if (!!val) {
  console.log(true);
}
```

We know this `truthy` or `falsy` concept is not so impacting but it is always better to handle pure boolean values.

---

> Originally published on [blog.bibekkakati.me](https://blog.bibekkakati.me/true-is-not-always-true-in-javascript)

---

Thank you for reading 🙏

If you enjoyed this article or found it helpful, give it a thumbs-up 👍

Feel free to connect 👋

[Twitter](https://twitter.com/kakatibibek) | [Instagram](https://instagram.com/bibekkakati) | [LinkedIn](https://linkedin.com/in/bibekkakati)


---

If you like my work and want to support it, you can do it here. I will really appreciate it.

<a href="https://www.buymeacoffee.com/bibekkakati">
<img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=bibekkakati&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff">
</a>
Simple Page Transitions with SvelteKit
Tags: svelte, sveltekit
Published: 2021-05-14 19:09:54

---
title: Simple Page Transitions with SvelteKit
published: true
description: Bare-minimum page transitions in a SvelteKit app.
tags: svelte, sveltekit
---

Demo: https://sveltekit-page-transitions.netlify.app/
Source code: https://github.com/evanwinter/sveltekit-page-transitions

## Overview

1. Create a `<PageTransition />` component that does a simple fade-out-and-in transition (using Svelte's built-in `transition` directive) when a given prop changes.

2. Create a layout file, wrap its content with the `<PageTransition />` component, and pass the current page's path to the component as a prop.

## Step 1: Creating the `<PageTransition />` component

Create a component file at `src/lib/components/PageTransition.svelte`. 

Import the `fly` transition from Svelte's built-in transition library, and setup an element that `fly`s in and out. Add a `delay` to the `in` transition that's equal to or greater than the `duration` of the `out` transition (otherwise, the user will see them happen at the same time).

Export a variable called `url` and wrap the element inside of a `#{key ...}` block.

The contents of the block will be destroyed and recreated only when the value of `url` changes.

When that happens, the `out` transition will be executed immediately, and the `in` transition happen once the `out` transition finishes –– creating a "fade-out-and-back-in" effect.

```svelte
<!-- PageTransition.svelte -->
<script>
  import { fly } from "svelte/transition";
  export let url = "";
  const pageTransitionDuration = 500;
</script>

{#key url}
  <div in:fly={{  x:-5, duration: pageTransitionDuration, delay: pageTransitionDuration }}
       out:fly={{ x: 5, duration: pageTransitionDuration }}>
    <slot />
  </div>
{/key}
```


## Step 2: Using the `<PageTransition />` component

Create a layout file at `src/routes/__layout.svelte`.

```svelte
<!-- __layout.svelte -->

<!-- 1. Using a `load` function, pass the current URL to the layout component as a prop -->
<script context="module">
  /** @type {import('@sveltejs/kit').Load} */
  export const load = async ({ url }) => ({ props: { url } });
</script>

<script>
  import PageTransition from "$lib/components/PageTransition.svelte";
  export let url;
</script>

<div>
  <nav>
    <a href="/">Home</a>
    <a href="/about">About</a>
  </nav>

  <!-- 2. Pass the `url` prop to the `PageTransition` component, causing it to re-render when the page changes -->
  <PageTransition {url}>
    <slot />
  </PageTransition>
</div>
```

The `load` function runs before the component is created or updated.

We store the current url in a variable and pass it to the `PageTransition` component as the `url` prop.

The `PageTransition` component will then destroy and recreate itself (transitioning out and back in) only when the user navigates to a new page.
Export photos from Apple Photos app via commandline organized by date
Published: 2021-05-14 19:07:38

Use tool https://github.com/RhetTbull/osxphotos

```
> osxphotos \
--db /path/to/PhotoLibrary.photoslibrary \
export /path/to/export/destination \
--directory "{created.year}/{created.month}" \
--verbose \
--report /path/to/exported_files_report.csv
```
Documenting .env files for nodejs Projects
Tags: javascript, documentation, node, dotenv
Published: 2021-05-14 18:51:27

The original post is published on my Blog at [mrsauravsahu](https://mrsauravsahu.github.io/posts/44)


Note: There's a video version available where I actually build this project and deploy it to npmjs: https://youtu.be/4N1lwa6w6HA

Documentation of any sort looks like an overhead at the time, but pays off really well for projects that need to be maintained for a long time, when teams change, when onboarding new members, and a whole lot others.

For nodejs projects, application configuration is usually read from `process.env` which in turn, come from a place like ENVIRONMENT variables or a configuration file like `.env`. During development, this package `dotenv` is a great tool to set your environment variables.

## Documentation is Key

For large projects with even larger teams, code-base changes constantly and so does the configuration. So documentation is key to keep anyone who uses the code-base later.

A typical `.env` file looks like this (it's a collection of key=value pairs)

```
# The Node environment
NODE_ENV=development

# Url to a third party service
API_SERVICE_URL=https://mrsauravsahu.tech/posts/41/file
```

Since the value could contain sensitive information, to document this, we should ideally omit the value from each key=value pair and add this template of sorts to source control, which look something like the example below:

```
# The Node environment
NODE_ENV=

# Url to a third party service
API_SERVICE_URL=
```

## What did I build?

I created an npm package which generates these template `.env` files from the real .env file, called [gen-env-template](https://npmjs.com/gen-env-template).
This is a dev tool so you can install it as a devDependency.

```
# Use your favorite package manager to install this. (You can use npx to run directly as well)
npm i -D gen-env-template
```

Now that we have the package, we can pass in the `.env` file we're using and path to the outfile file. For example, if this is our input file -

```
➜ cat .env
# The Node environment
NODE_ENV=

# Url to a third party service
API_SERVICE_URL=
```

We can generate our template file with this command
```
➜ ./node_modules/.bin/gen-env-template .env template.env
```

Now we get the generated template file
```
➜ cat template.env
# The Node environment
NODE_ENV=

# Url to a third party service
API_SERVICE_URL=
```

Now, this `template.env` file can be safely committed to source control as all secrets have been omitted. You can find the Github repository for this project here - [mrsauravsahu/gen-env-template on Github](https://github.com/mrsauravsahu/gen-env-template)
So Java, it is.
Tags: java, motivation, goal, beginners
Published: 2021-05-14 18:48:47

Since this is my first post or rather a small blog introducing myself and why the post has such an unusual heading let me make it easier for you.
So if you go through my profile on this platform, you see that I have mentioned that I am currently pursuing my Bachelors from G.L.A. University, Mathura in Computer Science and Engineering and during the course I have now decided to finally pick Java as my fundamental programming language. ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qyfemvtfie6ionw3r6i.jpg)
And guess what! I decided that I will be sharing my journey and the path taken to achieve my goal.
I would be making it like a journal where every day I will be briefing about the topic that I learnt, and the resources I would use.
Let's see how much this approach of learning works for me, keeping the finger crossed🤞 for the best.
this is (not) the end
Tags: motivation, mentalhealth, productivity
Published: 2021-05-14 18:20:01

penulis cuman iseng aja nulis ini, semata-mata cuma buat motivasi penulis, syukur-syukur kalau misalnya teman-teman pembaca bisa termotivasi dari tulisan ini, hehehe.

kalian pernah ga sih, ngerasa terpuruk karena sesuatu, misalnya kehilangan orang yg kalian sayang, sahabat yang tiba-tiba ngehilang dan ketika tidak sengaja ketemu dia berubah total, kuliahnya kacau balau, kehilangan teman-teman yang satu frekuensi atau hal lainnya? mungkin ketika kalian ngerasain salah satu hal tersebut, rasanya dunia sudah selesai, kalian ngerasa sendiri dan kalian merasa down atau putus asa.

penulis sendiri pernah mengalaminya, semuanya malahan.

hal tersebut bukan akhir dari semuanya. kehilangan sesuatu bukan berarti kalian kehilangan harapan untuk bisa lebih baik lagi kedepannya. karena masa depan, kita tidak akan pernah tau akan seperti apa.

sengaja penulis memasang foto background Sergio Perez, pembalap Formula One, yang berhasil memenangkan balapan pertamanya di Bahrain beberapa bulan lalu, karena penulis ingin sedikit nyeritain doi dan balapan tersebut. mungkin ga detail tapi diambil garis besarnya aja.

perjalanan doi menjadi pemenang balapan tidak mudah. di lap pertama, doi berada diposisi ketiga dari 20 pembalap. namun di lap yang sama, mobil doi tertabrak dari belakang oleh pembalap lain yang bikin doi melintir keluar dari trek balapan dan akhirnya berada diposisi terakhir. mungkin saat itu, Perez udah pasrah gakan bisa dapet poin, setidaknya. tapi takdir berkata lain. ditengah balapan, pembalap-pembalap diposisi depan banyak yang mengalami hal apes, seperti ban mobilnya pecah, atau ada kerusakan mobil yang menyebabkan mereka harus masuk pit stop, atau bahkan menyelesaikan balapan lebih awal.

setelah 87 lap balapan, di lap terakhir, ceritanya berbanding terbalik dari yang terjadi di lap pertama, Perez berhasil menang balapan dengan gap waktu dari posisi kedua kurang lebih 7 detik.

yang penulis ambil hikmahnya dari sini adalah, meskipun kita terpuruk diawal, bukan berarti kita akan terus terpuruk sampai akhir. anggap saja, ketika kita terpuruk, itu adalah sebuah ujian yang harus kita lewati, karena tanpa ujian, kita gakan pernah naik kelas, kan?

ada masih banyak hal yang bisa kita capai. mungkin ada yang bercita-cita ingin membuat start-up, membuat sebuah usaha, kerja di perusahaan besar seperti google, apple atau lainnya, kita masih bisa mengejar mimpi-mimpi kita, asalkan satu hal yang harus kita penuhi; jangan pernah putus asa untuk mengejar sesuatu.

terima kasih sudah membaca.
Livewire Offline Component
Tags: laravel, livewire, tailwindcss
Published: 2021-05-14 15:08:23

Livewire has a feature called [Offline State](https://laravel-livewire.com/docs/2.x/offline-state).  This can be used to notify the User that they have lost their Internet Connection and are offline. You just need to add the `wrap:offline` attribute to a div like below:

```
<div wire:offline>
    You are now offline.
</div>
```
And this div will only be displayed when user goes offline. In this Tutorial, we will show how to implement this functionality into any existing Livewire Project.

We will create a Livewire Component using below command:

```
php aritsan make:livewire Offline --inline
```

This will create a file at `app/Http/Livewire/Offline.php`.

```
class Offline extends Component
{
    public function render()
    {
        return <<<'blade'
        <div>
        </div>
        blade;
    }
}
```

We will then change the render method to return following Output.

```
<div wire:offline class="fixed top-4 left-1/2">
    <div class="relative -left-1/2 text-red-600 bg-yellow-500 px-4 py-2 font-bold">
        You are currently offline!
    </div>
</div> 

```

Here we are using Tailwind CSS Classes to fix the Div position at the top of the screen and centered horizontally. See the usage of attribute `wire:offline` which makes sure that this will only display when the User is offline.

Now you just need to include this component in the Layout like below:

```
@livewire('offline')
```
And that’s it, any time user goes offline, the warning will be displayed to the user like below:

![Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3n780v3dpx9ufsacxjm9.png)
WordPress Concepts: Taxonomies and Categorizing Posts 
Tags: wordpress, php, webdev
Published: 2021-05-14 18:03:30

In the previous posts, I wrote about custom post types and action/filters in WordPress. Another great concept that can help you in understanding and developing WordPress themes and plugins is taxonomies. 
So basically a taxonomy is something that you classify, categorize or group WordPress post types with. How about an example? 
Suppose that you have a website with a custom post type, Movie! 
anything about a movie that you can categorize your movies with can be a taxonomy. For example genre, country, award, rate and etc.
 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/feg4v2v8htx9xvhemvlc.png)

As you can see in the above picture, the IMDB uses taxonomies too. For genre taxonomy, horror is a "term" in WordPress. So every taxonomy has some terms in it. Horror, drama, comedy, sci-fi, and western are some terms for genre taxonomy. 

WordPress has two default taxonomies which we're all familiar with: 

* **Tags** Which are non-hierarchical built-in taxonomies.
* **Categories** Which are hierarchical built-in taxonomies.

You can create your own taxonomy and create an archive page for them. Find out how to create a taxonomy for CPT in [WordPress developer reference](https://developer.wordpress.org/plugins/taxonomies/working-with-custom-taxonomies/). 

How did you use taxonomies in your project? Are tags and categories enough for any project? Tell me in the comments.
Mid-May Update
Published: 2021-05-14 17:51:53

##What did we ship?
- We got Lu's portfolio fully deployed on Netlify and Heroku. 
- We have a good understanding of a workflow that we'll use for future projects; a Gastby / Strapi.
- We're still kicking with our Reddit clone; two hours in. 

##For next week
- Finish the Reddit Clone
- Get your personal portfolio up. 
- Choose your portfolio projects.
The `ELONLIAR` token is telling the crypto world that Elon Musk is just a liar!
Published: 2021-05-14 17:48:30

# ElonLiar

```
   ___     _       ___    _  _              _       ___     ___     ___   
  | __|   | |     / _ \  | \| |     o O O  | |     |_ _|   /   \   | _ \  
  | _|    | |__  | (_) | | .` |    o       | |__    | |    | - |   |   /  
  |___|   |____|  \___/  |_|\_|   TS__[O]  |____|  |___|   |_|_|   |_|_\  
_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|_|"""""| 
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
```

-  Twitter:    https://twitter.com/elonliar
-  Github:     https://github.com/elonliar/ElonLiar 
-  BSC Token:  [0xb2635bb9e904e6ebc96bc9b52d5fd5c348ed9be9](https://bscscan.com/address/0xb2635bb9e904e6ebc96bc9b52d5fd5c348ed9be9)  
  
The `ELONLIAR` token is telling the crypto world that Elon Musk is just a liar!

Fork from $SafeMoon and $ASS: The SafeMoon Protocol is a community driven, fair launched DeFi Token. Three simple functions
occur during each trade: Reflection, LP Acquisition, and Burn.

## Community Driven
ELONLIAR is a community driven and fair launch token.

## Automatic LP
Every trade contributes toward automatically generating liquidity locked inside PancakeSwap.

## Coin Rewards
Holders earn passive rewards through static reflection while watching their balance of $ELONLIAR grow indefinitely.

## Coin Rocket
`1M Holders` achievement we're going to accomplish in only 99 days! Our community is relentless and cannot be stopped.

----
![elonliar](https://user-images.githubusercontent.com/67900306/118301549-ca6cca00-b515-11eb-8649-f39869234949.jpg)

Elon Musk said cryptocurrency could "not come at great cost to the environment"

Tesla has suspended vehicle purchases using Bitcoin due to climate change concerns, its CEO Elon Musk said in a tweet.

Bitcoin fell by more than 10% after the tweet, while Tesla shares also dipped.

Tesla's announcement in March that it would accept the cryptocurrency was met with an outcry from some environmentalists and investors.

The electric carmaker had in February revealed it had bought $1.5bn (£1bn) of the world's biggest digital currency.

>    Elon Musk's SpaceX to launch dogecoin moon mission
>    
>    Bitcoin could derail China's climate change targets
>    
>    How Bitcoin's vast energy use could burst its bubble

But on Thursday, it backtracked on its previous comments.

"We are concerned about rapidly increasing use of fossil fuels for Bitcoin mining and transactions, especially coal, which has the worst emissions of any fuel," Mr Musk wrote.

"Cryptocurrency is a good idea... but this cannot come at great cost to the environment."

He also said the electric carmaker would not sell any of its Bitcoin, and intends to use it for transactions as soon as mining shifts to using more sustainable energy.
ActiveStorage - default conf is wrong?
Tags: rails, discuss, activestorage, ruby
Published: 2021-05-14 17:20:26

Lately I been working a lot with ActiveStorage and I found that every-time I try to edit my content (images, videos, etc) they are overwritten O_o, yes WHAT?

But if you just change your config to:
`config.active_storage.replace_on_assign_to_many = false`

Now you have what I understand as a normal behaviour, you can do a standard Update according CRUD. 

I believe this was done like this just because it was simple, but do you consider it wrong also?
What was your win this week?
Tags: discuss, weeklyretro
Published: 2021-05-14 17:17:42

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

Hey there!


**Looking back on your week — what was something you're proud of?**

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Exploring a new neighborhood in your town ... or whatever else might spark joy ❤️ 

---

Happy Friday!

![Dog in hammock](https://media.giphy.com/media/fdlcvptCs4qsM/giphy.gif)