teleren/devto huggingface dataset:
英文をブログURLに適した形式に変換するPythonスクリプト
Tags: python, programming, japanese
Published: 2021-05-25 23:54:08

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

Python script to convert English text to a format suitable for blog URLs

こんにちは。shootaceanです。

ブログ記事を書いた後にはURLを決める必要がありますが、
その際に活用できるPythonスクリプトを紹介します。

Pythonを実行する環境さえあればコピペだけで真似できるので、ぜひ試してみてください。

以下のPythonコードを main.py というファイル名で保存します。

```python
import sys

def convert(title: str) -> str:
    """英文を記事URLの形式に変換する"""

    newTitle = title.lower()
    newTitle = newTitle.replace("/", "-", -1)
    newTitle = newTitle.replace(" ", "-", -1)
    newTitle = newTitle.replace("'", "", -1)
    # 他に変換したい文字がある場合は、ここに追記していく
    # newTitle = newTitle.replace("変換前の文字", "変換後の文字", -1)

    return newTitle

if __name__ == "__main__":
    
    # コマンドライン引数を受け取る ( sys.argv[0]はプログラム名なので使用しない )
    if (len(sys.argv) == 2):
        # 引数が1つの場合は、そのまま使用する
        title = sys.argv[1]
    else:
        # 引数が2つ以上の場合は、文字列として連結する
        title = " ".join(sys.argv[1:])

    print(convert(title))
```

以下のコマンドで実行できます。
実行すると変換後の文字が表示されるので、それを記事URLとして使います。

```shell
$ python3 main.py "Your Blog's Title"
your-blogs-title

$ python3 main.py Your Blog\'s Title
your-blogs-title
```

以上これだけです。

> ブログ記事のURLを決める

という作業は今後頻繁に行っていく作業なため、早い段階で自動化した方が時間の節約になります。

プログラムとしては単純なものなので、活用していただければ嬉しいです。

## この記事で試してみた例

`英文をブログURLに適した形式に変換するPythonスクリプト`

というブログタイトルを翻訳ツールで翻訳すると、

`Python script to convert English text to a format suitable for blog URLs`

となりました。
その英文をPythonスクリプトで変換してみると

```shell
$ python3 blog_title.py Python script to convert English text to a format suitable for blog URLs
python-script-to-convert-english-text-to-a-format-suitable-for-blog-urls
```

という感じで変換され、

`python-script-to-convert-english-text-to-a-format-suitable-for-blog-urls`

という記事URLとして利用できる形式になります。

## 変換する文字を追加したい場合

上記のPythonコード内の

> 他に変換したい文字がある場合は、ここに追記していく

と記載されている行へ以下のように追記していきます。

```python
# 他に変換したい文字がある場合は、ここに追記していく
# newTitle = newTitle.replace("変換前の文字", "変換後の文字", -1)
# ダブルクォートを削除する
newTitle = newTitle.replace("\"", "", -1)
```

