teleren/devto huggingface dataset:
Describe your commits using Gitmoji
Tags: git, programming, gitmoji
Published: 2021-08-20 17:07:53

---
title: Describe your commits using Gitmoji
published: true
date: 20/08/2021
tags: Git,Programming,gitmoji
canonical_url: https://www.elian.codes/blog/20-08-21-describe-your-commits-using-gitmoji/
---

# Describe your commits using Gitmoji

Describing your commits can be a difficult task. You can write down everything you changed or improved, or you can let the code speak for itself. [Gitmoji](https://gitmoji.dev) makes this a whole lot easier by using emoji.

## What is Gitmoji

Gitmoji is a simple way to categorize commits or pull requests in an instance without a describing text. It uses emoji's linked with a description to categorize the changes made in one commit. If you're thinking that your commit should have more than one Gitmoji, you're probably making too big commits, but if you really want to, you can always add more than one to the commit message. After some time of using Gitmoji, you won't even need to think about them anymore and it goes quite natural

## Why I love Gitmoji

For me personally, it's so awesome to scroll back into a timeline of commits and instantly get an idea about what all those commits are. This also translates to searching something you changed some commits ago; although you could use `git blame` or use an extension like gitlens for that.

### How I use Gitmoji

When you check the commits of the public repository of this very site, you'll instantly see every commit has a Gitmoji. If you know what they mean, you'll even have an idea what they all (roughly) are about.

If you are a regular visitor of [this blog](<https://www.elian.codes/blog/>), you might have noticed that I use the same system to categorize my blogposts. In this way, a user can just search using an emoji instead of a keyword and still find related articles to that topic. Awesome right!

### Some of my most used Gitmoji's

- 🔍 do some SEO work
- 👷‍♂️ work on CI-CD
- 🐛 fix a bug
- ✨ introduce new features
- ♻ do some refactoring
- 🚑 hotfixes
- 🔧 configuration work
- 💄 work on UI
- ⬆ upgrade packages
- 📝 textual work (like blogposts)
- 🍱 asset updates

For a full list and description, see the [gitmoji.dev](http://gitmoji.dev) site
Machine Learning VS Deep Learning
Tags: machinelearning, ai, deeplearning, data
Published: 2021-08-19 23:17:26

![1_OjS7yWF6neu4CR5rowvYKg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22omdfg4ycyjm2q6oe0b.png)
If you’ve been paying attention to the news, you’ve undoubtedly come across the term “deep learning” in relation to artificial intelligence. Deep learning is a relatively new technology and those who are unfamiliar with it are likely to be misinformed.
The precise meaning of the term is that it is the successor of machine learning. This is completely false.
Deep learning is a machine learning approach. Machine learning is a method for achieving artificial intelligence. To put it another way, deep learning isn’t a replacement for machine learning; it’s a component of it.
Deep learning techniques rely on several layers and employ parallel programming to reach a high level of accuracy, you will need a lot of neural networks and millions of examples of training data, not hundreds or thousands target(image recognition, language translation, etc).language translation, etc).
How to write JavaScript code inside the HTML itself?
Tags: html
Published: 2021-08-20 00:00:00

---
  title: How to write JavaScript code inside the HTML itself?
  published: true
  tags: HTML5
  date: Fri Aug 20 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/write-javascript-code-inside-html
  cover_image: https://melvingeorge.me/_next/static/images/main-1c0cfd7fbb204cdaff2c6edfd786e949.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/write-javascript-code-inside-html)
  
To write JavaScript code inside the HTML template itself, we can use the `script` tag inside the HTML template and write the JavaScript code inside the `script` tag block.

### TL;DR

```html
<!DOCTYPE html>
<html lang="en">
  <script>
    // Your JavScript code can written inside this script tag
    console.log("Hello World from JavaScript");
  </script>
  <body>
    Hello World from HTML
  </body>
</html>
```

For example, let's write a basic small HTML template which shows the `Hello World` like this,

```html
<!DOCTYPE html>
<html lang="en">
  <body>
    Hello World from HTML
  </body>
</html>
```

Now to write the JavaScript code in the HTML template first we have to write a `script` tag. It can be done like this,

```html
<!DOCTYPE html>
<html lang="en">
  <script>
    // Your JavScript code can written inside this script tag
    console.log("Hello World from JavaScript");
  </script>
  <body>
    Hello World from HTML
  </body>
</html>
```

As you can see we have defined a `script` tag in the `<script></script>` format above the `body` tag.

- **You don't have to write the `script` tag before the `body` tag. You can insert the `script` tag anywhere in the HTML template and it will work. **

Now if you look in the browser console we can see the `Hello World from JavaScript` output which shows us that the JavaScript code has been executed successfully.

See the above code live in [JSBin](https://jsbin.com/cesideyape/3/edit?html,console,output).

That's all 😃!

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

---
Went on a quest to make the most realistic, satisfying virtual fidget spinner!
Tags: adhd, productivity, react, javascript
Published: 2021-08-19 23:46:59

Hey all,

I taught myself to code around a year a half ago, and a few weekends back I wanted to build something creative...so thought I'd try and make the most realistic, satisfying, virtual fidget spinner.

I know the fidget spinner craze was a while back but I still use my physical spinner, as well as a fidget cube, and poppit all the time!

Anyway, just wanted to share, as I'm pretty proud of it, and thought maybe others here might appreciate it.

https://fidgetpage.com

It's using React, React Spring and a really cool library I found called Propeller to create the inertia effect.

To make it feel even more realistic I added a fidget spinner sound effect from freesound.org (a great resource for sounds!) and made the volume increase as it spins faster.

Would love to hear what you think!

(Full disclosure, it does mention another product I'm making, but that's seperate and not required at all to use the fidget spinner)
Testing loader.io after installing NGINX (how to install loader.io & NGINX)
Published: 2021-08-19 23:39:33

**Challenge**
I had to connect my current servers to the NGINX and implement horizontal scaling.
Figuring out NINGX and its loadbalancers
Also testing it using loader.io

**Action**
How I installed nginx
1. SSH into your NGINX instance: ssh -i *.pem ubuntu@<public-ip>
2. Install NGINX after update & upgrade: sudo apt install nginx
3. Run NGINX: sudo systemctl start nginx
4. get into file: sudo vim /etc/nginx/sites-enabled/default
5. delete everything and replace it with this:

```
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m max_size=10g
                 inactive=60m use_temp_path=off;

upstream sdcgroup {
  least_conn;
  keepalive 500;
  server 18.191.246.18:3000;
  server 3.22.221.100:3000;
  server 18.221.27.16:3000;
}

server {
  listen 80 backlog=4096;
  gzip on;

  location /products {
    proxy_cache_valid any 10m;
    proxy_cache_valid any 10m;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_pass http://sdcgroup;

    proxy_cache my_cache;
    add_header X-Cache-Status $upstream_cache_status;
  }

  location /loaderio-ab8120fd9cc113d34d4a5b9796fb3c65 {
    return 200 'loaderio-ab8120fd9cc113d34d4a5b9796fb3c65';
  }
}
```

restart NGINX: sudo systemctl restart nginx

How to use loader.io: After sign up, you'll see verification page

In server repo, set up

```javascript
  app.get(`/${LOADERIO_KEY}`, (req, res) => {
    res.send(LOADERIO_KEY);
  })
```

Time to test using loader.io

First Attempt (5k/sec for 1 minutes using products/%{*:1-1000000})
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/du5438fnzvuyhcd6c6zp.png)

Second Attempt (2k/sec for 1 minutes using products/%{*:1-500})
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7kf2b41d09j9b5z4yt9i.png)

I added ip_hash above least_conn
Third Attempt (10k/sec for 1 minutes using products/%{*:1-500})
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifwaw2obkc1am4yu7y4v.png)

