teleren/devto huggingface dataset:
OneDev 3.2 - Open Source Self-Hosted All-in-One DevOps Platform
Tags: devops, java, git
Published: 2020-06-26 10:19:19

OneDev is an open source project hosted at https://github.com/theonedev/onedev

Since last announcement, we got bunch of feedbacks and this version ships some of them. Thank you for getting OneDev even better!

**OpenID connect integration**

With OIDC integration, it is now possible to login via GitHub, Gmail, Okta, or any other OIDC compliant identify providers. Besides authentication, this integration can also authorize users with appropriate permissions based on group claims. Check usage scenarios here and here for details

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

**Clone with custom credential in CI job** 

For security reason, OneDev clones source in CI job with a default credential which does not have permission to access other projects, or push back commits. To get additional permissions, one has to define custom job secrets accessible to certain branches, and use these secrets in CI job to clone source. Refer to usage scenario here for example setup

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

**Reworked pull request workflow**

Instead of merging pull requests automatically after getting all approvals from revewers, assignee has to merge them manually to ensure responsibilities, as well as crafting commit message if necessary. Also merged commits from target branch will be excluded when displaying incremental pull request changes to make it easier to understand

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

**Show review and build status in pull request list**

To help users getting a better glance of what happened in pull requests, review and build status now get displayed in pull request list

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

**UI to compose complex sorts**

Previously one has to use order by clause to sort issues, builds and pull requests. Now this task is easier via a smart sort widget. Just select fields to order, and OneDev will compose the query automatically

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

**Publish and render markdown in build**

Besides ordinary artifacts and html reports, one can also publish markdown in a build process and get it rendered in a separate build tab to make important information explicit

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

**Rule to transit inactive issues to specified state**

Sometimes it is desirable to transit inactive issues to a certain state, for instance to mark it idle and notify relevant participants, and finally close it if no one cares about it. Now this is possible via a custom state transition rule

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

