teleren/devto huggingface dataset:
My Path to Tech
Published: 2020-02-14 04:21:05

This is my first Dev community blog post, so let me introduce myself. My name is Nate Hankes. I am a combat veteran and a research and development chemist. Shortly after watching the Netflix documentary, The Great Hack, I decided to embark on my journey to code. I have an entrepreneurial spirit, so the possibilities of forging a path in tech excite me.  

I do not hav tons of coding experience but I can record my learning process. Fortunately, I have a friend in the industry and he gave me three pieces of advice to orient me:

- Download Visual Studio Code (VSC)
- Learn JavaScript
- Build something right away

I set out to build a calculator I could use to complete dimensional analysis problems in my work as a chemist.

After downloading VSC I knew I needed some form of a tutorial to get started on my project. I found **Codecademy** and started the "Intro the JavaScript" tutorial. It was too confusing. All the syntax was so foreign. They mention a console, which I didn't understand. The concepts were not rooted in any relevant information. "Okay," I thought, "So what and where would I put a function?" I retreated and regrouped, coming up with a new approach.

So I went to the HTML tutorial and completed that. I'd heard that HTML was easy and hoped for a confidence boost. I completed the CSS tutorial. At this point, I'd built the visual layout of my calculator and had started finding JavaScript help by lurking StackOverflow whenever I needed to make the calculator do something.

I've published the beta version at [ConversionCalc](http://conversioncalc.com) via zeit.co

I am preparing to begin the vetswhocode bootcamp in 2 weeks. I hope to use my new found knowledge to make the application user friendly, mobile accessible, and intuitive.

I will post weekly to share what and how I am learning. Follow me to keep tabs on the journey.
Why is map called map?
Tags: java, javascript, map, functional
Published: 2020-02-14 04:17:54

---
title: Why is map called map?
published: true
description: The name of the map method doesn't seem to correlate to what it actually does. Here's how it actually got its name.
tags: java, javascript, map, functional programming
---

I've been using the `map` method in Java and JavaScript for a while now, and every time I use it I wonder why was it named "map". It wasn't obvious to me how the name corresponded to the actual functionality.

So, I went to my favorite research site, twitter.com (lol), and asked the community.

{% twitter 1211813484528193536 %}

Within a matter of minutes, I received wonderful replies and all of a sudden, everything made sense!



It's not some relation to the data structure `Map` that I've been using all my life. It's a math term!

{% twitter 1211815082696429568 %}

{% twitter 1211817992700485633 %}

Laurie was even kind enough to let me know I wasn't a total failure for not knowing this.

{% twitter 1211815483646730240 %}

So there you have it folks! Hopefully this was a "TIL" moment for you as well.
When to use .map() and .forEach()
Tags: javascript
Published: 2020-02-14 04:06:31

Map and forEach are both methods to use if you need to execute a function for each element in an array. But why are there two of them? The answer lies in what is returned.

## When to use .forEach()

The definition provided by MDN for .forEach() : **The forEach() method executes a provided function once for each array element.**

In this case, after running through each element, we will execute a function for each element but will not return anything.