ip_has with least_conn works!!!

Fourth Attempt (10k/sec for 1 minutes using products/%{*:1-1000000})
It failed
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hi69q83rpvlvfgei4jd9.png)

Fifth Attempt (5k/sec for 1 minutes using products/%{*:90000-1000000})
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3h3fhaqpbseaxerpvla7.png)
too high error rate

Sixth Attempt (1k/sec for 1 minutes using products/%{*:1-1000000})
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/av6z6ntqjo7jl4xe4wi2.png)

**Result**
Now server can handle 1k request per second with 0% error rate and it can go up to 10k request per second with 0% error rate if we are only using 500 products
Can't bind to 'ngModel' since it isn't a known property of 'input'
Published: 2021-08-19 23:34:36

For using [(ngModel)] in Angular 2, 4 & 5+, you need to import FormsModule from Angular

example:

**import { FormsModule } from '@angular/forms';**

@NgModule({imports: [
    [...]
    FormsModule
  ],
  [...]
})
isJson([InsertEscapedString]) = true?  Really?
Tags: coldfusion, json
Published: 2021-08-19 23:03:52

I was processing data that a third-party was posting to our endpoint and quickly identified that the JSON data was a "quoted + escaped string of JSON-appearing data" rather than a valid JSON string containing either an array or objects.

