teleren/devto huggingface dataset:
Git merge without commit in IntelliJ
Tags: intellij, git
Published: 2021-01-30 22:52:21

By default, using the git merge (not rebase) operation in IntelliJ will immediately create a merge-commit. Sometimes you may want to selectively revert changes or alter content before concluding the merge.

Using either the "Git" menu or version control status area in the bottom right of the project window, checkout the **destination** branch of the merge:

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

Use the "Git -> Merge" menu to bring up the following window. There's many options in this window, which simplify the command-line equivalents. In any scenario, first choose the **source branch** from the dropdown:

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

Remove any options you already have:

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

and add the `--no-commit` option:

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

Click the "Merge" button to proceed.

The "Commit" tool window will show the merge changes, but not yet selected/staged for commit:

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

At this point you can edit files as normal, selectively revert lines from the diffs...

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

...or rollback/revert entire files:

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

Select/stage the changes from the "Commit" tool window and proceed with the merge's commit as you normally would.

Looking at the "Git" tool window's "Log" tab, the merge-commit appears as it should:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/t14bk1hya422wz47wy4s.png)
How can I fix this
Tags: javascript, node, react
Published: 2021-01-31 03:07:53

hi there guys,. I'm getting data from my API, when I make a console.log or JSON.stringify in the API data it shows without problems but when I pass the data in a table with the map, simply nothing is presented in the table. 

ATT: My API Responde status 302

```javascript
const UserData =() => {
const [users, setUsers] = useState([]); 
    const loadUser = () => {
        getUsers().then(data => {
            if(data.error) {
                console.log(data.error)
            }else{
                setUsers(data)
            }
        })
    }
useEffect(() => {
        loadUser();
    },[]);

const inforUsers = () => {
        return(
            <Fragment>
            <table className="table table-bordered mb-5">
                <thead className="thead-dark">
                    <tr>
                        <th scope="col">Id</th>
                        <th scope="col">Nome</th>
                        <th scope="col">Email</th>
                        <th scope="col">role</th>
                        <th scope="col">createdAt</th>
                    </tr>
                </thead>
                <tbody scope="row">
                {Object.keys(users).map((values, key) => (
                    <tr key={key}>
                        <td>
                            {values._id}
                        </td>
                        <td>
                            {values.name}
                        </td>
                        <td>
                            {values.email}
                        </td>
                        <td>
                            {values.role === 1? 'Admin' : 'Simples User'}
                        </td>
                        <td>
                            {values.createdAt}
                        </td>
                    </tr>
                ))} 
                </tbody>
            </table>
            </Fragment>
            )
    }
 return(
        <>
         <div className="container mt-5">
             {console.log(users)}
            {inforUsers()}
         </div>

        </>
    )

}
```
Why CICD Is so Important
Published: 2021-01-31 02:31:59


You just got hired to work for a top tier tech company in Silicon Valley. You're making an annual salary of $90,000. You just started your first week. Your company dishes out roughly $1875 per week for your salary. You create a branch off of the company's main branch that your team is working on in order to implement your user story. You’ve implemented 70% of the user story after ten days of work but all of your work is only accessible in your local repository. You end up losing your hard drive without pushing anything to the Github repository.

 $1875 / 5 days a week = $375 per day 
10 days of the sprint * $375 per day = $3750 

Unless you've memorized each and every single line of code you've written, you’ve just cost your employer $3750! This is one of the many reasons why constantly committing and pushing code that is functional to Github is essential. In order for juniors to get into this habit from an early stage in their career, senior engineers should require that their new employees download the github extensions into there IDE’s before getting on site or even logging into their first Zoom call if all extensions are not already available. Not all juniors are comfortable with the terminal’s GUI or git commands, so this will make it easier for them to adapt to the process. Next, before allowing junior developers to even listen in on a pair programming session, senior engineers should explain the github workflow. The importance of branching, how and when to merge, and how to avoid conflicts. Seniors should let developers know that once a crucial piece of functionality is implemented, a push should follow immediately. Pushes should also be made right before a developer makes the decision to implement something they are not entirely familiar with, such as a new library or new algorithm. This way, when they run into bugs, its not a game-changer if they end up creating more headaches than solutions.