## 参考
- [sys — System-specific parameters and functions — Python 3.9.5 documentation](https://docs.python.org/3/library/sys.html#sys.argv)
- [Pythonでコマンドライン引数を扱う方法（sys.argv, argparse） | note.nkmk.me](https://note.nkmk.me/python-command-line-arguments/)
- [Pythonのif __name__ == "__main__" とは何ですか？への回答 - Python学習チャンネル by PyQ](https://blog.pyq.jp/entry/Python_kaiketsu_180207)
Do WordPress Developers Care About Pirated Copies of Their Plugins & Themes?
Tags: discuss, wordpress, webdev, piracy
Published: 2021-05-25 23:41:18

[WordPress](https://wordpress.org) has a grand ecosystem. And there are lots of premium plugins and themes with which you can make your WordPress site better and beautiful.

I am wondering how do developers solve the piracy problem? Is there a better licensing system? Or some platform that lets you monitor sites using nulled/cracked version of your plugins or themes.
Entendendo as funções Map, reduce e filter
Tags: javascript, programming, webdev, functional
Published: 2021-05-25 23:30:09

A vida de um programador é baseada em alterar um array quase todos os dias. Quem nunca precisou extrair um dado de alguma API que retorna um array gigante?. 

No post de hoje vou contar um pouco de cada função de manipulação de array.

## MAP

É possível percorrer todos os item do array, executar alguma transformação nesses itens e retornar um novo array sem modificar o atual.

VAMOS AO EXEMPLO:

Você tem um array de número:

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

Eu quero que nesse array todos os número sejam multiplicado por 2, então você faria um **MAP** desse array, pegando o item e multiplicando por dois. 


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


Porém o map sempre retorna um array *novo*, ele não modifica o atual, por conta disso atribui esse novo retorno na variável **resultArray**.


## Filter

Como o próprio nome já diz filtro! Ele é usado para quando precisamos fazer um filtro dentro do array. 

Também retorna um novo array, porém dessa vez só com elementos selecionados. 

VAMOS AO EXEMPLO:

Dessa vez teremos um array com número de 1 até 10.

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

Pensando em usar o filtre, eu quero que ele filtre por números que sejam pares. 

**O resultado seria:**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sidsuloezc1555hfroi.png)



## Reduce

O Reduce muito das vezes parece ser o mais complicado de entender, mas a ideia de usar ele é para retornar um único valor. 

VAMOS AO EXEMPLO:

Abaixo vou ter um array com diversos número e vou utilizar o reduce para fazer a soma de todos eles e me retornar somente um dados. 

O retorno desse array será 41. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qerrucc68ldc6gigfcp.png)
GitLab 13.12 is now available! 🌼
Tags: gitlab, news, git, tooling
Published: 2021-06-03 20:20:24

---
title: GitLab 13.12 is now available! 🌼
published: true
date: 2021-05-25 23:15:00 UTC
tags: gitlab, news, git, tooling
canonical_url: https://www.benjaminrancourt.ca/gitlab-13-12-is-now-available
cover_image: https://www.benjaminrancourt.ca/images/gitlab-13-12-is-now-available.jpg
---
This month, although the **new release** of [**GitLab**](https://www.benjaminrancourt.ca/tag/gitlab) contains 44 improvements, only **3** of them caught my attention. They are relatively minor, so this post will be _really_ brief. 😉

As always, you can read the [full release notes](https://about.gitlab.com/releases/2021/05/22/gitlab-13-12-released/) on their official blog.

## [Support wildcards when including YAML CI/CD configuration files](https://about.gitlab.com/releases/2021/05/22/gitlab-13-12-released/#support-wildcards-when-including-yaml-cicd-configuration-files)

![](https://www.benjaminrancourt.ca/images/support-wildcards-when-including-yaml-cicd-configuration-files.jpg)<figcaption>Screenshot of the <em>Support wildcards when including YAML CI/CD configuration files</em> changelog on the GitLab blog.</figcaption>

I don't have a use case yet where I would like to include a lot of `.gitlab-ci.yml` files, but I think it's worth keeping this new functionality in mind when designing CI/CD pipelines. Maybe this will help me someday? 🤔

## [Git default branch name change](https://about.gitlab.com/releases/2021/05/22/gitlab-13-12-released/#git-default-branch-name-change)

![](https://www.benjaminrancourt.ca/images/git-default-branch-name-change-1.jpg)<figcaption>Screenshot of the <em>Git default branch name change</em> changelog on the GitLab blog.</figcaption>

Have you read my [post on a **more inclusive workplace**](https://www.benjaminrancourt.ca/toward-an-inclusive-language-in-it)? This new improvement can be considered very minimal, but since many developers doesn't botter to change the default values, this change will help the world to get rid of the `master` word in Git. 😇

## WIP (work in progress) merge requests removal

![](https://www.benjaminrancourt.ca/images/wip--work-in-progress--merge-requests-removal.jpg)<figcaption>Screenshot of the <em>WIP (work in progress) merge requests removal</em> changelog on the GitLab blog.</figcaption>

I can't remember how many times a new colleague asked me what the WIP acronym stood for when he first started using our self-managed GitLab. 🙄 So I am very happy that this term is now deprecated and will be removed in the next major release. 🤗
What is an Exception?
Tags: java, beginners, tristan
Published: 2021-05-25 22:41:35

#Introduction
- This is the first post in my exception series. Hopefully we can both learn more about exceptions in Java. This post only contains definitions, no code.



###What is an exception
- The term exception is short for `exceptional event` and it means an event which occurred during the execution of a program, that disrupts the normal flow of a program's instructions.

- When an error occurs within a method, the method creates an object and hands it off to the Java runtime environment.


###What is the Java runtime environment(JRE)?
- to put it simply, it is just a software layer that runs on top of a computer's operating system and provides the appropriate resources that the specific Java application would need. In general terms, a "Runtime Environment" is just a piece of software that runs other software.

- the Java runtime environment consists of two main parts 

- 1) **class loader** : which is responsible for correctly loading classes and connecting then with the core Java class libraries.

- 2) **Java Virtual Machine** : is responsible for ensuring Java applications have the appropriate resources needed to perform properly.

- The JRE (Java Runtime Environment) acts mainly as a container and is responsible for orchestrating all of their activities.

- After a method throws an exception, the JRE attempts to find "something" to handle it. To find this "something" the JRE searches the `call stack` for a method that contains "something" that can handle the exception. This "something" is called an exception handler.

- A `call stack` is a data structure that represents all the currently active methods that have been called but are not returned.



- The search on the call stack begins with the method in which the error occurred and proceeds through the call stack in reverse order. When an appropriate handler is found the JRE passes the exception to the handler.

- If the JRE searches all the methods on the call stack without finding an appropriate exception handler the entire system terminates 



#Conclusion
- Thank you for taking the time out of you day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on [Twitter](https://twitter.com/TristAndroidDev).
- Also make sure to checkout my [YouTube](https://www.youtube.com/channel/UCN9jWE9COJ0wN1m4huDFqzw/playlists) channel for more programming tutorials
Day 374 : Time Will Tell
Tags: hiphop, code, coding, lifelongdev
Published: 2021-05-25 22:23:17

_liner notes_:
- Professional : Pretty good day of pretty all coding. Got the demo sample app of a new SDK to the point of showing other folks on the team. Getting some really good feedback on it so far. Not a bad bad. Had some questions about how to do some things with the SDK. Hope to get the answers tomorrow and tighten things up.

- Personal : So I started working on the push notification part of my website. I decided to use vanilla JavaScript and Firebase to put it together. I set up the project and worked out how I want the layout to be. Trying to keep it as simple and light as possible.

![View of a lake with snow covered mountains in the distance under a blue sky in Kunturiri, Bolivia](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lxjnvdmeb2hv3jun2k11.jpg)

Going to try and finish up the push notification for my side project. I'm thinking I may have to push back the launch date. Good thing I haven't really promoted it. haha. Maybe I'll work on the radio show. Time will tell.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube kz3JbHdUl_I %}
The Pomodoro Technique: Is it really worth it?
Tags: productivity, career, beginners, webdev
Published: 2021-05-25 21:47:05

Hey everyone! Long time no see! It has been a minute since I wrote a post here. I have been super busy trying to tie down my interests in tech. At first I wanted to go the front end route, but my interests are changing. I want to try my hand at UX/UI. If you have any courses are resources for me, let me know. Thanks!

Anyway. Enough about me. This post is about the famous Pomodoro Technique that was started by Francesco Cirillo in the 1980s. It is a time management technique that he named after the tomato themed kitchen timer he used during school. You basically set a timer for 25 minutes and work during that time. Afterwards you have a quick break, and then set the timer back to 25 minutes for the next task on your to-do list.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qwzh5s43ule6dlaoep30.png)
Are you someone who could use the Pomodoro Technique in your day to day life? According to this [Todist article](https://todoist.com/productivity-methods/pomodoro-technique) if you are any of the following the answer is yes:

- Find little distractions often derail the whole workday

- Consistently work past the point of optimal productivity

- Have lots of open-ended work that could take unlimited amounts of time (e.g., studying for an exam, research for a blog post, etc.)

- Are overly optimistic when it comes to how much you can get done in a day (aren't we all 🙃)

- Enjoy gamified goal-setting

- Really like tomatoes

Even though I love productivity tools, I am usually on the fence about them. I think some productivity tools actually waste time. However I have been using this time management technique for a few days, and it has been helpful. Do I think I will use it all the time? No. I do think on days that I am super busy, this will help me stay on track.  I craft, I code, and I do a lot of other things, so this should be helpful to me. What are some productivity and time management tools that you use?

Photo by [おにぎり](https://unsplash.com/@fukayamamo?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/tomato?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText).
425show @ Build 2021
Tags: build, javascript, security
Published: 2021-05-25 21:35:06

Thanks for joining us at Build! We'll be updating this post throughout the week with code samples, docs and other info after our sessions.

## Learn Live: Application types in Microsoft Identity (5/25, 3p ET)

[This session](https://mybuild.microsoft.com/sessions/9eadeef5-96a2-4fd2-ac9a-2a83deed93df) kicks off a 5-week series every Monday through June, where Christos & I will take you through the [Implement Microsoft identity - Associate](https://docs.microsoft.com/en-us/learn/paths/m365-identity-associate/) learning path. Join us each Monday from June 7th - July 12th as we'll go into the why behind the how.

Find the code samples from this session, complete with CodeTour!

- [Single-page applications](https://github.com/425show/learn-live-spa)
- [Web app that signs in users and calls APIs](https://github.com/425show/learn-live-webapp)
- [Headless/daemon apps](https://github.com/425show/learn-live-daemon)

Stay tuned, more to come throughout the week! [Join us on discord](https://aka.ms/425show/discord/join)
Dictator paradox: Why micromanagement is so tempting
Tags: leadership, management, agile
Published: 2021-05-25 21:34:13

I firmly believe all creative people hate when others tell them what to do. When instead of problems to solve, they are handled solutions to implement or, even worse, isolated tasks to just complete.

Yet, the world is full of micromanagers.

Over my career, I’ve heard countless complaints about how managers do not give their reports enough context, enough trust, enough freedom. That they decide all on their own.

Why is that?

**Because micromanagement gets the thing done faster.**

Well, kind of. Let me explain.

### Dictators and complex systems

Originally a [dictator](https://en.wikipedia.org/wiki/Roman_dictator) (a micromanager is a local dictator) was a role in Ancient Rome, giving almost unlimited power to a selected individual during wartime. The appointment was for emergencies only and it was time-limited.

The idea was that one person would hold all the important information in their head and, because of that, they will make educated decisions fast. And during the war, a good decision today trumps a better decision tomorrow.

Having a dictator was actually very smart.

At wartime.

You see, a war (or a company, or a software system) is an example of a complex [system](https://www.goodreads.com/book/show/42360533-thinking-in-systems). One crucial property of a complex system is that nobody can have a mental model of it that is complete.

That is, there were things (probably loads of things) that the Roman dictator did not count with and which harmed the people later. But, again, during the war, all is sacrificed towards winning it. Obviously, losing the war would harm all the citizens much more.

In other words, **a dictator is a reasonable solution if fixing a single problem is all that matters**. A dictator heavily favors a short-term solution over a long-term solution.

That is never the case in the real world of software engineering. While there are strict deadlines, meeting them with an exhausted team that is unable to continue is not acceptable. Neither is sacrificing the quality and maintainability of the architecture.

The project you are working on, however important it seems, cannot jeopardize the ability of the team to continue tackling the next projects. This includes piling the technical debt.

### Why is that a paradox?

What I write might seem clear and obvious (I hope it is!). So, where is the paradox?

I define the **Dictator paradox** as the following:

> **Given a set of projects, every single project alone will be finished faster with a dictator. However, to finish all of the projects, decentralization and coöperation will beat any dictator.**

This is the reason why people talk about self-organized teams, incremental delivery, and emergent design.

This is why the industry has replaced Waterfall with Agile development.

This is also why when the pressure makes a manager forget the context and perspective, they will start to micromanage.

After all: *A dictator is a reasonable solution if fixing a single problem is all that matters.*
Create a animated portfolio card with React and ChakraUI
Tags: react, webdev, showdev, productivity
Published: 2021-05-25 21:34:09

![Card portfolio gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ld4myok4qma2tvl2ymaw.gif)

# Portfolio card post
{% link https://dev.to/m_ahmad/create-a-portfolio-card-with-react-chakraui-and-framermotion-21c4 %}
Learn how Stripe authentication works in 8 minutes
Tags: devrel, stripe, payments, webhooks
Published: 2021-05-25 21:17:36

{% youtube gRvlMeBks6k %}

Not a Python dev? Try [Ruby](https://www.youtube.com/watch?v=8Db0nTVlKM0&list=PLy1nL-pvL2M50RmP6ie-gdcSnfOuQCRYk) • [PHP](https://www.youtube.com/watch?v=CeufP46S5BI&list=PLy1nL-pvL2M6cUbiHrfMkXxZ9j9SGBxFE) • [Node](https://www.youtube.com/watch?v=R5RoYDEIhCI&list=PLy1nL-pvL2M5xNIuNapwmABwEy2uifAlY) • [Go](https://www.youtube.com/watch?v=oJRPV07bVS0&list=PLy1nL-pvL2M5eqpSBR9KL7K0lcnWo0V0a) • [Java](https://www.youtube.com/watch?v=t4iJ07E_tA8&list=PLy1nL-pvL2M5TnSGVjEHTTMgdnnHi-KPg) • [.NET](https://www.youtube.com/watch?v=N20T0rXAWsc&list=PLy1nL-pvL2M4cNNoUtjWevYSci4ubsbhC) instead.

## What you’ll learn

Authentication is fundamental to using Stripe. Secure keys, or tokens, are used to authenticate requests made to the Stripe API. In the video, you’ll learn how to:

- Securely make Stripe API requests
- Pass payment information from your frontend to your backend

## Who this video is for

This video guide is primarily for developers new to Stripe but developers familiar with Stripe might learn some new things as well.

## How to follow along

If you want to work alongside the video, you’ll need a [Stripe account](https://dashboard.stripe.com/register) and a Python environment to work in. 

## Resources

- [Authentication with stripe-python video](https://www.youtube.com/watch?v=gRvlMeBks6k&list=PLy1nL-pvL2M55YVn0mGoQ5r-39A1-ZypO)
- [Authentication reference documentation](https://stripe.com/docs/api/authentication)
- [API keys documentation](https://stripe.com/docs/keys)

## What to watch next

- [Making requests with stripe-python](https://www.youtube.com/watch?v=Hg5FkqSmV68&list=PLy1nL-pvL2M55YVn0mGoQ5r-39A1-ZypO&index=3)
Setting up ESLint + Prettier
Tags: linting, eslint, prettier, typescript
Published: 2021-05-25 21:05:37


> Disclaimer: This is not intended as a step-by-step tutorial. It's just a suggestion of implementation of basic opinionated rules. 
 
### Install Prettier

`npm install prettier --save-dev`

Create the `.prettierrc` file.

```json
{
  "printWidth": 80,
  "singleQuote": true,
  "useTabs": false,
  "tabWidth": 2,
  "semi": true,
  "bracketSpacing": true,
  "trailingComma": "es5",
  "jsxSingleQuote": false,
  "bracketSameLine": true,
  "arrowParens": "always",
  "endOfLine": "crlf",
  "singleAttributePerLine": true
}
```
#### Install ESlint and Dependencies

```
npm install --save-dev eslint eslint-config-prettier @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest`
```

Create the `.eslintrc.json` file.
```json
{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 12,
    "sourceType": "module"
  },
  "plugins": [
    "@typescript-eslint"
  ],
  "rules": {
    "indent": ["error", 2, { "SwitchCase": 1 }],
    "linebreak-style": ["error", "windows"],
    "quotes": ["error", "single", { "avoidEscape": true }],
    "semi": ["error", "always"],
    "curly": ["error", "multi-line"]
  }
}
```
Create the `.eslintignore` file.
```
# Add folders, files, and glob patterns
# which should be ignored by the linter 
/node_modules
/dist
```

### Set up scripts (package.json)
```json
"scripts": {
  "ng": "ng",
  "start": "ng serve",
  "build": "ng build",
  "lint": "eslint . --quiet",
  "lint:fix": "eslint . --fix"
}
```

### VSCode Extensions
#### Install Prettier - Code formatter [VSCode Extension]

Name: Prettier - Code formatter
Publisher: Prettier
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

#### Set Prettier as your default code formatter

On VSCode, open your `settings.json` file and add the following configurations.

```json
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
}
```
#### Install ESLint [VSCode Extension]

Name: ESLint
Publisher: Dirk Baeumer
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint

#### Setup Library Execution

The ESLint plugin requires permission to execute the local ESLint installation from your `node_modules`. Open the command palette (`F1` or `Ctrl + Shift + P`) and select `ESLint: Manage Library Execution` to open the dialog for your project and confirm with 'Accept'.

### Troubleshooting

[ESLint not working in VSCode? Help build a troubleshooting checklist!](https://dev.to/tillsanders/eslint-not-working-in-vscode-help-build-a-troubleshooting-checklist-fdc#:~:text=Take%20a%20look%20at%20the,errors%2C%20they%20should%20appear%20here)