```
{"name":"Mr. Test"}         //This is what I was expecting.
"{\"name\":\"Mr. Test\"}"   //Bad JSON, right? Nope. It's valid.
"\"this is a test\""        //Apparently this is valid JSON too.
```

If I use ColdFusion's [isJSON()](https://cfdocs.org/isjson), it returns `true`. I tested this in [TryCF.com](https://www.trycf.com/) and both ACF10-2021 and Lucee agreed that an escaped string of text (without any objects) was valid JSON. I compared the results against a couple of other online JSON validators and they also agreed that it was valid... except for the following services.
- https://www.jsonschemavalidator.net/
- https://elmah.io/tools/json-formatter/

If I saved the string into SQL Server AS-IS and attempt to use `JSON_VALUE` to retrieve the data, it will either throw an error or not return anything... so if MSSQL doesn't agree that it is JSON, how can it pass an isJSON() validation test?

JSON is built on [two structures](https://www.json.org/json-en.html); a collection of name/value pairs or an ordered list of values.  A simple escaped value does not meet the above definition. The "O" in JSON stands for "object". If the deserialized value isn't an "object", it's probably not JSON.

Is this a bug?  I'm wondering why ColdFusion doesn't perform an extra test to determine if the value returns `true` for either `isStruct()` or `isArray()` rather than blindly claiming that any escaped string is valid JSON. I've reported other issues in the past with ColdFusion's black box validation of integers, emails, URLs and dates and have had to write my own user-defined functions to work around inconsistencies so that I could use CF-validated values with third-party services that adhere to more stricter standards of validation.

Thoughts?
Cache temporário das credenciais GIT – username e password
Tags: git, github, credential
Published: 2021-08-21 16:30:48

---
title: Cache temporário das credenciais GIT – username e password
published: true
date: 2021-08-19 22:37:53 UTC
tags: Git,Github,Gitlab,credential
canonical_url: https://mazer.dev/cache-temporario-das-credenciais-git-username-e-password/
---

![CTA do artigo Git Credentials Cache](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gm0kk08n0g9774yobdyi.png)

Existem situações em que você precisa trabalhar com um repositório [GIT](https://mazer.dev/git-basico) usando o [protocolo HTTPs](https://mazer.dev/protocolo-http) e não pode armazenar permanentemente as credenciais de usuário na configuração local. Uma solução é armazenar em um cache temporário as credenciais (username e password – senha) por um tempo limitado. 

` git-credential-cache` é o auxiliar que vamos usar para armazenar temporariamente as senhas na memória.

## O comando git-credential-cache

Este comando armazena credenciais na memória para uso por um determinado tempo do programa Git. 

As credenciais armazenadas nunca são armazenadas em disco, sendo esquecidas após um tempo limite configurável. 

O cache pode ser acessado por meio de um soquete de domínio Unix, restrito ao usuário atual por permissões do sistema de arquivos.

## Exemplo

O objetivo em utilizar esse _helper_ é diminuir a quantidade de vezes que precisará digitar usuário e senha em um espaço de tempo curto, por exemplo, quando está fazendo ajustes de deploy em um servidor de testes.

Confira o exemplo de uso a seguir:

```bash
git config credential.helper cache
git push https://gitlab.com/palavrasagrada.git
Username: <seu nome de usuário>
Password: <sua senha>

[passados 5 minutos]

git push https://gitlab.com/palavrasagrada.git
[Suas credenciais em cache serão utilizadas automaticamente dentro do prazo limite]
```

[Continue a ler o artigo completo em »Cache temporário das credenciais GIT – username e password](https://mazer.dev/cache-temporario-das-credenciais-git-username-e-password/)

---

O post [Cache temporário das credenciais GIT – username e password](https://mazer.dev/cache-temporario-das-credenciais-git-username-e-password/) apareceu primeiro em [MAZER.DEV](https://mazer.dev).
Update Firestore Document Flutter
Published: 2021-08-20 17:45:51

---
title: Update Firestore Document Flutter
published: true
date: 2021-08-19 22:30:00 UTC
tags: 
canonical_url: https://mukhtharcm.com/update-firestore-document-flutter/
---

Updating documents in Firestore is pretty easy.

One method is to use the `update` function available in Firestore Library.

## Update Method

Let’s look at an example by using the NoteModel class we created in [Adding Data to Firestore article](https://dev.to/mukhtharcm/adding-dart-objects-to-firestore-in-flutter-1keb-temp-slug-4797401)

```
final _db = FirebaseFirestore.instance;
NoteModel noteToUpdate = NoteModel(
title:"This is an Awesome Title",
content:"This is the Content of the Note",
);
await _db.collection("notes").doc("doc-id").update(noteToUpdate.toMap());

```

The above function will update the document with the document id we passed with the new data.

> The One thing we should consider here is that, if there is no document existing with the document Id we provided, our **Update will Fail**.

This brings us to the second option.

## Set Method

As I have pointed out in the [article about adding data to Firestore](https://dev.to/mukhtharcm/adding-dart-objects-to-firestore-in-flutter-1keb-temp-slug-4797401), set function can be used to Add document with a custom Id to Firestore Collections.

It is also useful for updating a document. For that we have to pass `merge:true` into `setOptions`.

If we didn’t pass the `merge:true`, the older document will be completely overwritten. But if we did this, the document will only update with new Data.

And this method **will create a new document** if no other document exists with the given document Id.

```
final _db = FirebaseFirestore.instance;
NoteModel noteToUpdate = NoteModel(
title:"This is an Awesome Title",
content:"This is the Content of the Note",
);
await _db.collection("notes").doc("doc-id").set(
noteToUpdate.toMap(),
SetOptions(
merge: true,
),
);

```

The above code will update a document if it exists and will create a new document if it exists.

## Wrap

You can find more articles related to Firebase [Here](https://mukhtharcm.com/tags/firebase/)

Hope you found something useful here.

I’m always open to suggestions!

Let me know your suggestions and opinions on [Twitter](https://twitter.com/mukhtharcm) DM or drop a mail a [mukhtharcm@gmail.com](mailto:mukhtharcm@gmail.com).

If you’re feeling too generous, you can support me through [Buy Me a Coffee](https://buymeacoffee.com/mukhtharcm).

Finally, if you found this helpful, please share this within your reach so that more people can benefit from this. And Follow me on [Twitter](https://twitter.com/mukhtharcm) for getting more posts like these 😉.
RxJS Operator: concatMap
Published: 2021-08-19 20:58:41

The `concatMap` RxJS Operator is a higher-order mapping operator that processes each emitted value in order and waits for its inner Observable to complete before processing the next item.

For example:

```TypeScript
products$ = this.categorySelected$
  .pipe(
       concatMap(catId=>
            this.http.get<Product[]>(`${this.url}?cat=${catId}`))
  );

```
In the above code, the `concatMap` will perform the HTTP get and wait for the response before processing the next item emitted from `this.categorySelected$`.

##How Does concatMap Work?##

We can think of the concatMap like a relay race: the next runner can't start until the prior runner completes. And the runners cannot run out of sequence.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3mphi7bsop65f2x362wx.png)

##Let's look at an Example##
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6armjetvmriql1953hv1.png)
In this example, the user clicks the category with an id of 2, changes their mind and picks 3, then decides they really want category 1.

Following the numbers on the screen shot above: 
- The concatMap issues a get request for category 2, 
- waits for the response, 
- then issues a get request for category 3, 
- waits for the response, 
- then issues a get request for category 1, 
- and waits for the response.

For this specific example, where the user can change their mind on the selected category, using concatMap doesn't make sense. It takes too long for each selection to be processed and returns results that are no longer needed.

##When Should We Use concatMap?##
The concatMap is great for things like updates or deletes where you want to ensure that each request completes before the next one begins.

It's also great any time that the request/response order matters.
Misc: Possible Ways to Add
Tags: java, algorithms, career, python
Published: 2021-08-19 21:41:34

This is part of a series of Leetcode and other curated solution explanations (index).
If you liked this solution or found it useful, please like this post.

## Problem
A very interesting and fairly easy question which I found during one interview was:

> A batsman can score either {1,2,3} runs in a ball. Find the number of ways he can score "X".

**Other variants** - Given possible coins 2, 3, 5 - how many ways can result in a sum of 43

If you got stuck thinking or applying permutations and then visualizing it in code - just look at this simple code

## Solution

```java
    static int possibleWaysToReachScore(List<Integer> runs, int x) {

        // table[i] will store count of solutions for value i.
        int[] table = new int[x + 1];

        // Initialize all table values as 0
        Arrays.fill(table, 0);

        // Base case (If given value is 0)
        table[0] = 1;

        // One by one consider given runs
        // and update the table[]
        // values after the index greater
        // than or equal to the value of
        // the picked move
        runs.forEach(
                n -> IntStream.rangeClosed(n, x)
                        .forEach(i -> table[i] += table[i - n])
        );

        return table[x];
    }
```

## Explanation:
- given we have 1,2,3 and we want say 10 runs, we start with a dp array which will store all possible ways to get to the index (which represents the runs).
so, naturally `table[0]=1` 

- iteration for n = 1
 - loop from 1 -> 10 and sum `i + (i-1)`
   - table[1] = table[1]+table[0] = 1
   - table[2] = table[2]+table[1] = 1 and so on...
   - table[10] = table[10]+table[9] = 1
- iteration for n = 2
 - loop from 2 -> 10 and sum `i + (i-2)`
   - table[2] = table[2]+table[0] = 1+1 = 2
   - table[3] = table[3]+table[1] = 1+1 = 2
   - table[4] = table[4]+table[2] = 1+2 = 3, 3
   - table[6] = table[6]+table[4] = 1+3 = 4, 4
   - table[8] = table[8]+table[6] = 1+4 = 5, 5
   - table[10] = table[10]+table[8] = 1+5 = 6
- iteration for n = 3
 - loop from 3 -> 10 and sum `i + (i-3)`
   - table[3] = table[3]+table[0] = 2+1 = 3
   - table[4] = table[4]+table[1] = 3+1 = 4
   - table[7] = table[7]+table[4] = 4+4 = 8
   - table[10] = table[10]+table[7] = 6+8 = 14


then we loop over the range n (the current score possible till  required score)

in the end we will have a dp containing all ways to reach any number till X
`[(0=1), (1=1), (2=2), 3, 4, 5, (6=7), 8, 10, (9=12), 14]`


## Additional Info
of course, another variant of the same problem is Given possible scores a batsman can score in one ball is {1, 2, 3}, how many ways can he score X runs in B balls - that is a tough one to explain!

but here's the solution nonetheless!
[GeeksForGeeks](https://www.geeksforgeeks.org/number-of-ways-of-scoring-r-runs-in-b-balls-with-at-most-w-wickets/)
My zuri internship goals
Published: 2021-08-19 21:30:14


My name is Uzomba onyekachi victor and I'm an intern at zuri HNGI internship, Currently a student of Federal University of technology owerri studying computer science.

HNG Internship is a virtual internship for people learning to code and design. It focuses on the post-training phase, and creates a virtual work environment for participants.

I will like to join the UI/UX stack and My zuri internship goals are:
1. To learn how to work in a team, gaining experience while working with people to understand how to imbibe the culture of teamwork
2. I want to be able to design  UI/UX design at the end of this 8 months
3. I want to learn how to work under pressure with my teammates and be able to deliver a given task beautifully in the given time frame.
4. I want to grow my knowledge on design concepts and implementation

If you would like to know about this internship, you can click on any of the following links: https://zuri.team or https://internship.zuri.team or https://training.zuri.team.

Also, you can follow any of the tutorial link below to catch up on some technologies used in this internship:

Figma: https://trydesignlab.com/figma-101-course/introduction-to-figma/ or https://www.headway.io/event-series/figma-tutorials-for-beginners

GIT: https://www.freecodecamp.org/news/the-beginners-guide-to-git-github/

HTML: https://blog.hubspot.com/website/html

Python: https://www.freecodecamp.org/news/the-python-guide-for-beginners/

GO Lang: https://www.educative.io/blog/golang-tutorial

PHP: https://www.tutorialrepublic.com/php-tutorial/

NodeJS: https://www.cloudbees.com/blog/node-js-tutorial

Flutter: https://dev.to/idrisadeyemi01/beginners-guide-to-flutter-16de

victor.uzomba@yahoo.com