teleren/devto huggingface dataset:
globalThis is coming to JavaScript
Tags: javascript, webdev, node, learning
Published: 2019-11-21 15:49:08

---
title: globalThis is coming to JavaScript
published: true
description: The ECMAScript standard is constantly changing. Next up, globalThis!
tags: javascript, webdev, node, learning
---

One of the first things we learn with JavaScript is the keyword `this`. What is tricky to understand at first is that its definition is always different. It depends on the scope we're accessing it in. 

Well, in all projects there is a "global" `this`. But it's called something different depending on what context you're in. On the web you may be familiar with it as the `window` object. In other contexts it's [`self`](https://developer.mozilla.org/en-US/docs/Web/API/Window/self) and sometimes it's `this`!

As it turns out, there is a function that's been refined over time to always access it.

```javascript
var getGlobal = function () {
	if (typeof self !== 'undefined') { return self; }
	if (typeof window !== 'undefined') { return window; }
	if (typeof global !== 'undefined') { return global; }
	throw new Error('unable to locate global object');
};
```

Not exactly pretty. And a pain to include in every project.

But no more! Now at stage 4, [`globalThis`](https://github.com/tc39/proposal-global) is the latest addition to ECMAScript.
Day 10 of⚡️ #30DaysOfWebPerf ⚡️: <picture>
Tags: webperf, performance, images, webp
Published: 2019-11-21 15:43:09

{% twitter 1197540223288332288 %}
{% twitter 1197540232826101761 %}
{% twitter 1197540268058271744 %}
{% twitter 1197540270583296000 %}

P.S. Sorry for the delay - I was locked out of Twitter for a week!
Debugging/fixing a legacy application is like getting ready for work on a winter morning
Tags: legacy, debugging, humor
Published: 2019-11-21 15:38:46

You wake up and immediately trip over the dog. You apologize to the dog, get up off the floor, and stumble into the bathroom. (Open the project and the IDE claims everything is broken)

You start the shower, but there's no hot water. (Missing dependency?)

You check the water heater: the heating element is broken. You make a note to replace it, and go take a cold shower. (Referenced dependency version is out of date and unsupported--no time to test the latest version)

You finish washing up, and start getting dressed, and--oh, the cat puked in your good shoes. Fine, sneakers for today. (Deprecated framework call that made a function easy to understand--replaced with hacky but workable code)

You go downstairs and make a cup of coffee. This part goes just fine. (Persistence layer builds successfully. Hopefully everything else will work?)

You go out to the car. It starts. (Service layer builds and runs)
The garage door won't open. You manually open it. (firewall on your development machine blocked the service port--had to add an exception)

You drive to work, uneventfully (all test cases check out).

The doors are locked and no one is there. You call your manager who tells you that the whole area's power is out and won't be fixed for days--go home. Apparently you didn't get the company-wide text and email alert. (Project shelved until client fixes other infrastructure problems. No one told you until the project status meeting got canceled.)
Charming the Python: Builtins and Variables
Tags: python, beginners
Published: 2019-11-21 15:24:17

*If coding tutorials with math examples are the bane of your existence, keep reading. This series uses relatable examples like dogs and cats.*

---
### Builtin Functions

```Python
print("words")
>>> words
```

```Python
min(10, 20, 30, 40)
>>> 10
```

```Python
max(10, 20, 30, 40)
>>> 40
```

```Python
sum([10, 20, 30, 40])
>>> 100
```

### Variables
-   must start with a letter or underscore
-   cannot start with a number
-   only contain letters, numbers, and underscores
-   case-sensitive

---
Series based on {% post https://dev.to/asabeneh/30daysofpyton-challenge-43ii %}
Excel Add-ins Now Support PostgreSQL 12 & HubSpot Web Login
Tags: excel, postgres, databaseadministration
Published: 2019-11-21 15:20:51

---
title: Excel Add-ins Now Support PostgreSQL 12 & HubSpot Web Login
published: true
description: Devart introduced updated Excel Add-ins, which got PostgreSQL 12 support, HubSpot web login, and a range of other important improvements.
tags: Excel, PostgreSQL, database administration
---

*Devart introduced updated Excel Add-ins, which got PostgreSQL 12 support, HubSpot web login, and a range of other important improvements.*

Devart, a recognized vendor of professional database management software, recently released a significant update of [Excel Add-ins 2.1](https://www.devart.com/excel-addins/), the set of tools allowing to work with databases and cloud data in Microsoft Excel as with usual Excel spreadsheets. The update has brought PostgreSQL 12 support, HubSpot web login, and some other important improvements.

The key enhancements in Devart Excel Add-ins include:

**PostgreSQL 12 Support** — now users can utilize Excel Add-ins with the latest version of PostgreSQL 12, a powerful open-source object-relational database system that has already earned a strong reputation for its reliability and performance.

**HubSpot Web Login Support** — there’s no need to obtain HubSpot API Key and enter it to connect to HubSpot anymore. Instead, users can select the RefreshToken authentication, complete Web Login, and grant Excel Add-ins access to HubSpot.

**Server-to-server Authentication for Salesforce Marketing Cloud** — for this authentication, users need to open the Advanced connection parameters and select ServerToServer in the Authentication Type parameter. After that, specify the Marketing Cloud subdomain, client ID, and client secret from the Salesforce Marketing Cloud application center in the corresponding parameters.

Learn more about the recent update on the Devart official blog – https://blog.devart.com/excel-add-ins-2-1-with-postgresql-12-support-hubspot-web-login-and-other-improvements.html

**About Devart**

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.
For additional information about Devart, visit https://www.devart.com/
Haskell Stack and Package Management
Tags: explainlikeimfive, haskell
Published: 2019-11-21 15:03:08

# Backstory:
So I know the somewhat very basics of haskell, and for a small program that I wanted to do I found a function in a library (the function was `chunksOf` form `Data.List.Split`, which was it's own confusing thing since for the looks of it the package name is `split`).
So I tried to look for a package manager, which lead me to stack. Now I tried to work with it but I don't want to build a massive project, I just want to experiment around a bit.
# Confusion:
* I do not understand the whole project structure (there is a lot of indirection and I can't tell even to which file I should be writing my code, it's a small thing I only want one file and one function from one lib).
* Why is there not a simple package installer alternative, I feel the tool is getting in my way more than it's helping.
* I find that this is more of a general haskell thing but I do agree that although it's hard documentation is good the soft one is lacking and I think it's what I'm feeling now.
# TL;DR:
I don't understand stack

`PS: Sorry if this is too long this is my first post, I'm not sure how this works`
Set Max date to Today's date
Tags: date, html, weird
Published: 2019-11-21 14:57:56

Client requested for the maximum date to be selected in the date field will be of today. So we did this - 

```
var today = new Date();

var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
                            
today = yyyy + '-' + mm + '-' + dd;

<input max="` + today + `" />
```

It worked for us!
Charming the Python: the basic basics
Tags: python, beginners
Published: 2019-11-21 14:54:55

*If coding tutorials with math examples are the bane of your existence, keep reading. This series uses relatable examples like dogs and cats.*

---
## Background

I have experience with Python, but saw this 30 day challenge and decided it could only help.

{% post https://dev.to/asabeneh/30daysofpyton-challenge-43ii %}

So, I went to the [challenge content](https://github.com/Asabeneh/30-Days-Of-Python), added the [Telegram group](https://t.me/ThirtyDaysOfPython), and started to read day 1.


Link: [Day 1 content](https://github.com/Asabeneh/30-Days-Of-Python#day-1)
Note: This challenge was built to be beginner friendly and help people learn Python.

## Day 1 Topics

 - installing python
 - a simple script in IDLE
 - addressing a syntax error
 - math operators
 - commenting
 - installing VS Code
 - starting with VS Code
 - Data Types
 - Exercises

> link to [day 1 material](https://github.com/Asabeneh/30-Days-Of-Python#day-1)

### Math Operators
#### Addition `+`
```python
a =  3
b =  4
print(a + b)  # 3 + 4 = 7
```

#### Subtraction `-`
```python
a =  3
b =  4
print(a - b)  # 3 - 4 = -1
```

#### Muliplication `*`
```python
a =  3
b =  4
print(a * b)  # 3 * 4 = 12
```

#### Division `/`
```python
a =  3
b =  4
print(a / b)  # 3 / 4 = .75
```

#### Exponent `**`
```python
a =  3
b =  4
print(a ** b)  # 3 ** 4 = 81
```
The `**` is taking care of the exponent. If broken down it would look like `3 * 3 * 3 * 3`

#### Modulo `%`
```python
a =  10
b =  3
print(a % b)  # modulo 10 % 3 = 1
```
Use this operator if you only want the remainder or whats left over after the division. In this example, we've done `10 / 3` which give us 3 groups of 3 and a remainder of 1. 

This could be used dividing time. You can use the remainder for the next smaller unit of time.

#### Floor Division `//`
```python
a =  10
b =  3
print(a // b)  # floor division 10 // 3 = 3
```
This is important to use when you can only have whole things. For example you can't have .5 of a person or .2 of a plane. So, you would round down so you're only using whole people and whole planes.

---
### Data Types

| Type | What | Example |
|--|--|--|
| Integer | whole numbers | `1` |
| Float | decimals | `1.1` |
| Boolean | True or False | `True` |
| String | characters in quotes | `"4 bunch of ch4r4ct3r5!"` |
| List | in order; may have different data types | `['Dog', 9, False, 3.142]` |
| Dictionary | key:value pairs | `{"name":"Wiley", "breed":"unknown", age:2, "is_nuetered":True}` |
| Tuple | cannot be changed | `('Vicki', 1992, 'E5')` |
| Set | may only have unique elements and may store different data types | My name is Vicki, but a set would be `{'v', 'i', 'c', 'k'}` |

---
Series based on {% post https://dev.to/asabeneh/30daysofpyton-challenge-43ii %}
Daily Challenge #122 - Clockwise Spirals
Tags: challenge
Published: 2019-11-21 14:49:24

---
title: Daily Challenge #122 - Clockwise Spirals
published: true
series: Daily Challenge
description: Complete a function `createSpiral(N)` that receives an integer `N` and returns an `NxN` two-dimensional array with numbers `1` through `NxN` represented as a clockwise spiral.
tags: challenge
---

Your objective is to complete a function `createSpiral(N)` that receives an integer `N` and returns an `NxN` two-dimensional array with numbers `1` through `NxN` represented as a clockwise spiral.

Return an empty array if `N < 1` or `N` is not int / number

Examples:

`N = 3` `Output: [[1,2,3],[8,9,4],[7,6,5]]`

1    2    3    
8    9    4   
7    6    5    

`N = 4 Output: [[1,2,3,4],[12,13,14,5],[11,16,15,6],[10,9,8,7]]`

1   2   3   4
12  13  14  5
11  16  15  6
10  9   8   7

`N = 5 Output: [[1,2,3,4,5],[16,17,18,19,6],[15,24,25,20,7],[14,23,22,21,8],[13,12,11,10,9]]`

1   2   3   4   5    
16  17  18  19  6    
15  24  25  20  7    
14  23  22  21  8    
13  12  11  10  9    

***
_This challenge comes from alex.budiakov on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Placeholder not grey enough
Tags: html, placeholder, weird
Published: 2019-11-21 14:36:09

Got a request from a client asking to change the placeholder color. Apparently, they are getting confused by the color of the title of the input box and it's placeholder. :P


So this is what worked.

```
::placeholder 
{
  color: red;
}
```

Though still not sure what the :: does.

Anyways it worked!
Use em For Padding and Margin
Tags: css, beginners, webdev
Published: 2019-11-21 14:15:10

You'd probably use em for padding and margin before. However, do you know how is it calculated?

Take this html:
```html
<div id="container">
    <div id="box"></div>
</div>
```
And the following css rules:
```css
    #box { 
        border: 1px solid blue; 
        padding: 3em; 
    }
```
As I inspected the padding in the computed tab of dev tools, I see #box has 48px padding each side. 

![padding](https://thepracticaldev.s3.amazonaws.com/i/h4azos6pfji5vwbvkbjd.png)

This is because when you set padding using em, it will take the font size of that element as base and multiple with the multiplier (3).

Since I didn't specify any font size, the default 16px from the browser is applied. 16 * 3 = 48.

Now let's add the following rule:
```css
    #container {
        font-size: 30px;
    }
```

The padding of each side of #box is now 90px (30 * 3). #box inherited font size from its parent, #container.
![Font size increase](https://thepracticaldev.s3.amazonaws.com/i/kyp76cqo7ehdfxgwl1xp.png)

Finally, let's set font size for #box while keeping font size for #container at 30px.

```css
    #box {
        font-size: 10px;
    }
```

Can you guess the value of padding on each side of #box now?

------------------------

If your answer is 30px, you are correct.
![padding based on font size](https://thepracticaldev.s3.amazonaws.com/i/0x8gb0c0opqubgxtvzbp.png)
Remote Jobs, the new future of developers
Tags: remote, career, productivity
Published: 2019-11-21 13:57:44

Hello fellas, today I want to talk you about what is a trend today but will become a basic standard in the coming years, Remote Jobs.

We know in these days many software development companies are hiring remote workers as a little tendency, but in a brief future this can be change to become a basic standard, but the question is why? Why this could be happen?

To understand why, we need to focus first in the actual software development sector, principally in the technology towns, like the best known, Silicon Valley. But if you are a developer in Silicon Valley wouldn't you be living a King with a Salary over 100 K/Year right? Well, reality is so far of it.

Many people in Silicon Valley can live decently, but what about money saves? What about family, a house, a decent life style (not an expensive one). Can you afford that?

The true is that probably not, since only the rent would be something like 5 K/Month (in a house with other people), which is a lot, and after taxes you will be saving something like 7-25 K/Year, all this for a minimum of 120 K/Year salary. Does it make it worth it?

So, all what companies need is good workers, and good workers need good life styles, therefor would not be better to live in a cheaper place earning what you worth? Here is where Remote Jobs plays the role. Eventually people will wake up, and they will get tired of the real-state bubble, then they will start working remotely, and companies will need to start improving they requirements to hire the best Remote Workers over Landed workers.

My point is, that You as worker should be preparing yourself for this, and you as a Business man with a brightness company should be thinking on hiring by now remote workers to get used to this new tendency and don't get eventually overwhelmed.

Soonly I will share a post with the best places to live as Software Remote Developer, cheapest, safest and of course with a good food.

Best Regards
I really, *really* don't like hamburger menus
Tags: webdev, design, navigation
Published: 2019-11-21 13:51:54

---
title: I really, *really* don't like hamburger menus
published: true
description: That little icon irks me to no end.
tags: #≡ #webdev #design #navigation
---

# ≡
We all know the infamous hamburger menu. It's those three lines that stretch horizontally, that tries to look like a vertical list. It's become incredibly ubiquitous ever since website had to update their websites to support mobile resolutions.

And I hate it. I despise it. The user-experience is terrible; why hide such an import piece of your website behind a mandatory interaction? Do you have more than four items? Having more then four/five items in a menu will overwhelm many people, so maybe you should not even bother.
Why not show the four most important items, and hide the rest behind a menu? You don't have to hide your entire menu. Let people click on 'Contact' without first having to wade through the terrible experience of opening a drawer.
Why not use a horizontal scrolling menu? It's sleek, and doesn't overwhelm the user.

They're also nearly always at the top of the page. That was fine when phones where smaller, but with the current trend of tall and big phones (not to mention smaller tablets) it takes me having to reorient my hand to get to it.

Hamburger menus add bulk, they add useless complexion. They add a terrible interaction that should have never existed in the first place.

But I have to use it, because clients demand it. Because it's recognisable.

Do any of you have any tips how to deal with this?

---

I haven't written many posts. Would you like to read more things? About JS, ES6, ReactJS, Preact, (S)CSS? Might be able to whip something up if you want, so let me know.
Apache Lenya
Published: 2019-11-21 13:48:28

Well now with CWI you can, and build a pretty darn good java based dynamic site! CWI is proud to embrace Apache Lenya, a Content Management System (CMS) https://www.change-and-achievement.com/gadgets/ . This differs from the vast horde of other open source CMS solutions available, as it is Java based. Rather than being based on Zope or written in PHP, Lenya is totally based on XML, XSLT and other related open standards. It also supports browser based inline WYSIWYG editors, such as Xopus, Bitflux and Epoz.

Being based around the Cocoon project gives Lenya greater flexibility in dynamically distributing content. Lenya takes advantage of this framework by storing all content as XML, and transforming it on the fly when required by clients. Lenya then intuitively caches the results of the transformation, to be quickly reused if needed. For example, it is capable of translating to HTML or PDF, prior to delivering. Having used programs backed by the Apache foundation for many years on our hosting platforms, we believe in the stability of Lenya.s solid Jakarta components. Furthermore, a comprehensive suite of unit tests create a highly effective means of determining what impact any of your shenanigans would have on the code! Bad days happen, and if you are having a really bad goober day, the unlimited rollbacks, it.s built in revision control, and scheduler can help keep you on track. Different workflow areas for live editing, and for authoring is a great feature as well!
Best analogy for Authentication vs Authorization I've found so far
Tags: security, authentication, authorization, analogy
Published: 2019-11-21 13:38:20

After some thinking and some google searches I think I've found a very good analogy for representing **authentication vs authorization**. I'll stick to this, seems like a good mental model.

The analogy is found here: https://www.okta.com/identity-101/authentication-vs-authorization/

It roughly goes like this: 

- You go visit your neighbor. You knock at his door. 

- He looks through the peephole, and then he *recognizes* you (**authentication**). 

- He *opens* the door and invites you in. 

- You talk to him and start feeling comfortable, so you go sit on the sofa. He has no problem with this (**you are authorized** to do this). 

- You even use his toilet (**still authorized**). 

- After some time you feel hungry and try to open his fridge to have a look. He stops you and says that you are not allowed to do this (**not authorized**). Maybe his best friend is allowed... (**he might be authorized**)
How to have better code reviews & tips for junior developers
Tags: todayilearned, beginners, career
Published: 2019-11-21 13:00:01

*TL;DR style notes from articles I read today.*

### [Code reviews at Medium](http://bit.ly/335KtTN)

- When making a change that affects the UI, include a screenshot, and preempt questions. 
- Add a description of why the change you made was needed. 
- Encourage quick reviews (at least one person responding within 4 hours). 
- Build in small increments and request small PRs to move faster.
- Promote a ‘safe to try’ culture where developers feel free to make a call on which approach of solving a problem they take. 
- Code reviewers don’t act as gatekeepers. They act as enablers. 

*[Full post here](http://bit.ly/335KtTN), 5 mins read*

---

### [How to be a better code reviewee](http://bit.ly/2XykV0n)

- Write tests before committing the code. Submit code and then test it together for review. 
- Use descriptive commit messages. Group similar changes with a description for each group. 
- Limit the code to review so that your reviewers are not too overwhelmed and have time & patience to consider the logic & depth of your code. 
- Don’t take comments personally. Provide resources and arguments to defend your choice if you believe you are right.
- Take difficult problems or conflicting views offline. You will achieve consensus faster by discussing in person than over comments. 

*[Full post here](http://bit.ly/2XykV0n), 5 mins read*

---

### [Just keep coding! - A letter to junior developers](http://bit.ly/2Xx1Coi)

- Develop the willpower, voraciousness, and ambition to learn more and the willingness to go the extra mile. 
- Building a solid developer career is not easy or quick but the three most important factors are in your control: self-motivation, self-discipline, and focus.
- The beginner stage is hard in terms of getting, retaining and understanding lots of information every day.
- Enjoy the process, rather than focusing on the results. 
- Plan first, then code. When working on a problem, think of the different ways to solve it and don’t just go with the first solution you think of. 

*[Full post here](http://bit.ly/2Xx1Coi), 5 mins read*

---

*[Get these notes directly to your inbox every weekday by signing up for my newsletter, in.snippets(), here.](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
[Vim問題] カーソルがファイルのどの位置にあるか知る方法は？
Published: 2019-11-21 12:52:48

この記事では、Vim / neovimでプラグインを使わずに「カーソルがファイルのどの位置にあるか知る」ためのキーバインドおよびコマンドについて、ご紹介します。 [解答] Ctrl + g / :file / g Ctr

つづきは[こちら](https://vim.blue/vim-file-word-byte-count/)。
[https://vim.blue/vim-file-word-byte-count/](https://vim.blue/vim-file-word-byte-count/)
[Vim問題] カーソルを入力した1文字へ移動させるキーバインドとは？
Published: 2019-11-21 12:52:31

この記事では、Vim / neovim でプラグインを使わずに「カーソルを入力した1文字へ移動させる方法」ためのキーバインドについて、ご紹介します。 [解答] f または F Vimキーバインド1. 次(右)に現れる文字

つづきは[こちら](https://vim.blue/vim-motion-find/)。
[https://vim.blue/vim-motion-find/](https://vim.blue/vim-motion-find/)
[Vim問題] 検索結果の選択ハイライトを消す方法は？
Published: 2019-11-21 12:52:13

この記事では、Vim / neovim でプラグインを使わずに「検索結果の選択ハイライトを消す」ためのコマンドについて、ご紹介します。 [解答] :nohlsearch Vimコマンド （ノーマルモード） :nohlse

つづきは[こちら](https://vim.blue/vim-no-highlight-search/)。
[https://vim.blue/vim-no-highlight-search/](https://vim.blue/vim-no-highlight-search/)
Oni (OniVim) &#8211; Vimベースの多機能エディタ
Published: 2019-11-21 12:51:56

VScodeユーザーが入りやすい Vim系エディタの一つとして、Oni をご紹介します。 概要：Oni (旧: OniVim)とは？ Oniは、VSCode / Atom / LightTable / Emacs に影響

つづきは[こちら](https://vim.blue/oni-vim-like-editor/)。
[https://vim.blue/oni-vim-like-editor/](https://vim.blue/oni-vim-like-editor/)