teleren/devto huggingface dataset:
Git 2.23.0のswitchとrestoreについて
Tags: git
Published: 2020-03-26 00:16:31

Git 2.23.0で追加されたswitchとrestoreについての個人的なメモ
*個人的なメモなので従来のやり方は私が普段使ってたコマンドだし、ここに書いてないことも色々追加されているが使っていないので割愛。*

背景: [Highlights from Git 2.23](https://github.blog/2019-08-16-highlights-from-git-2-23/)
マニュアル: [switch](https://git-scm.com/docs/git-switch/2.23.0), [restore](https://git-scm.com/docs/git-restore/2.23.0)
マニュアルには**THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.**と書かれているので、それなりの覚悟で使用してください。

## switch

- 今まではブランチを切り替えるのには`git checkout`を使用していたが、 `git switch`でできるようになった。

```console
$ git switch my-feature

Switched to branch 'my-feature'

Your branch is up to date with 'origin/my-feature'
```

- 今までは新規のブランチを作成し、ブランチを切り替えるのには`git checkout -b`を使用していたが、`git switch -c`でできるようになった。
*`-b`は`--branch`の省略。`-c`は`--create`の省略。*

```console
$ git switch -c my-new-feature

Switched to a new branch 'my-new-feature'
```

## restore

- 今までは現在のディレクトリ内のすべてのファイルを復元するには`git checkout .`を使用していたが、 `git restore .`でできるようになった。
- 今までは作業ディレクトリの内容を変更せずにHEADを指定されたコミットを指すように変更するには`git reset`を使用していたが、 `git restore --staged .`でできるようになった。

## 所感

switchはいいと思う。restoreは今も昔も同じく難しいのでは？...
gcloud コマンドで複数アカウントで異なるプロジェクトを設定する
Tags: gcp, gcloud
Published: 2020-03-26 00:05:59

個人と会社のアカウントなど、複数のアカウントで異なるプロジェクトを設定する方法について。

# gcloud config configurations でアカウントとプロジェクトを追加する

gcloud config 管理には configurations という単位でアカウントとプロジェクトをまとめて管理できる。

```
$ gcloud config configurations list
NAME           IS_ACTIVE  ACCOUNT                           PROJECT           DEFAULT_ZONE       DEFAULT_REGION
default        True       m-yoshimoto@company.xxx.jp        product-A         asia-northeast1-b  asia-northeast1
```

リスト表示すると最初に作成した configurations が [default] として表示されている。
ここに configurations を追加していく。
やることは至って簡単で下記で出来る。

```
$ gcloud config configurations create {configurations-name}
$ gcloud config set project {project-name}
$ gcloud config set account {email-address}
```

実際に追加した時のコマンド実行結果がこちら。

```
$ gcloud config configurations create private-study

$ gcloud config set project private-1
Updated property [core/project].

$ gcloud config set account m-yoshimo-new@gmail.com
Updated property [core/account].

$ gcloud config list
[core]
account = m-yoshimo-new@gmail.com
disable_usage_reporting = True
project = private-1

Your active configuration is: [private-study]

$ gcloud config configurations list
NAME           IS_ACTIVE  ACCOUNT                         PROJECT           DEFAULT_ZONE       DEFAULT_REGION
default        True       m-yoshimoto@company.xxx.jp      product-A         asia-northeast1-b  asia-northeast1
private-study  True       m-yoshimo-new@gmail.com         private-1
```

zone や region は適宜、```gcloud config set compute/zone {zone-name}``` 等で設定すればよい。
Highlight your code in Gatsby
Tags: gatsby, markdown, prismjs
Published: 2020-03-30 20:40:50

---
title: Highlight your code in Gatsby
published: true
date: 2020-03-26 00:00:00 UTC
tags: gatsby, markdown, prismjs,
canonical_url: https://www.raufsamestone.com/highlight-your-code-in-gatsby/
---

## Different the basic and highlighted code block:

Here is the basic HTML code block;

`yarn upgrade-interactive`

Here is the **Highlighted** style;

```javascript
yarn upgrade-interactive
```

## Plugin

With your **markdown** resolver used in Gatsby, you must integrate the plug-in.

For this we will need the plugin `gatsby-remark-highlight code`.

Plugin details on GitHub:[https://github.com/deckgo/gatsby-remark-highlight-code](https://github.com/deckgo/gatsby-remark-highlight-code)

## Install

```javascript
yarn add gatsby-transformer-remark gatsby-remark-highlight-code @deckdeckgo/highlight-code
```
       
## Configure


```javascript
//gatsby-config.js
plugins: [
  {
    resolve: `gatsby-transformer-remark`,
    options: {
      plugins: [
        {
          resolve: `gatsby-remark-highlight-code`,
          options: {
            terminal: 'ubuntu'
          }
        },
      ],
    },
  },
]
```         

## Usage

Add the following in the blog post template or main layout.js.

```javascript
async componentDidMount() {
    try {
        const deckdeckgoHighlightCodeLoader = require("@deckdeckgo/highlight-code/dist/loader")
        await deckdeckgoHighlightCodeLoader.defineCustomElements(window);
    } catch (err) {
        console.error(err);
    }
}
```

And then wrap your code blocks, on your Markdown file.
Step-by-step Guide to Acing your Remote Interview
Tags: career, hiring, computerscience, interview
Published: 2020-03-25 23:54:11

**This video is packed with specific tips for rocking your remote interview, including:**
 - What to ask recruiters ahead of time
 - How to prepare
 - How to connect with interviewers using simple DIY audio/visual improvements
 - What to do during the interview to impress your interviewer
 - How to ace the coding section now that it's not a whiteboard \o/

**CANDIDATE PLANET:**
Empowering candidates to ace interviews and negotiate offers. We answer questions from anyone, and have had great results working with engineers, developer advocates, designers, marketers, managers, recruiters, and many more. 

Leave a comment or email Lusen@CandidatePlanet.com with questions you want us to answer.

**SUBSCRIBE:**
☆ Youtube ☆ https://youtube.com/channel/UCdvny6qs...
☆ Newsletter ☆ https://dangoormendel.com/newsletter

**MORE ABOUT US:**
☆ Website ☆ https://dangoormendel.com
☆ Speaking Inquiries ☆ lusen@candidateplanet.com
☆ Client Inquiries ☆ hello@dangoormendel.com
☆ LinkedIn Lusen ☆ https://linkedin.com/in/lus
☆ LinkedIn Adam ☆ https://linkedin.com/in/adamdangoor
☆ Twitter Lusen ☆ https://twitter.com/staycalmcomic
☆ Twitter Adam ☆ https://twitter.com/AdamDangoor

{% youtube ZWHTt6Kn00w %}
Why Figma deserves my time?
Tags: design, ux, productivity, figma
Published: 2020-03-25 23:29:51

I have been dabbling with Adobe XD recently coming from Sketch and found the interface to be very user-friendly. After going through a bunch of tutorials about XD and with plans to build UI prototypes in it, I came across Figma. It was highly recommended by multiple folks and was dubbed as "highly collaborative". With my current workplace also giving out accounts, I thought why not give it a shot? Turns out, Figma is indeed highly collaborative in nature. It is like Google Docs for design. I was genuinely surprised to see multiple folks accessing the document at the same time, highlighted by coloured cursors with their names on it. Supporting Single-Sign-On (SSO) also helps with a faster login process. Having all my documents available through the browser was an excellent feature which I can also use through a desktop shell that is available to download, for those who prefer such an interface.

The UI preview feature works quite well and the ability to create high fidelity icons is a plus. Being able to see the CSS properties for different elements makes the process of translation to code quite easy. It is also helpful to see the relative distances between elements just by clicking and moving the cursor between elements.

Being able to share the designs with other by just a simple hyperlink is very powerful compared to sharing huge file blobs. It makes it so much more easier to share updates rather having to worry about different versions. For me, it makes the whole collaboration process much simpler and aids with faster iteration.

The only feature that I miss in Figma is the ability to add micro-interactions like a hover effect when the user moves the mouse pointer over an element, or a toggle state to highlight an action has happened. Introducing this feature would give designers an extra tool to communicate their ideas with developers especially to improve the user interaction.

Other potential features that I think would make a difference is the ability to generate a design system from the figma document that has all the common styles. This could be a combination of one or more SASS or LESS files. Right now it has to be manually generated by the developers to be used in a web application. If it was automatically generated based on an easy to use convention, making sweeping style changes to an application would be deterministic and easy to be done.

Being able to extend Figma through an API or plugins would make it easier for designers and developers to implement workflows that align to their organisational structure and way of doing things. After all, any productivity gains, is time saved!

I look forward to my journey with Figma and creating designs for new apps with it. The team behind Figma has been very receptive to feedback and understand good design. I look forward to the updates to the product and what others in the industry do with it!
Moment of appreciation for the small design change GitHub made a little while back around "Changes requested"
Tags: ux, github
Published: 2020-03-25 23:24:12

This icon used to be a big red "X", which was very aggressive in design—Really the opposite of what we want as people in this situation.

![](https://github.githubassets.com/images/modules/site/product-illo/img-clear-feedback.png)

The design changed a little over a year ago, and I just felt like pointing out that the change is still a big improvement. It's especially important we be able to communicate our intent when we aren't able to interpret tone.
Will I Ever Go Back to Medium? Yes, Sort of. [SHORT ANNOUNCEMENT]
Published: 2020-03-25 23:08:16

Okay, so a bit of a weird announcement. I am more or less going back to Medium, kind of full time. I am not leaving dev.to anytime soon, unless something massively better comes in. I love Markdown, I hate how Limited Medium feels. I would be having to join a major, partially established publication on Medium to get any use there. Oh.

Recently I have been approached by Analytics Vidhya to write every-so-often for them. I won't be posting my opinions there, at least for the most part. Now it won't be too common, but every so often, after they approached me about my last or second to last Medium article before switching to dev.to one of their people came and asked me for them to have that article in their publication, and while I didn't agree to work with them fully, or even part-time, it is something I will do every so often to keep my brain busy during this whole lockdown because of Coronavirus situation. That's the situation, thought i'd mention it.
A dificuldade de escolher uma linguagem de programação para estudar
Tags: javascript, career, devrel
Published: 2020-03-25 23:06:36

PHP,JavaScript,Java,C#,Python..

Uma diversidade de linguagens faladas, divulgadas, criados todos os dias no universo da programação.

A faculdade ensina algo que muitas vezes nem chega a ser usado no mercado de trabalho, passamos horas vendo tutoriais sobre determinado assunto do qual não iremos mais utilizar.

Nas redes sociais diversos programadores divulgam e incentivam o aprendizado de tecnologias seja para vender um curso, seja porque trabalha com a tecnologia há anos e muitas vezes acham que a sua é melhor do que outra e em hipótese alguma deve ser utilizada outra.

Pra um iniciante que chega nesse mundo sem saber o que fazer pode ser que no futuro isso se torne frustante ou bata o arrependimento de passar horas estudando algo sendo que aquela vaga que apareceu nem pede a linguagem estudada.

Com diversas ferramentas criadas sinto falta de um sistema que liste as tecnologias mais utilizadas em uma determinada região do país e das cidades de cada estado.

Talvez isso se torne um projeto para o futuro..Quem sabe!?
Mas se você como eu já pensou ou pensa da mesma forma que eu ou até mesmo diferente?
Que tal batermos um papo?
What is FTP (File Transfer Protocol)?
Published: 2020-03-25 22:41:21

FTP is an acronym for File Transfer Protocol. As the name suggests, FTP is used to transfer files between computers on a network. You can use FTP to exchange files between computer accounts, transfer files between an account and a desktop computer, or access online software archives. Keep in mind, however, that many FTP sites are heavily used and require several attempts before connecting.

#How to use FTP?

##Graphical FTP clients
Graphical FTP clients simplify file transfers by allowing you to drag and drop file icons between windows. When you open the program, enter the name of the FTP host (for example, ftp.microsoft.com) and your username and password. If you are logging into an anonymous FTP server, you may not have to enter anything. Two common FTP programs are Cyberduck (for Mac) and WinSCP (for Windows).

##Web browser
You can use a web browser to connect to FTP addresses exactly as you would to connect to HTTP addresses. Using a web browser for FTP transfers makes it easy for you to browse large directories and read and retrieve files. Your web browser will also take care of some of the details of connecting to a site and transferring files. While this method is convenient, web browsers are often slower and less reliable and have fewer features than dedicated FTP clients.

To use your web browser to connect to an FTP site such as ftp.empire.gov, where you normally enter a URL, enter:

ftp://username@ftp.empire.gov/

##Command-line FTP
Windows, macOS, and Linux have built-in command-line clients; see Common FTP commands. For example, to start FTP, at the command-line prompt, enter:

ftp ftp.empire.gov
If you are connecting to your own account, enter your username and password. If you are connecting to an anonymous FTP site, for your username, enter anonymous. For your password, enter your email address.
Check it out to learn more about [FTP](https://www.onlinetoolsexpert.com/ftp-protocol-specifications/).
Day 102 : Look Deeper
Tags: hiphop, code, coding, lifelongdev
Published: 2020-03-25 22:30:48

_liner notes_:
- Professional : Had a meeting with the team. We talked about the tutorial I was reworking. After the meeting, we decided to go in a different direction, so I basically spent the day re-reworking the tutorial. Got it done and when I went to push the PR, the build failed. I noticed some other builds failed, and told a teammate. After a look deeper, turns out that an update to a dependency removed the version of a package that we use to build the deployments. So yeah, that happened. haha Also, my first blog post written as a JavaScript Developer for the company went live today. It's on Web Components. If you want, you can check it out here: https://www.nexmo.com/blog/2020/03/24/getting-started-with-web-components-dr Any feedback is greatly appreciated. That was cool.

- Personal : Last night, I jumped back into an old side project I never finished to get it started again. Not going to lie, what I built was pretty awesome! haha. Only thing is that a template I was using with Polymer has been deprecated. Think I'm going to stick with it for now since I was using Redux for state management and would be too much of a hassle to start over. We'll see.

![The mountains of Aconcagua, Argentina](https://dev-to-uploads.s3.amazonaws.com/i/mppaggn4ywk90h8poxh9.png)

Going to keep working on the old side project and try to get it deployed this week so I can start gathering data. Then, I'll probably go to sleep. haha

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube dWZvknaXk-4 %}
Quick Python: Length of Iterables
Tags: python
Published: 2023-01-06 01:35:51

---
title: Quick Python: Length of Iterables
published: true
date: 2020-03-25 22:28:09 UTC
tags: Python
canonical_url: https://brandonrozek.com/blog/pyleniterables/
---

I wanted to find the length of what I know is a finite iterable. Normally you would think of using the `len` function but it does not work in this case. [Al Hoo](https://stackoverflow.com/a/44351664) on StackOverflow shared a quick snippet to calculate this.

```
from functools import reduce

def ilen(iterable):
    return reduce(lambda sum, element: sum + 1, iterable, 0)

```

This also turns out to be memory efficient since we are only loading in one object into memory from the iterable at a time.
SSH Tunneling via a Jump Host
Tags: linux, beginners
Published: 2020-03-25 21:50:12

Many large companies use to implement strict rules for accessing servers hosting their applications. One of the security measures some of them implement is to place a gateway between "you" and the server you need to access. This gateway is also known as Jump server, Jump host, or Jump box.

A typical implementation of this requires you to, firstly, open an SSH connection to the Jump host with your own credential and, secondly, from the inside of the Jump host, open a second SSH connection to the actual server you need to access with another account (usually a non-personal account which can be the user used to deploy and run your application).

Let's suppose that you work in a company like this and that you want to create an SSH tunnel to port 1521 of an Oracle Database Server which is only accessible from your application server. What you need to do is to create an SSH tunnel like this:

![SSH Tunneling via Jump Host](https://imgshare.io/images/2020/03/25/ssh-tunneling-via-jump-host-2.png)

The following command creates this SSH tunnel via the Jump host (you will be prompted for the users' password):

```bash
$ ssh -v -N appusr@appserver -J myusr@jumphost -L 1521:dbserver:1521
```

With this command, you are tunneling the port *1521* of *localhost* to the port *1521* of *dbserver*.

In other words, you are firstly doing an SSH connection to *jumphost* with user *myusr*, then another SSH connection to *appserver* with user *appusr*, and finally forwarding port *1521* from localhost to *dbserver*.

This command is being executed in verbose mode (*-v*), which is useful for debugging, and not returning the shell prompt of the *appserver* but just forwarding the port (*-N*).

After this, you can then use your preferred SQL client tool to connect to the remote database server as if it was running on *localhost:1521*.
How important is accessibility for you as a developer?
Tags: discuss, android, a11y
Published: 2020-03-25 21:49:45

This is targeted for Android Developers, but if you have accessibility knowledge in any framework, please feel free to take part.

I am in a process fixing several accessibility issues of my company's app and have been looking at resources, tutorials and articles to learn more. 
This discussion in intended to collect some insights on the following areas of accessibility:

* How do you feel about accessibility?
* How accessible is your android app?
* What accessibility issues are you prioritizing?
* How are you verifying the accessibility fixes?
* Any pending future enhancements on your TODO list?
* Any useful resources you want to share :)

Thank you!
Managing multiple Git identities
Tags: git
Published: 2020-03-30 20:18:26

---
title: Managing multiple Git identities
published: true
date: 2020-03-25 21:49:00 UTC
tags: git
canonical_url: https://www.geewiz.dev/2020/03/25/managing-multiple-git.html
---

I’ve always been struggling to use the right name and email address, separate between work and personal projects, for each of my Git repositories. Micah Henning solved that problem nicely by removing the global settings but making a repo-specific configuration mandatory. And a handy alias is the icing on the [Git identity selection](https://www.micah.soy/posts/setting-up-git-identities/) cake.
Angular 9 Updates
Tags: angular
Published: 2020-03-25 21:33:13

Just like anything in tech, the more one does something the easier it gets. 

 [Angular 9 updates](https://update.angular.io/#7.0:9.0) from version 7 or 8 to 9 have a few *finer points* one learns after a while.

**Get to latest version of 8 first**

For both versions 7 and 8. Switch to the directory of the project to be upgraded where the package.json file is located. 

```
ng update @angular/cli@8 @angular/core@8
```
The results you get may vary dependent on how many things are in your package.json file. We ignored a number of warnings and went on to Angular 9. Thinking we would address later. (may not have been best choice, but it seemed to work for us)

**Then move up to Angular 9**
The guide on the site says this should work.
```
ng update @angular/cli @angular/core
```
After the update finishes (if everything works) type in 

```csharp
ng --version
```
You should see something like this:

Angular CLI: 9.0.7
Node: 12.14.1
OS: win32 x64

Angular: 9.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.7
@angular-devkit/build-angular     0.900.7
@angular-devkit/build-optimizer   0.900.7
@angular-devkit/build-webpack     0.900.7
@angular-devkit/core              9.0.7
@angular-devkit/schematics        9.0.7
@ngtools/webpack                  9.0.7
@schematics/angular               9.0.7
@schematics/update                0.900.7
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Good so far right?  Well not exactly...

If you move back a directory or two and type in ng --version again you may see something different. This is because your global version is different. To fix that, you have to run:
```
npm install @angular/cli@^9.0.0 -g
```
Now you should have both the developer and global versions in sync. 

Finally, if you have any issues where the upgrade failed, run it again with the 
--force option. 

JWP2020
How to Fix Git Always Asking for User Credentials
Tags: git, github, cli
Published: 2020-03-25 21:20:10

---
title: How to Fix Git Always Asking for User Credentials
published: true
description: "Have you ever encountered Git asking you for your username and password every time you try to interact with GitHub even after configuring it? Well, this is a very common problem among users who use the HTTPS clone URL for their repository. In this article, I'll show you how to fix this."
tags: [git, GitHub, CLI]
canonical_url: "https://bolajiayodeji.com/how-to-fix-git-always-asking-for-user-credentials-ck25r1l9m00f8rjs1dkxkuy4d"
---

Have you ever encountered Git asking you for your username and password every time you try to interact with GitHub even after configuring it? Well, this is a very common problem among users who use the HTTPS clone URL for their repository. In this article, I'll show you how to fix this.

---

The `https://` clone URLs are available on all public and private repositories. These URLs work everywhere, even if you are behind a firewall or proxy.

![](https://res.cloudinary.com/bolaji/image/upload/v1570636713/null/blog/0003/01.png)

When you interact with a remote repository using HTTPS URLs on the command line, you'll be asked for your GitHub username and password, this sucks right?

Well using an HTTPS remote URL has some advantages: it's easier to set up than SSH :), and usually works through strict firewalls and proxies. However, it also prompts you to enter your GitHub user credentials every time you pull or push a repository :(.

## You can fix this by configuring Git to store your password for you.
---
Here's how:

- Update the URL of origin remote using SSH instead of HTTPS;

```bash
git remote set-url origin git@github.com:username/repo.git
```
or

- Make Git store the username and password and it will never ask for them. 

```bash
git config --global credential.helper store
```


- Save the username and password for a session (cache it);

```bash
git config --global credential.helper cache
```

- You can also set a timeout for the above setting

```bash
git config --global credential.helper 'cache --timeout=600'
```

Bingo, you just fixed it, Git will never ask for your credentials again.

---

## Conclusion
However, due to security reasons, it is advisable that you use SSH to interact with GitHub, especially if you work for a company or you're using a computer that isn't yours.

Using the SSH protocol, you can connect to GitHub without supplying your username or password every time. Learn how to connect to GitHub with SSH [here](https://help.github.com/en/articles/connecting-to-github-with-ssh)