[![Image from Gyazo](https://i.gyazo.com/7d7367947038e13620e577b020ae5104.png)](https://gyazo.com/7d7367947038e13620e577b020ae5104)


## When to use .map()

The definition provided by MDN for .map() is: **The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.**

The map() method will allocate space to create a new array and return it after calling a function on each element and populating it. This means we can assign the map function to a variable and that variable will store that array. 

[![Image from Gyazo](https://i.gyazo.com/52ee096216a5dde47aeb062de8439df3.png)](https://gyazo.com/52ee096216a5dde47aeb062de8439df3)


Your needs are dependent on whether or not you need the results of your function to be stored/returned and used later. If it doesn't, use forEach. If it does, use map.
One-liner to update npm dependency packages to the latest version using jq
Tags: npm, javascript, yarn
Published: 2020-02-14 03:11:00

If you have [jq](https://stedolan.github.io/jq/), a lightweight and flexible command-line JSON processor, installed in your computer, it's easy to manipulate the command to update dependencies to the latest version at once.

## Update dependencies

Check:

```sh
cat package.json | jq -r '.dependencies | keys | join("\\n")'
```

Perform installing:

```sh
cat package.json | jq -r '.dependencies | keys | map(. + "@latest") | join(" ")' | xargs npm i
```

## Update devDependencies

```sh
cat package.json | jq -r '.devDependencies | keys | map(. + "@latest") | join(" ")' | xargs npm i
```

## Follow me online

- [Twitter](https://twitter.com/inkdrop_app)
- [Instagram](https://instagram.com/craftzdog)

[![](https://cdn-images-1.medium.com/max/3000/1*Qu0SaHaerZEXEkcehN9EHg.png)](https://inkdrop.app/)

[![](https://cdn-images-1.medium.com/max/2372/1*-J5tp1_lulY9QknoLEv6zA.png)](http://eepurl.com/dNgJo6)

[![](https://cdn-images-1.medium.com/max/3000/1*r-daItizHpAU-fQZk3ISag.png)](https://www.youtube.com/c/devaslife)
Powerful Simple Query
Tags: seo, search, operator, management
Published: 2020-02-14 03:00:17


You would be surprised just how powerful Google is with the correct input, my favorite all-time query is If you run this search query into google and replace the desired input, its a very simple and fruitful query for discovering pages you may have forgot to delete or for discovering intel you did not want public or tried to block, or forgot to delete, or has unintentionally left content others may find extremely interesting, obviously it works in reverse. *wink*

site:google.com -inurl:https & site:google.com -inurl:http

This is a very simple query, that is very powerful.


qldseo.com.au
Where do you get your tech news?
Tags: discuss, news
Published: 2020-02-14 02:53:46

Personally, I pull from a mix of DEV articles, tech-specific podcasts, r/programming, Twitter, and more. 

I’m constantly looking for new ways of broadening what I’m exposed to, and so I’m curious! Where do you get your tech news? Are there certain creators you trust more than others? Do you have a specific avenue you choose if you only have time for one?
#TIL: React's JSX Default Value
Tags: todayilearned, react, jsx
Published: 2020-02-14 02:38:50

---
title: #TIL: React's JSX Default Value
published: true
description: 
tags: til, react, jsx
---

Today I learned about React JSX's default value. 

Consider the `Button` component below:

```jsx
import React from 'react';
import Loader from '../Loader';

function Button ({  loading }) {
 return <button>{ loading ? <Loader /> : 'Click me!'}<button/>
}
```

A huge aha moment moments ago! When you supply props without a value, it will default to `true`.

So in a nutshell, these two JSX expressions below are equivalent:

```
<Button loading={true} />

<Button loading />
```

And so, if you use make use of JavaScript coercion nature. These two JSX expressions are also equivalent.

```
<Button loading={false}/>

<Button />
``` 

Plus tip! If you have type-checking in your React project, this could help.

```
type TButtonProps = {
 loading?: Boolean
}

// So if you do this the type checking won't complain
<Button />
```
JAM Stack == NO APIS @ Runtime?
Tags: jamstack, gastby, html, cdn
Published: 2020-02-14 02:25:11

I read on Jamstack's website that microservice backend APIs = more secure and better than monolithic.  No examples of JAM stack show that it's calling microservice APIs at runtime (aka, on the CDN)

And if it's at deploy time, then that means all the APIs that it uses (unless 3rd party ones) can be private.

I think the JAM stack maybe mixing in ideas of dynamic content by throwing in the idea of microservice APIs to generate the static content when really, it may be more clear to focus on using APIs on deploy time only?

Please tell me if the above sounds crazy. I'm a noob to the #jamstack craze and want to make sure it's clear to me - and hopefully everyone ;)
Server Action in Odoo 11
Published: 2020-02-14 02:09:24

<h4>Server Action</h4>
View -> Python -> act_window
ตัวอย่าง
```xml
<record id="action_server_demo" model="ir.action">
    <field name="name">Test Action Server</field>
    <field name="type">ir.actions.server</field>
    <field name="state">code</field>
    <field name="model_id" ref="my_module.my_model" />
    <field name="binding_model_id" ref="my_module.my_model" />
    <field name="code">records.my_function()</field>
</record>
```

```python
def my_function(self):
    show_ids = [1,2,3,4,5,6]
    return {
        'type': 'ir.actions.act_window',
        'res_model': 'destination_model',
        'views': [[False, 'tree'], [False, 'form']],
        'domain': [['id', 'in', show_ids ]],
        'target': 'new',
    }
```
ใส่สีให้ Record ในหน้า Tree View
Tags: odoo, odoo11
Published: 2020-02-14 01:58:51

<h4>การทำให้ Record ในหน้า View แสดงสีที่ต่างกันออกไปตามสถานะ</h4>

```xml
<record model="ir.ui.view" id="tree_view_with_color">
    ...
    <field name="arch" type="xml">
        <tree 
            decoration-info="state in ['draft']" 
            decoration-primary="state in ['approved']" 
            decoration-warning="state in ['progress']" 
            decoration-success="state in ['done']" 
            decoration-muted="state in ['cancel']">
                ...
        </tree>
    </field>
</record>
```
Criando um "Olá, mundo!" com Golang
Tags: go, helloworld, iniciante
Published: 2020-02-14 01:52:39

Como é o meu primeiro post por aqui, vamos começar do básico. Estou seguindo os passos do tutorial oficial do [GoLang](http://www.golang.org)

Se você ainda não tem o Go instalado no seu computador recomendo seguir este tutorial [GoLangBR](http://www.golangbr.org/doc/instalacao#install).

Com o Go instalado, você deve criar um arquivo (olamundo.go) com o conteúdo abaixo:

```go
package main

import "fmt"

func main() {
    fmt.Printf("olá, mundo\n")
}
```

A saída deste primeiro programa é a seguinte:

```bash
$ go run olamundo.go
olá, mundo
```
How to set up a custom domain on Github Pages
Tags: github, webdev
Published: 2020-02-14 01:28:04

Assuming you have already bought a custom domain (example.net) and a [Github Page](https://pages.github.com/) set up (example.github.io):

## Create a CNAME file

Create a file name `CNAME` in the project's root folder with the custom domain `example.com` inside.

```bash
# Outputs example.net to a file named CNAME
echo example.net > CNAME
```

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

You may need to configure your build command to also copy `CNAME` to the build folder, for example with a `package.json` file with React:
```json
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build && cp CNAME build/CNAME",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }
```
## Configure your domain

At your domain provider (the place you bought the domain - which I recommend [porkbun.com](https://porkbun.com/)), find the configuration for custom host/resource records and set:

```
Type: A
Host: @
Answer/Data/Value: 185.199.108.153
TTL: 30min (or any)
```

Do this for all 4 github page ip addresses: `185.199.108.153`, `185.199.109.153`, `185.199.110.153` and `185.199.111.153`

You'll also need to add this one:

```
Type: CNAME
Host: www
Answer/Data/Value: example.github.io
TTL: 30min (or any)
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/oewpiajem5lvoft1s7rf.png)

## Configure repository

At Github, go to the repository settings and add your custom domain in the Github Pages section.
It might take up to 24h to reflect these and/or HTTPS changes

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

## References:

- [Managing a custom domain for your GitHub Pages site](https://help.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site)
when predatory journalism was 'clever'
Tags: news, proptech, media, publishing
Published: 2020-02-14 01:09:14

“90% percent of stories either shouldn’t have been written or should have been 10% the length. Most people do not want to spend five minutes on 1500 words of mediocrity on something that has one interesting fact, figure or quote." - salon founder Rosenberg.

back when predatory journalism was a display of smarts.... #ick! #gawker

https://lnkd.in/fD4ZNXs
qldseo.com.au
Generate SSH key and add it to the ssh-agent
Tags: devops, architecture, javascript, programming
Published: 2020-02-14 09:39:39

---
title: Generate SSH key and add it to the ssh-agent
published: true
date: 2020-02-14 01:09:00 UTC
tags: DevOps, architecture, javascript,programming
canonical_url: https://boobo94.xyz/devops/generate-ssh-key/?utm_source=rss&utm_medium=rss&utm_campaign=generate-ssh-key
cover_image: https://i0.wp.com/boobo94.xyz/wp-content/uploads/2020/02/generate-ssh-key.jpg?resize=1920%2C884&ssl=1
---

## Generate SSH key

1. Open your terminal
2. Run the following command `$ ssh-keygen -t rsa -b 4096 -C "keyword"`, where keyword can be an email or any word which identify this ssh key. After this command you can see in the console the output `> Generating public/private rsa key pair`.
3. In the next step you need to add the file path where to generate the ssh key `> Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]`. I suggest to create a new file inside `/Users/you/.ssh/` path. Example `/Users/you/.ssh/your-file-name`. Please be advised that `your-file-name` doesn’t have any extension.
4. Setup a password. If you don’t want you can skip this by pressing ENTER.

```
> Enter passphrase (empty for no passphrase): [Type a passphrase]> Enter same passphrase again: [Type passphrase again]
```

## Add SSH key to ssh-agent

Until now you [generated](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) your SSH key. But this key is not active yet. You need to activate it, so execute the command:

```
$ ssh-add -K ~/.ssh/your-file-name
```

## Copy the public key

On your local computer run the following command and copy the output

```
$ cat ~/.ssh/your-file-name.pub
```

## Add the public key on remote server

Then go on your hosting server and open the file `~/.ssh/authorized_keys` with whatever tool you prefer, vim, nano or something else, append at the end of file what you copy previously and save the file.

You’re ready to go and use your new ssh key.

The post [Generate SSH key and add it to the ssh-agent](https://boobo94.xyz/devops/generate-ssh-key/) appeared first on [boobo94](https://boobo94.xyz).
How To Download A File using ReasonML
Tags: reason
Published: 2020-02-14 01:05:29

---
title: "How To Download A File using ReasonML"
published: true
description: "How to prepare any file for downloading!"
tags:
  - "ReasonML"
canonical_url: https://abdisalan.com/posts/how-to-download-a-file-using-reasonml
---
*This article was originally published on [my blog](https://abdisalan.com/posts/how-to-download-a-file-using-reasonml)*

---

The solution is to use javascript. For now.

Some of the methods we use here, such as `Blob` aren't yet implemented in ReasonML (or I just couldn't find them), so we need to put some javascript into our ReasonML code using interop.

Here's a working version using codesandbox you can play with.

[https://codesandbox.io/s/how-to-download-arbitrary-data-reasonml-yoxyg](https://codesandbox.io/s/how-to-download-arbitrary-data-reasonml-yoxyg)

## Javascript Interop

In ReasonML, you can wrap javascript with `[%bs.raw {|  ...code goes here... |}]` and it is accessible to the Reason code.

## How Downloading works

First, we create a blob (Binary Large OBject) with our text MIME type.
```javascript
var content = new Blob(["I AM TEXT"], {type: "text/plain"});
```

Then we create an object url that can reference the data in our Blob and we add this url to the anchor tag.
```javascript
document.getElementById("download")
        .setAttribute("href", window.URL.createObjectURL(content));
```

Lastly, we set the download attribute so that we can name our downloaded file.

```javascript
document.getElementById("download")
        .setAttribute("download", fileName);
```

In conclusion, the link to the blob causes the browser to download the file, and gives it our name.

## All the code together:

### index.html
```html
<html>
<body>
    <a href="" id="download">Download File</a>
</body>
</html>
```
### index.re
```reason
let setupDownload = [%bs.raw
    {|
    function() {
        var fileName = "data.txt";
        var content = new Blob(["I AM TEXT"], {type: "text/plain"});

        document.getElementById("download")
                .setAttribute("href", window.URL.createObjectURL(content));

        document.getElementById("download")
                .setAttribute("download", fileName);
    }
    |}
];

setupDownload();
```
My Notes from the Book, "Read This Before Our Next Meeting", by Al Pittampalli
Tags: meeting
Published: 2020-02-14 00:39:25

---
title: My Notes from the Book, "Read This Before Our Next Meeting", by Al Pittampalli
published: true
description: Meetings are expensive. We need to be effective.
tags: meeting
---

![Read This Before Our Next Meeting](https://dev-to-uploads.s3.amazonaws.com/i/58h1ix1wffx4tbew3i11.jpg)

Meetings are expensive. They break workdays into a series of work moments. Interruptions force us to start over each time.

## 8 Principles of Modern Meetings

1. The modern meeting doesn't make decisions. Leaders do. -- A meeting might be helpful as part of decision-making process, but it isn't the decision-making process itself. Consult the team without calling a meeting. If the decision is of no consequence, don't call a meeting.
2. The modern meeting has 2 primary functions: conflict and coordination. -- For low consequence, the meeting is about  coordination. Get the team on the same page. Allow the team to ask questions, voice concerns, and propose modifications. For high consequence, the meeting is about conflict. Encourage a robust, honest debate. Have the team submit their own thoughts about the issues before the meeting. Ask pros and cons. Let the best decision prevail, even if it's not yours.
3. The modern meeting moves fast and ends on schedule. -- Spend the time wisely since every minute costs us a fortune.
4. The modern meeting limits the number of attendees. -- Invite only people who are absolutely necessary. Don't waste the others' time.
5. The modern meeting rejects the unprepared. -- Prepare the agenda and a set of background materials. Every meeting should require pre-meeting work. If someone comes unprepared, cancel the meeting or hold it without him.
6. The modern meeting produces committed action plans. -- Actions should be clear for all. If no action plan is necessary, neither is a meeting.
7. The modern meeting refuses to be informational. Reading memos is mandatory. -- We must commit to reading the memos. Treat this agreement very seriously.
8. The modern meeting works only alongside a culture of brainstorming. -- Brainstorm is so crucial to the success of meeting. Modern meeting is focused in decision.

## Initiate a Meeting?

1. Determine that the meeting is necessary?
2. Make a list of people to invite.
3. Create a detailed agenda.
4. Ask yourself again. Is the meeting really necessary?

## How to Decide When We Have a Decision to Make?

* Can I make this decision myself?
* Is this a decision of high, low, or no consequence?
* If a group is necessary, how and when should I involve them?
* Does the opinion of someone else matter? Or are facts sufficient?
* Can I do this with a series of one-on-one conversations instead of a meeting?
* How much time should this decision take?

This book helps me a lot and I hope it does the same for you. 😃
Published First Crate on Crates.io
Tags: rust, opensource, tutorial, motivation
Published: 2020-02-14 19:17:43

---
title: Published First Crate on Crates.io
published: true
date: 2020-02-14 00:00:00 UTC
tags: rust, opensource, tutorial, motivation
canonical_url: https://tjtelan.com/blog/published-first-crate-on-crates-io/
---

I published [my first public crate](https://crates.io/crates/git-url-parse). I thought my library was useful, general, and did not have a similar implementation in crates.io. I hoped that it may get used by the Rust community. It turned out to be very easy to package and upload my code, and I wanted to share my process.

## Complete Cargo.toml with package metadata

https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata

I tried to define the metadata completely. Other than writing the code, this took the longest time. I wanted to make sure the crate listed in an appropriate category. As well as using relevant keywords.

(My very first version did not have a README or fancy build badges, but I did have docstrings for docs.rs)

## Generate API Key and log in from cargo

Crates.io only supports logging in using Github accounts.

Navigate to Account Settings and scroll down to the _API Access_ section. Click new token and give your token a name.

After giving your token a name, there is going to be a `cargo login` command with a random token value. Run this command to log in.

## Run cargo publish

My crate was at the top of the new crates column of crates.io

Like I mentioned earlier, I had doc strings in my code that I expected to publish to docs.rs. This can take a few minutes. Wait a few minutes. It’ll make it there.

I later followed up with writing a complete README.md, and added badges. That’s all it took to make my little library look fancy.

If you were on the fence about publishing to crates.io, I hope you are now convinced that it was not.

* * *

#### Before you go, some info about my crate:

[git-url-parse](https://crates.io/crates/git-url-parse).

I wrote it because common ssh-based git repo urls don’t fit a standard like:

- [the living URL standard](https://url.spec.whatwg.org/)
- [RFC 1738](https://tools.ietf.org/html/rfc1738)
- [RFC 1808](https://tools.ietf.org/html/rfc1808.html)
- etc.

As such, parsing is not supported by many languages’ standard library, including Rust.

Anyway, I hope you'll check it out! Thanks!