Once user stories have been completed, sprints have been wrapped up, and the site has undergone all the QA testing, deploying the site would be the next big step. Sites such as Netlify use Github’s API in order to connect to repositories the company has and deploys them to the cloud. Netlify is a nice open-source tool in order to host and maintain front-end websites. However, Depending on the company size and budget, the company can also make use of Azure or Heroku in order to host full-stack applications that feature complex backend architecture and Database management. The principles learned from CICD practices and Github source control are one of the primary reasons why the Tech industry has been able to hold the line during this pandemic. Juniors unfamiliar with these concepts should take notice early in order to avoid conflicts in the future.
How to Make a Website in 2021?
Tags: startablog, buildawebsite, createawebsite
Published: 2021-01-31 02:24:11

Starting a blog in 2021 is not difficult if you follow a perfect guide. We have given a complete guide to make a website in 2021.

You do not need to have coding or web-development skills to build a website. All you need is, you need to follow this simple tutorial to create a website.

Below is the comprehensive guide to start a blog in 2021.

<a href="https://saransaro.com/blogging/how-to-create-a-website/">Make a website in 2021</a>
A Recipe Page Made With HTML, CSS & Bootstrap
Tags: html, css, showdev, beginners
Published: 2021-01-31 02:22:53

It's been a hot minute since I've last used HTML, but getting back on it was pretty fun!

Bootstrap is amazing as it helps make the page more responsive and fluid. Static styling with CSS was pretty simple and, within a couple of days of guided self-learning, I completed this recipe page!

The recipe page was fun to do because, in a lot of ways, setting any goal and breaking it down is like creating your own recipe. So to make a page by following my own internal "mental recipe" to stay on top of my goals, this project was meaningful for me. 

Back in the day when I used to customize my Xanga pages, I would usually stick to the classic grayscale for my themes because it was too tedious to figure out a solid color scheme by trial-and-error. Today, it's pretty easy to look up color schemes to use for projects. I used [this one](https://coolors.co/palettes/trending).

So for my recipe page, I picked a color scheme that fit the recipe and the photo used. I enjoyed using a linear-gradient for the background to give the viewer a visual "hint" of pistachio. Very subtle, but effective.

