teleren/devto huggingface dataset:
[Tutorial Git] git commit: Enviando arquivos para o repositório Git
Tags: git, commit, github, braziliandevs
Published: 2020-02-29 16:18:38

Vamos supor que temos no nosso repositório a seguinte situação:

Temos dois arquivos novos e vamos fazer o nosso primeiro **commit**.

![arquivos monitorados](https://dev-to-uploads.s3.amazonaws.com/i/bmxlcv0oqp7x82ohn69b.png)

Enquanto no **fluxo** do git,

![arquivos no index](https://dev-to-uploads.s3.amazonaws.com/i/38vurkj8hferlo8gvxq4.png)

Ao colocar os arquivos dentro no repositório, precisamos informar ao **Git** o motivo desses arquivos, com o comando:

```
$ git commit -m 'escreva sua mensagem aqui'
```

- **$** indica que você deve usar o **usuário comum** para fazer essa operação.

- pode-se usar aspas simples ou duplas para escrever a mensagem.

No nosso exemplo, temos:

```
$ git commit -m 'commit inicial'
```

![primeiro commit](https://dev-to-uploads.s3.amazonaws.com/i/unve14lmuugfvmudy8r0.png)

Conferindo o **estado** do **Git**, temos:

![status limpo](https://dev-to-uploads.s3.amazonaws.com/i/job4pli9cxfcinagybdm.png)

E no fluxo,

![fluxo commit do git](https://dev-to-uploads.s3.amazonaws.com/i/7eg2uhicinq00yub56j2.png)

Esse conjunto de caracteres e números que aparece ao lado da palavra **commit** é a **chave (ou hash)** que identifica o próprio.
Gitlab + Netlify | Parte I
Tags: devops, spanish, gitlab, netlify
Published: 2020-03-01 02:44:47

---
title: Gitlab + Netlify | Parte I
published: true
description: Cómo deployar HTML desde Gitlab a Netlify
tags: devops, spanish, gitlab, netlify
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/uq2uyjiro35mf8cjorju.jpg
---

Bienvenidos a una nueva entrega de Dev/Sec/Ops !

En esta oportunidad, les muestro cómo deployar código HTML estático alojado en Gitlab, en la infraestructura CDN inteligente de Netlify.

Adicionalmente, conocemos brevemente el dashboard de Netlify, sus opciones más importantes y como personalizar nuestro sub-dominio. También verificamos el cifrado HTTPS y cómo responde la CDN de acuerdo a la ubicación geográfica de donde provengan los requests.

Que lo disfrute.

{% youtube pKKAt6V9a4w %}
Get items based on publish date with Kentico Kontent & GatsbyJS / GraphQL
Tags: gatsby, graphql, tutorial
Published: 2020-03-01 11:37:12

When developing a blog- or newslike website/component with Kentico Kontent, you'll probably run into the problem that you can't sort your posts on publish date, since this data is not available in the API. 

Luckily, there is a date & time element available in Kontent's model builder, and we have GraphQL built-in in GatsbyJS. So we can use this to sort the data ourselves!

###Step 1: Add the date & time element to your content model

![Add the date & time element in Kontent](https://dev-to-uploads.s3.amazonaws.com/i/f4y08seji87fml0o1t58.png)

###Step 2: Add content items

When there are no data available in the API, there's no way you can retrieve the data. So it's wise to add a couple of content items where the Publish date is populated. 

If you're planning to publish once in a couple of days, adding the date would suffice. If the plan is to publish multiple articles per day, it's wise to also fill out the time. 

![Populate the content items with a publish date](https://dev-to-uploads.s3.amazonaws.com/i/106mem2l5n6cq32wbsln.png)

###Step 3: Add sorting to your GraphQL query

Now we have the publish date available in the API, we can use this to manipulate the items with GraphQL's sorting mechanism.  

```javascript
query ArticleListing {
  allKontentItemArticle(sort: {order: DESC, fields: elements___publish_date___value}) {
    edges {
      node {
        id
        elements {
          title {
            value
          }
        }
      }
    }
  }
}
```
That's it! When you display the items you'll see that they are sorted on publish date.

For reference, here's how I'm using it on one of my pages in my project: 

```javascript
import React from 'react'
import { graphql } from 'gatsby'
import Layout from '../components/Layout/layout'
import ArticleCard from '../components/Card/article-card'

const articlePage = ({ data }) => {
  const articles = data.allKontentItemArticle.edges
  return (
    <Layout>
      {articles.map((article, i) => {
        const articleData = article.node.elements
        const title = articleData.title.value
        const url = articleData.slug.value
        const image = articleData.header_image.value[0].url
        const alt = articleData.header_image.value[0].description

        return <ArticleCard title={title} url={url} image={image} alt={alt} key={i} />
      })}
    </Layout>
  )
}

export const query = graphql`
  query ArticleListing {
    allKontentItemArticle(
      sort: { order: DESC, fields: elements___publish_date___value }
    ) {
      edges {
        node {
          id
          elements {
            title {
              value
            }
            header_image {
              value {
                url
                description
              }
            }
            slug {
              value
            }
          }
        }
      }
    }
  }
`

export default articlePage
```

_Photo by Icons8 Team on Unsplash_
Sunday Summary #2
Tags: sundaysummary
Published: 2020-03-03 14:26:15

---
title: Sunday Summary #2
published: true
date: 2020-03-01 12:00:00 UTC
tags: sundaysummary
canonical_url: https://www.mskog.com/posts/sunday-summary-2
---

### [Motion](https://www.inmotion.app/)
 ![Sunday Summary #2](https://s3-eu-central-1.amazonaws.com/mskog-cms/2020/02/XoxVcCZQ--1-.png)

This is a free Chrome app for monitoring and fixing distractions while working. There are many apps which do this like [Blocksite](https://chrome.google.com/webstore/detail/block-site-website-blocke/eiimnmioipafcokbfikbljfdeojpcgbh?hl=en) for example, but Motion does it a bit differently. Whenever you visit a site that is marked as distracting you get a popup that tells you this. You then have the option to leave the site or tell Motion that you need a minute or more. This is then displayed in a countdown timer and when the time is up you get the popup again.

This may seem like a trivial difference but I've been using it all week and it made a huge difference for me. The constant nagging and having to actually click a button to get another minute on Twitter is a great thing.

##   
Links

[Pull Panda](https://pullpanda.com/)  
Recently acquired by [Github](https://github.com/). This is a great tool for teams that do pull requests on Github. You can for example get pull request reminders on Slack and there are graphs for pull request velocity and turnaround time.

![Sunday Summary #2](https://s3-eu-central-1.amazonaws.com/mskog-cms/2020/02/cRhRz5uA.png)<figcaption>My teams current turnaround time goals</figcaption>

[How I learned French in 12 months](http://www.runwes.com/2020/02/11/howilearnedfrench.html)  
Makes me want to learn a new language, but I don't have 3 hours a day to do it unfortunately.

[Best practices for designing apps people actually use](https://thoughtbot.com/blog/best-practices-for-designing-apps-people-actually-use)

[Github discussions beta](https://github.com/zeit/next.js/discussions)  
You will be able to discuss projects without cluttering up the issues page. Seems like a great thing to me.

[Over 150.000 free wildlife illustrations](https://www.smithsonianmag.com/smart-news/over-150000-illustrations-wildlife-are-available-online-free-180974167/)

[100 little ideas](https://www.collaborativefund.com/blog/100-little-ideas/)  
100 concepts, ideas and principles that explain the world. Very interesting stuff.

[Free AWS tier for $900 a month](https://blog.andrewray.me/my-first-aws-free-tier-hosting-bill-was-900/)  
Be careful!

[Clouding](https://clouding.io/en/).io  
Reasonably priced VPS provider. The unique thing is that you can customise your server to your liking without paying through the nose.

![Sunday Summary #2](https://s3-eu-central-1.amazonaws.com/mskog-cms/2020/02/clouding--1-.png)
Increasing your productivity with Telegram and Node.js
Tags: node, productivity, webdev, showdev
Published: 2020-03-01 14:49:32

---
title: Increasing your productivity with Telegram and Node.js
published: true
description: 
tags: node, productivity, webdev, showdev
cover_image: https://i.ibb.co/f2pv9mQ/fernando-hernandez-efzwc-MRM6j4-unsplash.jpg
---

This article was originally published on [Medium] (https://medium.com/datadriveninvestor/improving-your-productivity-with-telegram-and-node-js-20f8be11e58c).

Some time ago I searched for an easy way to establish a communication channel between a mobile device and a Node.js webserver. My goal was to exchange messages over this channel and receive information about the weather, public transportation and more.

For example I send the message /train and receive a response with realtime details about train departure times of preconfigured routes. So the Node.js server receives the incoming message, processes it and sends a response back to the client.

After doing some researches I finally came up with Telegram bots since they are very easy to setup and fit perfect to my needs. Besides sending text messages, you can also share data like images or audio recordings.

---

First of all, what exactly is a Telegram bot? [Source](https://core.telegram.org/bots) 


> Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and inline requests. You control your bots using HTTPS requests to our bot API.

So you simply send a message from your phone via Telegram and your webserver receives it over Telegram’s API.

Just to name some of the things you can use your own bot for. Whether just for you or for your friends as well:

- Gathering weather information
- Fetching arrival / departure times of public transportation
- Receiving tweets, news, status updates
- Sending automated messages
- IoT

and so much more.

---

One big benefit of Telegram bots is that you don’t need a public server which is accessible over an IP-address from outside the network. In my case I use a Raspberry Pi to run the Node application for example.

Since the communication takes place over the Telegram API, there’s just an internet connection required.

For interacting with it you can use a runtime environment like Node.js as I did in the example app below or any other programming languages.

[Here](https://core.telegram.org/bots/api)  you can find an introduction about how to interact with the API.

---

As I mentioned above I recently created an example app for a Telegram bot server based on Node.js. Feel free to use it for your own bot and customize it according to your wishes or contribute to it.

Let me know what you use your bot for and share your experience!

{% github larswaechter/telegram-bot-server %}
GitHub Organizations で GitHub Actions を利用しようとした際の Permission Error
Tags: github, japanese
Published: 2020-03-01 15:39:48

---
description: "GitHub Organizations で GitHub Actions を利用しようとした際に発生する Only actions in \"hoge-organization\" are allowed for this repository の解決方法です。"
---

## エラー内容
`Only actions in "hoge-organization" are allowed for this repository`

## 原因
GitHubの該当リポジトリのページ > Settings > Actions > Actions Permissions を確認してください。

`Enable local Actions only for this repository` が選択されている場合、
3rd PartyのGitHub Actions は利用できません。

## 対応

以下のどちらかで対応可能です。

- GitHub Actions 内の 3rd Party の Action定義を削除する
    - GitHub Actions 初期テンプレートなら `actions/checkout@v2` の部分
- Actions Permissions を `Enable local and third party Actions for this repository` に変更する
Why I joined the Flatiron Data Science Program
Published: 2020-03-02 15:07:04

![Dog Typing](https://media1.giphy.com/media/wpoLqr5FT1sY0/giphy.gif?cid=790b7611770b534a9ccee1cdc5886e9f223658c7e8b393bd&rid=giphy.gif)

My name is Tim Hugele, and I just started the Data Science program at the Flatiron School in Houston, TX.

I originally studied Economics at Texas A&M and Petroleum Engineering at the University of Houston. However, after failing to find a good job I decided to try something different. 

I chose to study Data Science because:

1) I wanted to gain skills that would be in demand in the labor market. 

2) I felt like my comfort with calculus and statistics from my background in Engineering and Economics would make Data Science a good fit.

3) As a kid I was a basketball fanatic and would buy books on basketball statistics. I loved the idea of being able to go beyond the simple statistics that were in those books and possibly finding unique trends in the data.

![Hangover Gif](https://media.giphy.com/media/BmmfETghGOPrW/giphy.gif)

4) Data Science seems to be a versatile skill set that can be packaged with either of my previously acquired degrees.
Pipfile and pipenv
Tags: python, pipile, pipenv
Published: 2020-05-20 18:03:49

{% youtube rR8F_Uaf9_I %}

Last month, I wrote in detail about [the new Pipfile format and the pipenv tool](https://www.mattlayman.com/2017/using-pipfile-for-fun-and-profit.html) for managing Python packages.  I presented about Pipfiles in depth at Python Frederick this month.

If audio and video is more your speed, we recorded a talk for the first time at Python Frederick, and I posted it to YouTube for your enjoyment.

The presentation material is available in the [Python Frederick talks repository](https://github.com/python-frederick/talks/tree/master/2017-08-pipfile).

This article first appeared on [mattlayman.com](https://www.mattlayman.com/blog/2017/pipfile-pipenv/).
Why I decided to learn data science
Published: 2020-03-02 15:36:18


Data science is broad and interesting field with many different applications. Especially, I find fascinating that data science uses a lot of tools from different disciplines and sub-disciplines, like AI, Machine learning, Math, Statistics,  Deep Learning, Computer Science and others and how all these harmonically connected together. From what we can see now, data driven decisions are used almost in all industries. Potentially, we can expect that more and more ML/AI driven solutions will be used by experts or users in different domains. Of course, there is a whole another topic of the development of these technologies and how they can be used to help in solving challenges in various industries.

###**How I can add a value applying Data Science?**

My background is in mechanical engineering, and working for quite some time as an engineer, I realized that I could add more value to a company if I combine my experience and passion to the technologies. I started with learning Python and solving some code challenges using online learning platforms. As well, I started to learn about supervised and unsupervised learning algorithms, and I liked applied concept and elegance of the math behind it.


###**Problem solving is fun!**

![gif - solving puzzle](https://media.giphy.com/media/JWF7fOo3XyLgA/giphy.gif)

Another thing that I liked in the data science, that it involves problem solving. For me personally, problem solving is fun. I think I understood that I truly love solving analytical problems when I was in high school. I still remember I was participating in my first physics olympiad, I had no experience at solving tasks at that level and was struggling with solving one of the problem. After thinking for a while, I got ‘aha moment’ and I understood how to model and describe that phenomena using the law of energy conservation. I think from this point onwards, I was able to participate quite successfully at physics olympiad in the high school. So, the lesson I got for myself, that we also can learn by challenging ourselves in a positive way.  Now, back to the learning the data science … I just started my journey exploring it, and I want to start with the basics. As I believe that experimenting and applying the foundations and finding your own insights is going to give confidence and motivation to continue learning in the long run.

I would like to end this post with the question to the reader. 
So, what motivates or motivated you to learn data science, ML/AI or any other computer science discipline?
Blocking HTML5 Ping Requests using ColdFusion
Tags: coldfusion, cfml
Published: 2020-03-02 01:11:16

Major browsers are disabling the ability to [disable HTML5 ping click tracking](https://www.bleepingcomputer.com/news/software/major-browsers-to-prevent-disabling-of-click-tracking-privacy-risk/).

As a result, you’ll probably start encountering empty form posts with a content-type of "text/ping". If you are not expecting or do not need to receive ping requests to your web server, you can block them without wasting
any resources processing the request further.  This is important because this feature has already been used to perform [DDoS attacks](https://www.imperva.com/blog/the-ping-is-the-thing-popular-html5-feature-used-to-trick-chinese-mobile-users-into-joining-latest-ddos-attack/):

Here's a basic ColdFusion script that will identify and block HTML5 Ping requests.

{% gist https://gist.github.com/JamoCA/916dbb2d0ca0fe30ca63120bcaccc20f %}
为 GitLab 的 git-lfs 子系统配置阿里云 OSS 作为后端存储
Published: 2020-03-02 02:27:55

## gitlab-workhorse 的修改（已无需修改）

曾经，GitLab 的模块 gitlab-workhorse 需要修改一处代码，以使其支持忽略大小写的 ETag 对比。但是某个版本以后，这一特性已经被原厂支持了。

修改的内容：

```golang
// 源代码在 gitlab-workhorse 的 internal/objectstore/object.go 文件的末尾部分
// 将其对比 etag 与 md5sum 的 if 语句改为 strings.ToLower 加持的

		if strings.ToLower(o.etag) != strings.ToLower(o.md5Sum()) {

// 只改这一处，保存文件后执行 make gitlab-workhorse
// 即可编译好 gitlab-workhorse 的可执行文件在源码根目录
```

------

## gitlab.rb 中 LFS 段落的全部配置

```ruby
gitlab_rails['lfs_enabled'] = true
gitlab_rails['lfs_storage_path'] = "/var/opt/gitlab/gitlab-rails/shared/lfs-objects" # 本地存储路径。
gitlab_rails['lfs_object_store_enabled'] = true # 开启云存储
gitlab_rails['lfs_object_store_direct_upload'] = true # 开启直传：将由 gitlab-workhorse 把收到的文件直接传到云存储
gitlab_rails['lfs_object_store_background_upload'] = false # 禁用异步上传：默认将临时把文件存在本地，然后调用队列服务，完成上传（需支持 multi-part 上传）
gitlab_rails['lfs_object_store_proxy_download'] = true # 【重点】务必开启代理下载模式：lfs 文件的下发将使用 gitlab-workhorse 转发，需开启否则会拿不到 lfs 的文件 URL
gitlab_rails['lfs_object_store_remote_directory'] = "<bucket-name>/<some-prefix>/<lfs-directory>" # 【重点】这里务必使用 <bucket_name>/<lfs_store_prefix> 的路径格式以使用阿里云 OSS
gitlab_rails['lfs_object_store_connection'] = {
  'provider' => 'AWS', # 虽然在用阿里云 OSS，但是它兼容 AWS S3
  'region' => 'cn-shanghai-internal', # OSS bucket 所在地区（此处使用了内网节点）
  'aws_access_key_id' => '<ACCESS_KEY_ID>', # API 访问 key id
  'aws_secret_access_key' => '<ACCESS_SECRET>', # API 访问 secret
  'host' => 'oss-cn-shanghai-internal.aliyuncs.com', # 【重点】使用不带 bucket_name 的 Endpoint 域名
  'aws_signature_version' => 4, # OSS 支持 v4 签名格式
  'endpoint' => 'http://oss-cn-shanghai-internal.aliyuncs.com', # 【重点】使用不带 bucket_name 的 Endpoint URL
  # path_style: true = 'host/bucket_name/object' ; false = 'bucket_name.host/object'
  'path_style' => true # 【重点】务必设置为 true
}

```

----

#### 参考文档
- [GitLab LFS 管理文档](https://docs.gitlab.com/ee/workflow/lfs/lfs_administration.html)
- [阿里云 OSS 与 S3 兼容性文档](https://github.com/AlibabaCloudDocs/oss/blob/master/cn.zh-CN/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5/%E6%95%B0%E6%8D%AE%E8%BF%81%E7%A7%BB/%20%E4%BB%8EAWS%20S3%E4%B8%8A%E7%9A%84%E5%BA%94%E7%94%A8%E6%97%A0%E7%BC%9D%E5%88%87%E6%8D%A2%E8%87%B3OSS.md)
Navigating Dev.to's Code on GitHub
Tags: rails, opensource, webdev, beginners
Published: 2020-04-27 07:19:06

Dev.to is an open source Rails application on GitHub. All Rails applications follow the same conventions which makes jumping from different Rails applications a seamless experience.

We will investigate a specific route, `/dashboard`, but we can repeat this process for other routes to learn about dev.to incrementally. Let's take a trip down MVC lane.

## Routes

It's helpful to start from the routes file to see all the routes that we can access in dev.to. We can access the routes file in [config/routes.rb](https://github.com/thepracticaldev/dev.to/blob/master/config/routes.rb).

Inside of the file we can see the following:

```ruby
get "/dashboard" => "dashboards#show"
```

This means that when a user makes a get request to `/dashboard`, Rails will use the `DashboardsController` and run the `show` action.

## Controller

We can find the `DashboardsController` here [app/controllers/dashboards_controller.rb](https://github.com/thepracticaldev/dev.to/blob/master/app/controllers/dashboards_controller.rb). The controller is in charge of gathering data from models and making them available to the view.

In the show action of the controller, we see that we are gathering articles from users. 

```ruby
@articles = target.articles
```

Let's take a peak at the `User` and `Article` models.

## Model

A model maps directly to a table in Rails. For example the `Article` model maps to the `articles` table in the database. We can define relationships in the model.

### User

For example, in the user model, we can see that a single user has many articles.

[app/models/user.rb](https://github.com/thepracticaldev/dev.to/blob/master/app/models/user.rb)

```ruby
has_many :articles, dependent: :destroy
```

### Article

Inside of the article model, we see that a single article belongs to a user.

[app/models/article.rb](https://github.com/thepracticaldev/dev.to/blob/master/app/models/article.rb)

```ruby
belongs_to :user
```

## View

We can complete our MVC cycle in the view file where the articles are displayed to the user.

[app/views/dashboards/show.html.erb](https://github.com/thepracticaldev/dev.to/blob/master/app/views/dashboards/show.html.erb)

```ruby
<% @articles.each do |article| %>
  <%= render "dashboard_article", article: article, organization: article.organization, org_admin: true, manage_view: false %>
<% end %>
```

## Conclusion

It's awesome that dev.to is an open source project! We can continue this process to incrementally learn more about the codebase. 

1. Investigate a specific route in the `config/routes.rb` file. 
2. Find the controller and action that the route is paired with
3. Investigate the models that the controllers are orchestrating for the view file. 
4. Look at the view file to see what is actually rendered to the user.
How to create a 🌈 pattern with a CSS radial-gradient 
Tags: todayilearned, css, sass
Published: 2020-03-02 04:14:13

The following Codepen demo includes a Sass mixin that you can use to create your own rainbow pattern! You may need to adjust the background size to your liking, or tweak the band sizing if you include more or less colors.

Colors based on a shirt my four year old loves to wear :)

{% codepen https://codepen.io/5t3ph/pen/jOPwxBG %}

[Check out this link](https://cssgradient.io/blog/gradient-patterns/) to get a jump start on creating patterns with CSS gradients. This pattern was forked from the "waves" pattern from that resource.

Bonus thing I learned today was that emoji are valid in Sass variable names (or at least with the compiler Codepen uses).

![rainbow emoji as Sass variable name](https://dev-to-uploads.s3.amazonaws.com/i/pvmekqw0ds0bz3evshjq.png)