[And many more](https://code.onedev.io/projects/onedev-server/builds/797/fixed-issues?query=%22State%22+is+%22Released%22+order+by+%22Type%22+asc+and+%22Priority%22+desc)
Investigating interactions between dev.to and stackbit
Tags: projectbenatar, showdev, rstats, meta
Published: 2020-06-26 10:18:47

## Is the `description` also the `excerpt`?

I was poking around in the [dev.to api](https://docs.dev.to/api/), and
had my [stackbit cms
integration](https://dev.to/devteam/you-can-now-generate-self-hostable-static-blogs-right-from-your-dev-content-via-stackbit-7a5)
open in another window and I noticed something I hadn’t before. My first
ever post had a neat ‘excerpt’ that wasn’t actually part of the main
body of the post. My other posts didn’t. In the `yaml` there is actually
a key called `excerpt` with the string in question. The API also has a
value that can be part of the response which is a string labelled
[“Description”](https://docs.dev.to/api/#operation/createArticle)
which I hadn’t integrated into my
[`dev.to.ol`](https://github.com/DaveParr/dev.to.ol) package yet. I have
now. I must have written that first post through the editor built into
the website. Is this field no longer supported? I seem to be able to set
it through the API, but I can’t see the info anywhere on the current
site.

So, if I’m correct, this post should show up with a neat little
description on stackbit, but not on dev.to. 

UPDATE: Apparently not. So what does the description field do then?

## Should liquid tags work in stackbit?

I like the liquid tags, in some cases. I was even debating writing an R
function to convert a url into the relevant liquid tag through string
parsing, but I’ve spotted that liquid tags aren’t actually supported by
stackbit? See the end of this post on dev, and this copy of it on my
stackbit site, where the link seems large and broken. Are there plans to
support this on stack bit? Or do you already, and I’ve just not spotted
how to ‘turn it on’?

> n.b. if you are on my personal site daveparr.info, this might be
> confusing, but it’s actually generated from my content on dev.to via
> an integration with stack bit. You can see more about this from the
> links in the footer VVV
Laravel Gate Inspection
Tags: laravel
Published: 2020-06-26 10:18:14

---
title: Laravel Gate Inspection
published: true
description: Inspect your Gates for a better UI
tags: laravel
---

If you use Laravel gates and policies, chances are they look like this:

```PHP
use Illuminate\Auth\Access\Response;

class UserPolicy
{
    use HandlesAuthorization;

    public function viewAny(User $user)
    {
        if (! $user->hasRole('admin')) {
            Response::deny("you must be admin to view the users");
        }

        return Response::allow();
    }
}
```

If so, instead of hiding links and button in your views via @can and @cannot, you may want to display a message instead. 

To do so, you can simply inspect the gate:

```BLADE
@can('viewAny', User::class)
    <a href="{{ route('app.user.index') }}">User Index</a>
@else
    You cannot index users because {{ Gate::inspect('viewAny', User::class)->message() }}
@cannot
```

Read more about Gates and Responses in [The Laravel Doc](https://laravel.com/docs/7.x/authorization#gate-responses)

## Just a bit further

You may want to add this to your AppServiceProvider as an helper for your Blade templates

```PHP
class AppServiceProvider
{
    public function boot()
    {
        Blade::directive('reason', function ($expression) {
            return "<?php echo Gate::inspect($expression)->message() ?>";
        });
    }
}
```

And use it like this:

```BLADE
@can('viewAny', User::class)
    <a href="{{ route('app.user.index') }}">User Index</a>
@else
    You cannot index users because @reason('viewAny', User::class) }}
@cannot
```

Which is slightly prettier.
Top 5 Books Each Programmer Must Read During Their Entire Life. Part 3
Tags: books, webdev
Published: 2020-06-26 10:17:21

Martin Fowler is credited with a quote: “Any fool can write code that a computer can understand. [Good programmers](https://websailors.pro/) write code that humans can understand ”.

Today almost every book that contains material on code developing and controlling has a reference to M. Fowler’s “Refactoring”. Despite its size of over 400 pages, the book is a real page turner. The main reason of its popularity is the quality, practical orientation, and applicability. 

Each main information block begins with an example and aimed on improving the code given in it. The only issue for an unprepared reader is that the book contains many philosophical quotes. However, as odd as it sounds, they are all aimed on practical use.

The refactoring process itself is presented not as something abstract or as simple change of names of variables and functions, but as a process of step-by-step improvement of code and software’s internal structure, making it easier to understand the operating principles and modify the code, not changing its purpose.

The book gives answers to such questions as when to change the code, which code needs to be changed, and how to perform such change.

All examples and proposed solutions include large code blocks and particular methods, classes, method parameter sets, repeated sections and “bottlenecks” where objective-oriented programming principles are violated.

We should particularly mention that there is a whole paragraph dedicated to test driven development (TDD), creation of automated tests, and description of particular testing environments.

It can also be underlined, that specialists who read the “Refactoring” often change their approach to coding, becoming more literate, accurate and concentrated on what they are doing.

Next Part of this Series of Articles we at [WebSailors](https://websailors.pro/) will tell you a bit more about the fourth book in our Top 5 — “Clean Code” by Robert C. Martin. Stay with us!

Source - https://websailors.pro/
Read our new article - [How to protect company data from hackers](https://websailors.pro/how-to-protect-company-data)
I will help your blog reach 5000+ readers
Tags: wordpress
Published: 2020-06-26 10:14:16

So I am looking to help 5 bloggers. I am the founder of pipfeed.

My goal is to help 5 bloggers get over 5000 followers on pipfeed. Send me a message if you are interested. Anyone who gets 500+ followers will be eligible for sponsored articles on pipfeed. Which will be the first target.

So I create a forum.

Can you guys please add your blog here:
https://forum.pipfeed.com/d/2-please-introduce-yourself

I will review each blog and personally reply to what you can do to improve.

You can also send me a message on this discord server: https://discord.gg/PJDfqp8
Give Heart Button Microinteraction with CSS Loop VueJS
Tags: codepen, vue, css, javascript
Published: 2020-06-26 10:13:54

<p>If the button is clicked, heart will pop-up, and fade after a second.</p>

<p>I did the functionality using single file VueJS component, and I used CSS (Using Sass or SCSS pre-processor) loop technique for animations. I readied many angles for the pop-up.</p>

<p>This microinteaction is becoming common in live broadcast of few applications.</p>

{% codepen https://codepen.io/takaneichinose/pen/WNrOBZX %}
Make a Stunning Website With Html/CSS
Tags: css, html, website, makewebsite
Published: 2020-06-26 09:47:16

Hii today i will show u that how u can make a Website With just Html/Css No java required  
So lets start without wasting the time

What is html?
Html or standard language which is nothing but this language will help you to build a website is not the website only back and not front

What is Css?
CSS in control cancel statement with the help of the acid can make amazing amazing for landing page
For more Folow Me on Mine Instagram 
Https://t.me/asadnoultech1
Https://www.instagram.com/asadnoultech
100 Days of SwiftUI — Day 27
Tags: 100daysofswiftui
Published: 2020-06-26 09:46:14

---
title: 100 Days of SwiftUI — Day 27
published: true
date: 2020-06-26 09:45:35 UTC
tags: 100daysofswiftui
canonical_url: https://zeitschlag.net/100-days-of-swiftui-day-27/
---

Today I implemented the [fourth project](https://www.hackingwithswift.com/100/swiftui/27). It's a fun little app that helps you calculate when you should go to bed. It takes some parameters (when do you want to wake up? How many hours do you want to sleep? How many cups of coffee did you have?) into consideration and uses machine learning to calculate your bedtime. I really like those small projects Paul came up with for this course.

The app uses SwiftUI — of course — and the model I created yesterday. I have to admit, that I'm quite surprised, how easily you can add some machine learning to the app — and probably acquire some venture capital, as your app now has machine learning!!!!!1

As always: thanks for reading. Feels good to be back on track with this tutorial :-)

<!--kg-card-end: markdown-->
Axios or Fetch?- in 2 minutes
Tags: node, react, webdev, api
Published: 2020-06-26 09:31:39

Ever wondered why developers are going for Axios over fetch? As we are aware both are the means to deal with HTTP or XMLHttp requests, Both are capable of making all types of API calls (get, post,put.. etc.). Both are based on Promise API which is native to ES6. But what are the major points to be noted?

*First*, .fetch() has a two-steps process while handling JSON data. The first makes the actual request and then the second is to call the .json() method on the response.
```javascript
const url = 'https://api.spotify.com/v1/artists/0OdUWJ0sBjDrqHygGUXeCF'

fetch(url)
.then(response => response.json())
.then(data => console.log(data));
```

As a good developer, our main aim is to minimize the code. Axios deals it with a single line.
```javascript
const url = 'https://api.spotify.com/v1/artists/0OdUWJ0sBjDrqHygGUXeCF'

axios.get(url).then(response => console.log(response));
```

![image by gifmaker](https://media2.giphy.com/media/W3a0zO282fuBpsqqyD/giphy.gif?cid=ecf05e47757ce9599316945c4c9db747316ba329b60a0277&rid=giphy.gif"Logo Title joey")
*Second is*, Error handling. Logically if .fetch() gets an error it would enter the .catch() block and should return but, it eventually executes the next then() in chain. see below:

![Alt Text](https://user-images.githubusercontent.com/66199202/85840925-3275be80-b752-11ea-9e04-a0abe45d9792.png)

But Axios handles it, the way it is expected.
![Alt Text](https://user-images.githubusercontent.com/66199202/85840811-fb9fa880-b751-11ea-94a0-b2ee761cdad3.png)

it returns from catch, no more .then() chaining.
 
So, .fetch() method is a great way of getting HTTP requests native in ES6, but there are just few gotchas, that could be dealt by these third party libraries.
![image by gifmaker](https://media3.giphy.com/media/IgAay7r5YOBTYXqgBq/giphy.gif?cid=ecf05e472d2f702fd2c4f3623ec41c5b619cb89ff0dd3d27&rid=giphy.gif"Logo Title joey")
Enabling Exclusive Content with Web Monetization: The Right Way
Tags: html, webmonetization, javascript, paymentpointer
Published: 2020-06-26 09:26:34

In a [previous post](https://dev.to/chin98edwin/making-your-payment-pointer-read-only-1d75), I talked about how payment pointers can be modified just like any other HTML element in the DOM tree.

I came up with a solution to deal with it, if not, at least make it harder for the payment pointer to be tampered with. But as I kept on researching, I found yet another way from technical specifications in the WM (Web Monetization) official site. It's not necessarily *"the only right way"*, but it is a rather practical way.

# The Missing Part

The thing is, not even the [complete example](https://webmonetization.org/docs/exclusive-content#code-1) given by WM mentions about it. 

When a transaction occurs and a monetization event is emitted, you can (and should) check its payment pointer via `event.detail.paymentPointer`, if the payment pointer is different, stop showing exclusive content immediately.

```diff
  if (document.monetization) {
-   document.monetization.addEventListener('monetizationstart', () => {
+   document.monetization.addEventListener('monetizationstart', (event) => {
+     if (event.detail.paymentPointer === MY_PAYMENT_POINTER) {
        showExclusiveContent()
+     } else {
+       hideExclusiveContent()
+     }
    })
  }
```

<br/>
Note:
* This code is based on a small portion from the example by WM
* I would suggest adding a listener for `'monetizationprogress'` and check the payment pointer too just in case.

<br/>
For reference purposes, below is a screenshot showing the details from an emitted monetization event:
![Monetization Stop Event Details](https://dev-to-uploads.s3.amazonaws.com/i/m1edrg174hnv7skvhelw.png)

<br/>
# So now,

You know the concept of enabling exclusive content by making sure you get paid for it... with a client-side approach at least. (￣▽￣) And I'd say the Payment Pointer Protection approach is still relevant as it acts as an additional layer of safeguard. After all, it's a thing that takes place in the browser. We don't have as much control over the things that happen as we do in the backend.

With that said, I shall post more updates on this topic should I find something interesting. Until then, peace. ✌️
Data Structure: Binary Search with python
Tags: python, productivity, algorithms
Published: 2020-06-26 09:12:49

So let's say you want to find the number in a sorted list with a quick and easy.

There are two ways that you can do.

1. you can go one by one and check if the current element is the target element. suppose if we have 1000000 elements you will do it million times.

2. Using binary search

with binary search you can find your target element in log2 of N time. Suppose if we have 1000000 elements you will search only 20 times.


So how ?

# binary Search
is a logarithmic search. 

# Time complexity (worse-case)
O(log N)

# Noted
Binary search is only work with sorted list.

Code:
```python
arr = [1,2,3,4,5,6,7]
target = 4

def binary_search(arr,target):
    low = 0
    high = len(arr) -1
    while low <= high:
        mid = (high + low) // 2
        guess = arr[mid]
        if target == guess:
           return mid

        if guess > target:
           high = mid
        else:
           low = mid
    return None
```
Gutenberg editor color palettes for WordPress themes
Tags: wordpress, css, colors
Published: 2020-06-26 09:11:25

One of my favorite features of the Gutenberg block editor is the [editor color palette](https://developer.wordpress.org/block-editor/developers/themes/theme-support/#block-color-palettes). It allows themes to register a color palette that is shown in the block editor whenever a block needs to choose a color.

Allowing the theme to have a say in the styling of the content of the post is a powerful idea. It helps guide the user’s design choices while still allowing them freedom to make changes. When working on [Zuari](https://wordpress.org/themes/zuari/), it was important for me to get this right since the theme is otherwise just black and gray. 

![Color palette for Zuari](https://dev-to-uploads.s3.amazonaws.com/i/luvajjcjj81f1j6j9dm9.png)

Once we have the colors picked and named (This can be tricky. What is ecru?) we need to let WordPress know that our theme would like to register a palette, and add our colors to it:

```php
add_theme_support( 'editor-color-palette', array(
            array(
                'name' => __('Brick', 'zuari'),
                'slug' => 'brick',
                'color' => '#825A58'
            ),
            array(
                'name' => __('Baby Pink', 'zuari'),
                'slug' => 'baby-pink',
                'color' => '#E0BAC0'
            ),
            array(
                'name' => __('Ecru', 'zuari'),
                'slug' => 'ecru',
                'color' => '#E1D9D3'
            )
) );
```

Next, we’ll need to add two CSS classes for each of these colors so that they can be used on the different blocks as background and foreground colors. The naming convention for these classes is has-{slug}-color and has-{slug}-background-color:

```css
.has-brick-color { color: #825a58; }
.has-baby-pink-color { color: #e0bac0; }
.has-ecru-color { color: #e1d9d3; }

.has-brick-background-color { background-color: #825a58; }
.has-baby-pink-background-color { background-color: #e0bac0; }
.has-ecru-background-color { background-color: #e1d9d3; }
```

That’s it! This will add the color palette to the block inspector for any blocks that need color, and show the right colors in the website once they’re selected.

![Block settings](https://dev-to-uploads.s3.amazonaws.com/i/qj55zktlft5smlz910i4.png)

I hope that WordPress adds these [colors as options](https://github.com/WordPress/gutenberg/issues/22296) in the [Customizer panels](https://wptavern.com/conceptual-ideas-on-how-the-customizer-could-integrate-with-gutenberg) as well, allowing for more design guidance coming from the theme. I’ve been thinking about WordPress themes as design patterns and guidelines rather than skeletons for a website. I’ll be writing about this soon.

_Cover image by [Carisse Weiser](https://unsplash.com/@carissaweiser) on [Unsplash](https://unsplash.com/photos/oPI3Oxj_cEw)_

_This post was originally published on [prtksxna.com](https://prtksxna.com/gutenberg-color-palettes/)_
A Kubernetes memory aid for beginners 
Tags: kubernetes, beginners
Published: 2020-06-26 08:52:57

Hello!
Since I'm a Kube beginner, I gradually started writing this memory aid.

It's not exhaustive at all, but it's a start :)
I hope it helps.

*You'll need this alias for all the listed cmd: `alias k='kubectl'`*

## Contexts
List contexts (and show the current one)
```
k config get-contexts
```

Switch context
```
k config use-context <CONTEXT_NAME>
```

## Pods
List pods
```
k get pod
```

Delete a pod
```
k delete pod <POD-ID>
```

Show pod details (and the events linked to the pod)
```
k describe pod <POD-ID>
```

Download a file from a pod
```
k cp <POD-ID>:<POD_FILE_PATH> <LOCAL_PATH>
```

## Containers
Connect to a container using `sh` or `bash`
```
k exec -it <POD-ID> -c <CONTAINER-NAME> <sh|bash>
```

## Logs
Show logs of a container 
```
k logs <POD-ID> <CONTAINER-NAME> -f
```

Show all the logs of a deployment
```
k logs -f deployment/<DEPLOYMENT-NAME> --all-containers=true
```

## Events
List events sorted by timestamp 
```
k get event --sort-by .lastTimestamp
```

## Secrets
Show secrets with age
```
k get externalsecrets
```

## Deploys
List deploys on a cluster
```
k get deploy
```

List deploys on a cluster, with details
```
kubectl get deploy -o=custom-columns=NAME:.metadata.name,STATUS:.status.phase,VERSION:.metadata.labels.version
```

Show deploy status
```
k rollout status deploy/<DEPLOY-NAME>
```

## Scale
Define the number of replicas
```
k scale deploy/<DEPLOY-NAME> --replicas=2
```

Show replicas sets
```
k get rs
```

## Cron
Show cron jobs
```
k get cronjobs
```
🏳️‍🌈 Be here & be proud! 🏳️‍🌈
Tags: devpride, pride, community
Published: 2020-06-26 08:52:44

---
title: 🏳️‍🌈 Be here & be proud! 🏳️‍🌈
published: true
description: Just a gay story :) ❤️ 🧡 💛 💚 💙 💜
tags: devpride, pride,  community
---
Hello! This story will be not so much about DEV but more about Pride. Ever since I joined the DEV community or steered my career in this direction, being gay has not once been an issue for me. I was not sure it would be this way, but am very fortunate it has. So far, because I know you can run into people with different views anytime. 
I never had a tough time coming out, which again makes me very fortunate, I am aware of this. I heard a lot of different stories over the years. 
That is why hashtags and sharing stories like what we do here is so important! Beginning of this year I visited San Francisco. And want to just remind you all of Harvey Milk. This amazing man and the work he did. And still I think it is so important to show yourself. Be visible! Do not hide who you are because you are beautiful being yourself. 
I know the minority I am in has the 'luxury' that we can hide, but I think we should not. How difficult it can be, and follow your own path and time of course. Just know the community is here.  

## I'm proud of...
It feels like a lifetime ago (2015) that I stopped volunteering after 9 years of work for a LGBT+ organisation for youth. We did (and they still do such amazing work. The organisations goal is that their work will be no longer necessary). 
I went to high schools to give guest lectures, there is a buddy project, we held events, meetups, pride days and summer camps and weekends away and so much more. 
But what I wanted to say on this, the people I met so many of them, all amazing and different and awesome in their own way. We went through so much with the team of volunteers. Highs and lows, and this year is the first time since its beginnings the summer camp is off (covid..). I am sad about this but also know that times are changing and communities rise up online and support is there. People are there. That is what I am proud of. 

## I find support in...
All these things to make us visible, big initiatives like pride parades to little things here and there. A little rainbow flag in a profile name. Posts like this with #devpride. People who are friendly and stay friendly after you come out to them. It all helps. Thank you. 

❤️ 🧡 💛 💚 💙 💜