![a gif scrolling down and shrinking the window to show the responsiveness of the page, while also showing some of the css code in the bg](https://media.giphy.com/media/ZlVmyyMASrVlxpBidT/giphy.gif) 

For the recipe and photo, I used [this site](https://www.pineappleandcoconut.com/recipes/cardamom-rosewater-pistachio-kulfi/) because it uses both cardamom and rosewater. The first time I made pistachio kulfi, it was for my boyfriend's parents. I tried to make it as close to the Indian way as possible, but my critics mentioned that, with the rosewater, it was "more Persian than Indian". Either way, they really enjoyed it, and I hope to make it again soon!
How To Test Dynamic Lists in React.js (TDD approach)
Tags: react, showdev, javascript, beginners
Published: 2021-01-31 02:18:25

---
title: How To Test Dynamic Lists in React.js (TDD approach)
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bo5bt5k1vqxu5u9zn4ww.jpg
published: true
description: Quick beginner tutorial on how to test lists in React
tags: react, showdev, javascript, beginners
---

In my previous posts I covered the basics of how to unit test your React applications as well as how to take a Test-Driven Development approach:

{% link https://dev.to/marius/react-testing-crash-course-for-beginners-2ika %}

{% link https://dev.to/marius/react-test-driven-development-tdd-52f1 %}

In this next video I show you how to test lists with dynamic content and specific ordering! 

We'll again take a **test driven development (TDD)** approach to first focus on writing the tests, then the implementation. 

I also cover strategies to write the code for **accessibility** as well as various techniques to make it all even better!

{% youtube M9S54fcBF3g %}

Let me know in the comments if you have feedback!
Code Smell 60 - Global Classes
Tags: codenewbie, tutorial, webdev, programming
Published: 2021-01-31 01:04:09

*Classes are handy. We can call them and invoke them any time. Is this good?*

TL;DR: Don't use your classes as a global point of access.

# Problems

- Coupling

- Classes are global unless we use Namespaces.

- Name polluting

- Static Methods

- Static Constants

- Singletons

# Solutions

1. Use namespaces, module qualifiers or similar

2. Avoid namespace polluting, keep the Global names as short as possible.

3. Class single Responsibility is to create instances. 

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/6b3f0e2a24ea7a6da72dadcbb36a8dd0)
```php
<?

final class StringUtilHelper {
    static function reformatYYYYDDMMtoYYYYMMDD($date) {
    }
}

class Singleton {

}

final class DatabaseAccessor extends Singleton {

}
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/9dd928bab5528d07b7f63b5d76821f4f)
```php
<?

namespace Date;

final class DateFormatter {

    function reformatYYYYDDMMtoYYYYMMDD(Date $date) {
    }
    //function is not static since class single responsibility is to create instances and not be a library of utils

}

namespace OracleDatabase;

class DatabaseAccessor {
    //Database is not a singleton and it is namespace scoped
}
```

# Detection

We can use almost any linter or create dependency rules searching for bad class references.

# Tags

- Globals

# Conclusion

We should restrict our classes to small domains and expose just facades to the outside. This greatly reduces coupling.
 
# Relations

{% post https://dev.to/mcsee/code-smell-18-static-functions-fpj %}

{% post https://dev.to/mcsee/code-smell-17-global-functions-4b82 %}

# More info

{% post https://dev.to/mcsee/singleton-the-root-of-all-evil-50bh %}

{% post https://dev.to/mcsee/coupling-the-one-and-only-software-design-problem-2pd7 %} 

# Credits

Photo by <a href="https://unsplash.com/@alfonsmc10">Alfons Morales</a> on <a href="https://unsplash.com/s/photos/large-library">Unsplash</a>

* * *

> Write shy code — modules that don't reveal anything unnecessary to other modules and that don't rely on other modules' implementations.

_Dave Thomas_
 
* * *
 
{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
Paralysis by Analysis
Tags: programming, sass, productivity
Published: 2021-01-31 00:40:35

When starting something new, there is always a little bit of apprehension. The instinct is to re-evaluate every action. While it is a good idea to check up once in a while to ensure that we are still on track, too much prudence can turn out to be a limiting factor in the long term.

#An idea worth fighting for
A while back, I came up with an idea to create a new kind of social network called Squig. It was going to be an app built for the android operating system. I spent about 6 months designing and building the prototype. During that time, I showed it to a couple of friends and they all thought it was cool but lacked one or two features found in the popular social media networks like twitter and facebook.

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

After receiving that feedback, I went back to work trying to create that feature. This wasn’t an easy task as it required time, energy and focus. So, I eventually burned myself out. Too much prudence and a desire to release a perfect product had worn me out. This was a double edged sword, because the more time I invested in the app, the more difficult it was to let go.

#The wake up call
One day while using my computer at work, someone spilled coffee on it, my hard drive was fried and that was the end of the project. I guess nature was trying to tell me to move forward.

#Lessons learnt
If there is something I learned from this experience, it is to backup your hard drive. Something beyond your control can happen at any time, having a backup can serve as an assurance that if something happens tomorrow, you can pickup where you left off and not have to start all over from scratch.

Also, paralysis by analysis is bad for a boostrapped business. The focus should initially be on product validation, positioning and strategy not on creating a perfect product that nobody really need.

#What next?
Right now, I am working on a new project called [Page Insight Analytics](https://pageinsight.app). It is a simple website analytics tool. I hope to capitalize on this experience as I develop the product.
<br/>
This was initially posted [here](https://rexanthony.ga/paralysis-by-analysis)
Padrão Prototype em Python
Published: 2020-12-16 01:24:19

O padrão Prototype é um **padrão criacional**, este tem como principal objetivo permitir que objetos sejam copiados sem que seus códigos fiquem dependentes de suas classes.

Este padrão de projeto determina que o próprio objeto é responsável pelo clonagem, facilitando assim o processo, uma vez que as classes podem possuir conteúdo que não pode ser copiado "de fora".

####Exemplo do código em Python
```python
class SelfReferencingEntity:
    def __init__(self):
        self.parent = None

    def set_parent(self, parent):
        self.parent = parent


class SomeComponent:

    def __init__(self, some_int, some_list_of_objects, some_circular_ref):
        self.some_int = some_int
        self.some_list_of_objects = some_list_of_objects
        self.some_circular_ref = some_circular_ref

    def __copy__(self):
        # First, let's create copies of the nested objects.
        some_list_of_objects = copy.copy(self.some_list_of_objects)
        some_circular_ref = copy.copy(self.some_circular_ref)

        # Then, let's clone the object itself, using the prepared clones of the
        # nested objects.
        new = self.__class__(
            self.some_int, some_list_of_objects, some_circular_ref
        )
        new.__dict__.update(self.__dict__)

        return new

    def __deepcopy__(self, memo={}):
        # First, let's create copies of the nested objects.
        some_list_of_objects = copy.deepcopy(self.some_list_of_objects, memo)
        some_circular_ref = copy.deepcopy(self.some_circular_ref, memo)

        # Then, let's clone the object itself, using the prepared clones of the
        # nested objects.
        new = self.__class__(
            self.some_int, some_list_of_objects, some_circular_ref
        )
        new.__dict__ = copy.deepcopy(self.__dict__, memo)

        return new
```
Python oferece uma interface própria de Prototype através das funções "copy.copy" e "copy.deepcopy". A classe que desejar personalizar estas cópias deve sobrescrever as funções "__copy__" e "__deepcopy__".

A função "copy.copy" é considera uma "cópia rasa" e cria um novo objeto preenchendo-o com referências para seus respectivos itens no objeto original. Já a "copy.deepcopy" cria a cópia e a preenche utilizando recursividade.

***
**Referências**
[Padrões de Projeto](https://diogomoreira.gitbook.io/padroes-de-projeto/) (Diogo Moreira, 2020)
[Mergulho nos Padrões de Projeto - v2020-1.14](https://refactoring.guru/pt-br/design-patterns/book) (Alexander Shvets, 2020)
[copy in Python](http://disq.us/t/2fm9r6j)
*Os códigos usados como exemplo foram retirados do livro Mergulho nos Padrões de Projeto.*
Snapd doesn't work on WSL2 Ubuntu20.04
Tags: wsl, ubuntu, snapd, chromium
Published: 2021-01-31 00:15:19

You can't install chromium browser on WSL2 Ubuntsu20.04 because Ubuntsu only support snap version.

```
chromium-browser --headless 

Command '/usr/bin/chromium-browser' requires the chromium snap to be installed.
Please install it with:

snap install chromium
error: cannot communicate with server: Post http://localhost/v2/snaps/chromium: dial unix /run/snapd.socket: connect: no such file or directory
```

You can try this.

```
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME

snap version
```

https://github.com/microsoft/WSL/issues/5126#issuecomment-653715201
`this.something = ‘else’` vs `this.set(‘something’, ‘else’)` in Ember
Tags: ember
Published: 2021-02-01 10:43:06

---
title: `this.something = ‘else’` vs `this.set(‘something’, ‘else’)` in Ember
published: true
date: 2021-01-31 00:00:00 UTC
tags: ember
canonical_url: http://blog.gnclmorais.com/this-set-in-ember
---

I’ve been getting deeper into Ember.js in my new job, and I learn something new every day. Sometimes, things you’ve been using here and there are a bit mysterious. Eventually, either you or someone else notices them and raises insightful questions, like Michal asked on [Ember’s Discord channel](https://discord.com/channels/480462759797063690/480523424121356298/803933292444909610). The question was basically this:

> What’s the difference between `this.something = 'else'` and `this.set('something', 'else')` in tests?

The answer is surprisingly simple (at the surface, we don’t need to get deep into Ember’s reactivity): `this.set` is the way you have to trigger re-render in test. For example, if you set a value with `this.value = 'test'` and render a component that will use that `this.value`, changing the value of `this.value` now **will not** re-render the partial. If, instead, you set that value with `this.set('value', 'test')`, whenever you change it again with `this.set('value', 'something else')`, the template will automatically re-render.

Small caveat (like everything in like): re-rendering will only occur if the value you are reassigning is different that the value previously there, [as it seems](https://discord.com/channels/480462759797063690/480523424121356298/804027937397276690).
Clojure Functions in Four Ways
Published: 2021-02-14 15:58:01

---
title: Clojure Functions in Four Ways
published: true
date: 2021-01-31 00:00:00 UTC
tags: 
canonical_url: https://www.rakeroutes.com/clojure-functions-in-four-ways
---

Perl may have coined TMTOWTDI (there’s more than one way to do it) but Clojure takes that idea and runs very far with it.

Today I’d like to quickly show you four ways to create a function in Clojure.

Each block of code will define a `doubler` function that simply doubles its given integer argument.

# defn

This is essentially the standard way to define a function in Clojure: name, args, function body.

```
(defn doubler [n] (* 2 n))
```

# def and fn

```
(def doubler (fn [n] (* 2 n)))
```

This is a verbose variant of `defn` and is essentially what `defn` is doing behind the scenes. Here we have an anonymous function (the `fn` bound to a name with `def`).

# Function literals

Clojure also allows defining functions with an even shorter syntax than `fn`. The `#` character can define function literals. With that syntax you can’t have named arguments but instead get positional references e.g. `%1 %2 %3`

```
(def doubler3 #(* 2 %1))
```

# Using partial

Now it gets interesting. Clojure provides the most wonderful and excellent `partial` function. The `partial` function accepts a function and some arguments and returns a new function that calls the original function with those originally given arguments plus any remaining required arguments.

Ah it’s hard to explain so I’ll show it: this is `doubler` using `partial`.

```
(def doubler (partial * 2))
```

What’s happening there?

The `def doubler` is simply assigning the name so let’s ignore that.

The real interesting bit

```
(partial * 2)
```

That call to `partial` accepts a function `*` and an argument `2` and returns a new function that will accept more arguments to supply to the `(* 2)` call.

The new function takes any arguments it’s given and supplies them to `(* 2)` as though we had called it directly.

```
(def doubler (partial * 2))

(doubler 10) ; => 20 == (* 2 10)
(doubler 3 4) ; => 24 == (* 2 3 4)
```

You can see it’s not quite the same as the first two `doubler` functions in that it takes any number of arguments. Such is the power and flexibility of `partial`.
How to get all the HTML tags from a website using JavaScript?
Tags: javascript
Published: 2021-01-31 00:00:00

---
  title: How to get all the HTML tags from a website using JavaScript?
  published: true
  tags: JavaScript
  date: Sun Jan 31 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/get-only-html-tags-from-website-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-1a01686c115e0983a3bd730e76b0e5bf.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/get-only-html-tags-from-website-javascript)
  
To get all the HTML tags present in a website using JavaScript, you can use the `getElementsByTagName()` method in the global `document` object and then pass the asterisk symbol `*` as an argument to it.

```js
// Get all HTML tags
const allHTMLTags = document.getElementsByTagName("*");
```

- The method returns an array-like object called `HTMLCollection` which you can also loop to get single tags.

See this example live in [JSBin](https://jsbin.com/kupoweyoze/2/edit?js,console).

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

---