teleren/devto huggingface dataset:
Introducing UndercoverCI!
Tags: ruby, rails, testing, github
Published: 2020-06-25 20:06:10

Today, I’m launching UndercoverCI— a CI robot who protects your Ruby codebase from untested code changes. Take a moment to learn why you should add it to your team’s code review workflow.

![A review comment by UndercoverCI](https://dev-to-uploads.s3.amazonaws.com/i/lpxd979buq610pxcu2tx.png)

#### What?

UndercoverCI is a GitHub App for Ruby that finds untested code changes in your commits and pull requests. UndercoverCI reads each of your diffs and compares them against a test coverage report to provide actionable review comments on untested methods, classes and blocks, whereas other coverage tools would only return a percentage total (and difference) for the entire commit.

Adding UndercoverCI to your code review workflow will prevent untested code changes from slipping into production without anyone noticing.

#### Why is that better than `$my_current_coverage_tool`?

I’ve written about why you should [stop shipping untested Ruby code with undercover](https://medium.com/futuredev/stop-shipping-untested-ruby-code-with-undercover-1edc963be4a6) and how to [wire it up with your workflow](https://medium.com/@mrgrodo/improve-your-ruby-code-reviews-with-actionable-code-coverage-and-undercover-c4480575ea69) when I released `undercover` — the core gem that actually powers UndercoverCI ([470+ stars on GitHub](http://github.com/grodowski/undercover) and counting!).

Here’s a TLDR. You should consider UndercoverCI if:
- You think that aiming for full test coverage might not be the best investment for your team, but want to ensure all pull requests are well-tested.
- You’d like to encourage your team to write more robust tests and increase test coverage where it matters and at the right time.
- You’d rather automate such code review comments (my coworkers’ real replies to undercover):

> Actually the tests weren’t even calling the code I’ve changed.

, or:

> Looks like this branch was never tested…

To recap the above points, existing coverage tools for Ruby provide percentage data and diffs, yet they guarantee that all committed lines are covered only if you hit 100% or review the test coverage report manually before each merge. You can automate that effort with UndercoverCI and get PR checks that look like if someone has searched for missing tests in the SimpleCov report. This makes it useful for projects scoring below 100% coverage or ones that won’t give you the confidence of a comprehensive test-suite at all. It’s a focused and local approach, which ensures that you invest in test coverage where it matters most.

#### 🕵️‍♀️ Ok, sign me up!

If you’re convinced, sign up on the [UndercoverCI website](https://undercover-ci.com) or go straight to [UndercoverCI on GitHub](https://github.com/apps/undercoverci) to install the app!

How much does it cost? Yes it’s going to be a paid product with a monthly subscription starting at about $29 (exact pricing TBD). Good news is that you can still get it for free if you sign up before **2020–07–31**!

---

This text was originally posted [on Medium](https://medium.com/@mrgrodo/introducing-undercoverci-98c6c50793f2)
Switch case, python?
Tags: beginners, python
Published: 2020-06-25 20:00:08

Ask your cat... "how can I use switch case in python?"
"- it's a conditional question, no?"
Yes! :)
maybe **if** you use the if, else or elif, you may see that this is possible.
Python doesn't use a "switch" in syntax so... you can use them in your code, exactly like this:
```python
plants = int(input( "which seed do you want to buy?\n"
                      "1:Tulip"
                      "\n2:Rose bush"
                      "\n3:Pineapple"
                      "\n4:Banana\n"))
if plants == 1:
    print("Tulip" )
else:
    if plants == 2:
        print("Rose bush")
    else:
        if plants == 3:
            print( "Pineapple" )
        else:
            if plants == 4:
                print("Banana")
            else:
                if plants > 4:
                    print("enter a valid option")
```
Pay Cut? For Remote work?
Tags: discuss, watercooler
Published: 2020-06-25 19:47:51

This Covid-19 breakout has proved that most of the employees in IT Industry especially software developers can work remotely on a full time basis. But that leaves us with an argument of whether there should be a pay cut for those working from home.

I firmly believe that there shouldn't be any reduction to the salaries of work from home employees only on an biased belief that these employees are less productive. I understand that there could be some who are not completely willing to do their best as no one is keeping an eye on them. But that should do unjust with the ones doing good or even better than normal office work.

What are your ideas/thoughts on this situation? Are you ready to accept a pay cut?
Diun 4.0 available with Kubernetes support
Tags: docker, devops, showdev, go
Published: 2020-06-25 19:28:15

---
title: Diun 4.0 available with Kubernetes support
published: true
description: Receive notifications when a Docker image is updated on a Docker registry.
tags: docker,devops,showdev,golang
---

{% github crazy-max/diun %}

Diun 4.0 is now available and adds [support for Kubernetes](https://crazy-max.github.io/diun/providers/kubernetes/) and also [other improvements](https://crazy-max.github.io/diun/changelog/).

## New website

A website for documentation using MkDocs Material has been created: https://crazy-max.github.io/diun/

![Website](https://dev-to-uploads.s3.amazonaws.com/i/kq3hrivt8vzlpseju9mq.png)

## Kubernetes

For this [new provider](https://crazy-max.github.io/diun/providers/kubernetes/), the analysis can be done on all pods in all or custom namespaces:

```yaml
providers:
  kubernetes:
    namespaces:
      - default
      - production
```

The configuration can be global for your provider or more refined with [Kubernetes annotations](https://crazy-max.github.io/diun/providers/kubernetes/#kubernetes-annotations) dedicated to Diun:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: nginx
spec:
  selector:
    matchLabels:
      run: nginx
  replicas: 2
  template:
    metadata:
      labels:
        run: nginx
      annotations:
        diun.enable: "true"
        diun.watch_repo: "true"
    spec:
      containers:
        - name: nginx
          image: nginx
          ports:
            - containerPort: 80
```

## Other improvements

* Configuration [transposed into environment variables](https://crazy-max.github.io/diun/config/#environment-variables)
* Automatically determine registry options and credentials based on image name (registry domain and/or repo path)
* Display hostname in notifications
* Add link to respective hub in notifications
* Add Mattermost compatibility via Slack webhooks

Let me know if you have any questions or if you are waiting for new features!

---

Support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) 👏 or by making a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! 🚀

Thanks again for your support, it is much appreciated! 🙏
5 cool resources for designers
Tags: designers, webdev, tools, design
Published: 2020-06-25 19:18:16

Whether you're a web developer or software developer or any kind of designer more often than not you will need some designing tools and resources that lie outside of code. 

Here's my pick of 5 cool resources designers can use to greatly enhance their projects.



![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/l6ebtfrralysby3o39md.jpeg)
<h2>1. Behance</h2>
Behance is a photo and illustrations sharing platform that host infinite stunningly beautiful designs for your inspiration.

Website: www.behance.net
<br><br>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qjsm2lvf9zcp9403c1a5.JPG)
<h2>2. Let's Enhance</h2>
Let's enhance is a powerful AI that increases image resolution without quality loss. 

Website: https://letsenhance.io/
<br><br>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ts2b2w0x915xwxmkdm3r.png)
<h2>CSS Gradient</h2>
CSS Gradient is a convenient and customizable gradient generator that helps you create beautiful gradients in a photoshop style. It automatically geenrates the css code for you!

Website: https://cssgradient.io/
<br><br>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4rhaqywhd6nep4xjfgrm.jpg)
<h2>Unsplash</h2>
Unsplash is the best completely free stock image website, that boasts only high resolution and professional images for that sophisticated look  to add to your website.

Website: www.unsplash.com
<br><br>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/j4gwx4x28sd4pby6wocm.jpg)
<h2>Tinyjpg</h2>
TinyJPG is an image compression tool online that reduces your image size greatly while keeping the quality intact. It is super useful for using images on website so they don't slow down the site.

Website: www.tinyjpg.com
<br><br>


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7mb4ssk12a5wwv7lslv2.png)
<h2>Bonus: Clippy CSS</h2>
Clippy is a css clip-path tool online that you can use to easily create any shape for your elements in css.

Website: www.bennettfeely.com/clippy
Micro Kubernetes cluster
Tags: kubernetes, microservices, rails
Published: 2020-06-25 19:17:38

We continue playing with Kubernetes and now migrating local development on k3s. I will make a few posts about it in the next two weeks. Also, we decided to test how it working with ARM64. Now Apple is moved to ARM and we want to know how to develop locally on one platform and deploy to another... 

![Lets party begin!](https://dev-to-uploads.s3.amazonaws.com/i/92un4thxiumner78nars.png)
If you are using Lighthouse, think about this
Tags: javascript, webperf
Published: 2020-06-25 19:13:27

[Lighthouse](https://developers.google.com/web/tools/lighthouse) is a tool that comes with Chrome, which we often use to analyze a website for performance, SEO, best practices, etc. 

Recently, I discover a trend among developers who want to get the top score for their websites. Or they expect websites to have a 100% score.

So, I want to understand whether it's a good idea to optimize our apps for Lighthouse or not. Then I ran Lighthouse on a set of popular websites I use every day. Here's the result.

{% youtube i0cCXZlUeCw %}

Read more: [Lighthouse Syndrome](https://arunoda.me/blog/lighthouse-syndrome)
Where do you think ethics in tech is falling short?
Tags: podcast, discuss
Published: 2020-06-25 19:11:06

---
title: Where do you think ethics in tech is falling short?
published: true
description: Answer this week's DevDiscuss question for a chance to be featured in next week's podcast episode!
tags: podcast, discuss
---
The format of DEV's first official podcast, [DevDiscuss](https://dev.to/devdiscuss), begins with an interview and ends with commentary from the community.

For this week's episode, we want to know...

#### Where do you think ethics in tech is falling short?

If you'd like a chance to be featured in the episode, please send us a voice memo or leave a comment below by next Wednesday, July 1st.

### Details on how to participate:
* Call our Google Voice at +1 (929)500-1513 and leave a message 📞
* Send a voice memo to pod@dev.to 🎙

OR, if you don't want your voice recorded...just leave a comment here and we'll read your response aloud for you 🗣

### Our most recent episodes:

{% podcast https://dev.to/devdiscuss/s1-e8-our-least-favorite-things-about-our-favorite-languages %}

{% podcast https://dev.to/devdiscuss/s1-e7-voices-from-dev-pride %}
Running Ubuntu on Lenovo Yoga 530 Transformer Laptop
Tags: ubuntu
Published: 2020-06-25 18:54:00

Lenovo Yoga 530 is a rather inexpensive laptop computer. It transforms into a tablet, has a touchscreen and a stylus. I have its 14ARR variety, which runs on AMD CPU.

![Image from somewhere on the web](https://dev-to-uploads.s3.amazonaws.com/i/cyj26sgngjmkhlhtscsw.png)

This article is a compilation of tips & tricks I found useful when running this device on Ubuntu.

# Hardware Upgrade

*(This section is not OS related just yet.)*

- Stock configuration came to me with 8G RAM, which is insufficient
- According to a number of sources,
    - [Lenovo website](https://www.lenovo.com/ru/ru/laptops/yoga/500-series/Yoga-530-14-AMD/p/88YG5001050)
    - [Reddit thread](https://www.reddit.com/r/Lenovo/comments/8t5qx1/yoga_520_530_ram_upgrade/)

    the upgrade is only possible to 16G RAM total (not to 32G, which I would love to have).

The laptop comes with two 4G sticks in it, so you'll have to replace them both with 8G sticks to have 16G total.

# WiFi

Out of the box, Ubuntu won't see the built in WiFi adapter (which happens to be RealTek RTL8821CE).

## BIOS

Go to bios and turn off SecureBoot. It tends to turn it on again after BIOS upgrades.

## Blacklist

Popular solution is to blacklist `ideapad_laptop` kernel module (like mentioned at [this Lenovo forum thread](https://forums.lenovo.com/t5/Other-Linux-Discussions/Yoga-920-How-to-run-Linux/td-p/3895778)), like this:

```bash
echo "blacklist ideapad_laptop" >> /etc/modprobe.d/blacklist_ideapad.conf
```

However it did not enable WiFi for me. (Though I am not certain it was not helpful together with the next point.)

What helped was this:

```bash
echo "blacklist 8821ce" >> /etc/modprobe.id/blacklist-ideapad.conf
sudo apt-get install rtl8821ce-dkms
```

WiFi connection turned on immediately.

# Onscreen keyboard nastily appearing every time you touch the screen

This is enormously annoying, trust me. But:

```bash
sudo apt-get install chrome-gnome-shell
```

and [this Gnome extension](https://extensions.gnome.org/extension/1326/block-caribou/) — voila, problem solved.

# Some generic stuff not related to this laptop but I will write it anyway

## Docker won't run without sudo

```bash
sudo usermod -aG docker $USER
reboot
```

## ElasticSearch won't run under Docker

...saying:

```
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
```

fix:

```bash
echo 'echo "vm.max_map_count=262144" >> /etc/sysctl.d/local.conf' | sudo bash
sudo service procps restart
```

As per this [https://github.com/docker-library/elasticsearch/issues/111#issuecomment-268511769](GitHub comment).

# Issues not yet resolved

* When configured Caps Lock for switching keyboard layouts, the light indicator on the button itself won't work
* Keyboard is not disabled when laptop is laying on it
Rails HashWithIndifferentAccess magical
Tags: ruby, rails, tricks
Published: 2020-06-25 14:35:43

---
title: Rails HashWithIndifferentAccess magical
published: true
description: 
tags: Ruby, Rails, tricks

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

In daily development the parameters passed to the `action` in the `Controller` when implementing business logic will be placed in the `params` object. generally we can access with 

```ruby
params[:token] #=> token_value
#or
params["token"] #=> token_value
```

You will find that the value of **key** in `params` can be access by using `Symbol` or `String`. 

Is it a bit magical? 

In fact the principle is very simple `params` have the characteristics extend from `HashWithIndifferentAccess`

```ruby
class HashWithIndifferentAccess < Hash
  #......
	def []=(key, value)
		regular_writer(convert_key(key), convert_value(value, for: :assignment))
	end
  
	# key point 
	def convert_key(key) 
	   key.kind_of?(Symbol) ? key.to_s : key
	end
	
	def self.[](*args)
		new.merge!(Hash[*args])
	end
end
```

Through the above source code analysis, it can be seen that for a `HashWithIndifferentAccess` object, when assigning it **key** is uniformly converted into **String** type (`covert_key` method). 

When a value is to be taken, the **key** of the Symbol will be forced to be converted to `String` so that the user can use **Symbol ** or **String** to take the same value.


Hope it can hlep you :)
But what is: Recursion? Recursion? Recursion? Recursion?
Tags: beginners, javascript
Published: 2020-06-25 18:50:40

Google recursion and you will find out exactly what it is, but if you have a moment I will try to explain what it is without going round in circles.

``` js
// Recursion is the name for an activity that could go on and on.
```

True recursion never ends, in JavaScript that should mean a function calls itself over and over.

Now the effect is that a synchronous recursive function will block the program bellow this code (or above) from running until the recursion ends and we leave this function behind for garbage collection. Rucursion never ends unless we provide an exit condition otherwise you will get an overflow, imagine your program is a bathtub, it can only contain a finite amount of water. We say that every 1ms we turn the tap on and then off again filling the bathtub with a drop of water, the water represents memory used and the tub well that's the total memory available to your program 😊 (I know it's not quite like that) if we don't say "when the bathtub is full or reaches maybe 75% capacity, stop running the tap" we get an overflow, more memory was used than was available to your program, without such limits perhaps your computer will catch on fire 🔥.

Here is a recursive function:
``` js
// Exotic fruit tree from ebay
const pearAppleTree = {
   fruit: 'apple',
   tallerBranch: {
      fruit: 'pear',
      tallerBranch: null
   }
}

const treeClimber = (branch) => {
   if (branch.tallerBranch) { // exit condition
       console.log(branch.fruit);
       treeClimber(branch.tallerBranch);
   }
}

treeClimber(pearAppleTree);

console.shout('not blocked will carry on with program')
```
I'm excited to tell you that we climbed to the top of the tree and found some fruit all the way up apart from the top so we stopped and climbed down.

On the first branch, we saw an apple 🍎
On the second branch, we saw a pear 🍐
Then somebody shouted, "your all done climbing that tree? Okay.. well I'm just going to carry on with what I'm doing, il call the garbage person to deal with that fruit because all you did was log it to console for some reason, k bye."

Hope that helps you learn some more programming experience, if not I failed, I failed, I fai...
Stop Using Fixed Headers and Start Using Sticky Ones
Tags: css, webdev, design
Published: 2020-06-25 18:41:30

Like them or not, headers that stay visible at the top of the page are a very popular UI and will likely not be going away anytime. Many sites make use of this kind of header, including Reddit, Facebook, Apple, and even DEV. What do each of these sites have in common? **They are all using fixed headers**. 

I wanted to share that there is a better way to do this, and I am curious as to why no one is taking the approach of using a sticky header instead.

## The issue with fixed headers

By using `position: fixed` on an element like the header, the element is removed from the stack and positioned relative to the browser window. That means it no longer takes up space and any elements positioned after it will adjust to fill up that area. In regards to a header, that means elements will be placed underneath it and you'll need to accommodate for it by using padding or relative positioning.

See Dev or Apple, which use a variable to store the header height and applies padding to the body or main tag:

![Dev](https://dev-to-uploads.s3.amazonaws.com/i/6wfx5l3ia4o6y0wv1kuq.png)

![Apple](https://dev-to-uploads.s3.amazonaws.com/i/qyolz5fuajqgsdgrfofi.png)

Or Facebook, which uses relative positioning and a top offset to adjust for spacing:

![Facebook](https://dev-to-uploads.s3.amazonaws.com/i/4m6m5kp05b00zmwgpu9u.png)

Or Reddit, which uses a margin to solve it instead:

![Reddit](https://dev-to-uploads.s3.amazonaws.com/i/mc9eejkzeg04r6t0qsaz.png)

This is probably the worst way to build a header like because it's not responsive and extra unnecessary css. I suggest that headers like this should use sticky positioning instead.

## The benefits of sticky positioning

By using `position: sticky` on a element like the header, it does a few great things. First of all, it doesn't remove the element from the stack, so it still keeps it's real estate in the container. That means you don't have to perform any of these hacks to get the right spacing for the main content and the header. Also, it still stays at the top of page or wherever you need it based on the scroll position. So instead of:

- Setting header to `position:fixed`
- Calculating the height with JS or manually adding it to a variable
- Adjusting the position of the content with padding, margins, or relative positioning with that variable

All you have to do is:

```
header {
  position: sticky;
  top: 0;
}
```

And that's it, no extra variables or calculations needed.

Here is a very simple example in a Codepen:

 {% codepen https://codepen.io/LegendOfLuis/pen/QWyMdVP default-tab=css,result %} 

## Browser Support

Of course, the only downside is that it does not work on IE 11:

![Can I Use Sticky Position](https://dev-to-uploads.s3.amazonaws.com/i/evqdkckzp7ipl2rq99ur.png)

But really though, who is accessing the Apple website or Dev from IE11? Maybe I'm just crazy, but think there a few sites that can start making this transition over to sticky positioning.
WebdriverIO getText vs getValue
Tags: testing, beginners, webdriverio, testautomation
Published: 2020-06-25 18:39:10

WebdriverIO getText and getValue commands are sometimes confused. Persons tend to use them interchangeably and this results in errors such as expected “string” to equal ’ ’ or expected “string” to equal null. In this tutorial we explore the difference with both commands as well as how to handle these errors.

{% youtube kdMpI5JUaBI %}
June update
Published: 2020-06-25 18:38:10

---
title: June update
published: true
description: Updating where I stand with IT at the moment 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

Been a while. Been staying off of most social media platforms to concentrate on leveling up my coding skills. I’ve also been studying to take the CompTIA Security+ exam. Had been going hardcore and decided to break it up by learning C a little each day. On a whim I took the C assessment on LinkedIn... and passed. 😃 A small thing to most but I am very happy about it. I’m starting to delve into intermediate/advanced C topics and am getting a better understanding of how my computer functions. Really looking forward to get into Linux, Network, and maybe firmware programming. 
I’m hoping to take & pass the Security+ exam in late August or early September. Trying to make the most of this insane year. Hope everyone is well. 🙏