teleren/devto huggingface dataset:
Unit testing is more important than you think
Tags: testing, jest, mocha, programming
Published: 2021-04-11 02:17:12

---
title: Unit testing is more important than you think
published: true
date: 2018-08-14 18:00:00 UTC
tags: Testing, Jest, Mocha, Programming
---

 ![Unit testing is more important than you think](https://shakil.me/content/images/2021/02/1_TOL3mutcAV7gEEnIH0DVmg.png)

The most important benefit unit testing gave me is being able to make changes without fearing things might blow up due to even a small change. The whole process of Software development is dealing with complexity where each new step creates a brand new tangle in the already existing fuck sandwich of a stack.

For smaller projects, you may get away okay without writing unit tests. But in a decent sized project with more than one developer involved, it's a must if you want to keep your sanity intact.

![Unit testing is more important than you think](https://media.giphy.com/media/MVgLEacpr9KVK172Ne/giphy.gif)

As engineers, all we do is making things that reduce human effort. So why hurt your brain thinking about whether your current changes will break another feature? leave it to the software to test. Unit testing is testing your function as a small unit of your entire app. Besides making sure your function is working properly, this practice has some beneficial side effects as well.

**Superior error handling**  
The difference between a good and bad software is that the former handles errors better. When you write code with tests in mind, you know there will be test cases that provide invalid data or invoke the function with incorrect parameters and expect it to throw certain errors. Having tests in mind will automatically force you to write better code and deal with different types of errors in proper way.

Another way it helps you handle errors better is you can copy test cases for similar features from open source projects. For example, if your code deals with http requests, you can find the test cases commonly used on network requests and add those to your code. Why reinvent the wheel?

**Better reasoning about the software**  
Test driven develoment is overall a better strategy of software development in my opinion. Thinking about your code in this approach gives a clearer picture.
Graveyard Groundskeepers
Tags: graveyard, roundup
Published: 2018-08-14 17:21:22

---
title: Graveyard Groundskeepers
published: true
description: We all have abandoned projects in our own personal graveyards.
tags: graveyard, roundup
cover_image: https://cl.ly/3W2N0o1w1E2k/Image%202018-08-13%20at%206.40.01%20PM.png
---

I've really enjoyed observing the trend of DEV members sharing their own personal project graveyards.  A project graveyard is the folder filled with those projects we start and never finish.  Every coder has them. It's been a cool outlet to see people share past passion projects, the "could have been's," and the "what was I thinking?" experiments.

[Isaac](https://dev.to/isaacandsuch) gets full credit for starting the 🌊, with this post:

{% link https://dev.to/isaacandsuch/github-graveyards-ill-show-you-mine-49lh %}

That inspired a few comments:

{% devcomment 4i4f %}

{% devcomment 4hpk %}

And then the first post, by [Kay](https://dev.to/kayis):

{% link https://dev.to/kayis/my-github-graveyards-2l95 %}

Quickly followed by four more great threads:

{% link https://dev.to/avalander/my-github-graveyard-172b %}

{% link https://dev.to/tux0r/my-bitbucket-graveyard-3deh %}

{% link https://dev.to/domcorvasce/my-github-graveyard-1hdo %}

{% link https://dev.to/vikkio88/my-github-graveyard-part-1-27pg %}

I hope this trend continues, and that more folks continue to share their past projects under the [#graveyard](/t/graveyard) tag.  

It's a fun reminder to all of us that not every project has to become the next Facebook.  And hey — maybe someone else will be inspired to pick up where you left off.
Help! I'm A Mobile Developer Now!
Published: 2018-08-14 15:54:28

---
title: Help! I'm A Mobile Developer Now!
published: true
description: What To Do When Tasked With Mobile Development    
tags: 
---

# Help!

So...my very good friend runs a startup and has made the decision to scrap the tech that he has now and asked me to rebuild it for him. I'm super excited to work on it...but I don't know much about mobile-first development.

It needs to be available in the app stores, but doesn't really need much access to the native capabilities of the device (it's a social coupon kind of thing). 

**How do I decide what technologies in which to build it?**
React Context API: Managing State with Ease
Tags: react, javascript, redux, api
Published: 2018-08-14 17:01:16

---
title: React Context API: Managing State with Ease
published: true
description: Managing state with the new React Context API is very easy. Learn what the differences with Redux are and how to use it in this practical tutorial.
tags: #react #javascript #redux #api
canonical_url: https://auth0.com/blog/react-context-api-managing-state-with-ease/
---

The React Context API isn't a new thing on React's ecosystem. However, the React's 16.3.0 release brought a lot of improvements to this API. These improvements are so overwhelming that they greatly reduce the need for Redux and other advanced state management libraries. In this article, you will learn, through a practical tutorial, how the new React Context API replaces the need for Redux on small React applications.

[Read on ⚛️](https://auth0.com/blog/react-context-api-managing-state-with-ease/?utm_source=dev&utm_medium=sc&utm_campaign=react_context_api)

![React Context API: Managing State with Ease](https://thepracticaldev.s3.amazonaws.com/i/bd284i7so8pffmutaibk.png)
Open source Maintainers: How do you deal with feature requests?
Tags: discuss, opensource
Published: 2018-08-14 16:44:10

---
title: Open source Maintainers: How do you deal with feature requests?
published: true
description: 
tags: #discuss, #opensource
---


I'm a co-maintainer of a fairly popular open source project in its space and we get lots of feature requests and I'm not always sure what to do with them. For some, I can clearly see the merits and they're also something, I'd like to see in the project but just haven't thought of and I'll happily add them to our 'Feature Requests' github project. For others I can clearly say that it's not something that's going to be added to the project because it's very niche or something totally outside of the project's domain.

But then there are the ones in between, and most of them fall into this category, where I'm not a fan but can't quite articulate and defend why that feature shouldn't be added.

How do you folks handle these kinds of requests? Do you just add them to a list of feature requests like we do or do you have some kind of guideline as to what type of feature requests you will accept? Also how do you close those feature requests without the user feeling shut down or ignored?

Thanks for your inputs, I'm really looking forward to the discussion and to finding out how you deal with these sorts of things.
What is your task management process? Do you use trello, asana, calendar etc or a hybrid? And how?
Tags: productivity, tools
Published: 2018-08-14 16:42:30

---
title: What is your task management process? Do you use trello, asana, calendar etc or a hybrid? And how?
published: true
description: 
tags: productivity, tools
---

My method is described in a comment but also here:

I use 

- Trello for daily tasks(mostly towards my professional evolvement, like do that course, or spend some time with you side project)

- Calendar for what matters in terms of time(go to the doctor at 5pm)

- I am tracking habbits with the Seinfield method(like eat an apple every afternoon, no excuses)

- Sometimes I find it useful to note them down to a scrappy paper, just for the visual-kinesthetic part

https://lifehacker.com/281626/jerry-seinfelds-productivity-secret
#discuss What language do you think in?
Tags: discuss, languages, programming
Published: 2018-08-14 15:06:22

---
title: #discuss What language do you think in?
published: true
description: After learning several programming languages, which one do you think in?
tags: discuss, languages, programming
---
![Think](https://thepracticaldev.s3.amazonaws.com/i/ruup5gkzf3zw2a9dey6m.png)

##Scenario

You're in an interview for a job as a developer.  You are given a coding exercise to show how you logically attack a problem.  You're allowed to use any language of choice.

What language do you go to?

## Background

I've always have been fascinated by people who are multilingual and can speak many languages.  One question I love to ask is what language do you THINK in? I realize now that while I only _speak_ one language, I can write in multiple...programming languages, that is.

My answer to the above? **Java.**  My first language was PHP and later I worked a lot in Javascript/jQuery until I went to college for Java.

Oddly enough, I still think in Java.
Check If a File Was Uploaded with CarrierWave
Tags: todayilearned, rails, carrierwave, ruby
Published: 2018-08-14 14:47:49

---
title: Check If a File Was Uploaded with CarrierWave
published: true
description: 
tags: til, rails, carrierwave, ruby
---

# TL;DR

Use:

```ruby
user.avatar.present?
```

NOT:

```ruby
user.avatar.file.nil?
```

<!--more-->

# Details

When you want to check if a file is attached to your model, the official Carrierwave documentation says:

> Note: `u.avatar` will never return nil, even if there is no photo associated to it. To check if a photo was saved to the model, use `u.avatar.file.nil?` instead.

That's fine, it works. BUT! If you are using a cloud storage service like Amazon S3, each time the line `file.nil?` will be executed, a request will be sent to the cloud storage to check the presence of the file. As you guess, it's not cool because it can make your app slower.

The solution is simply to use `u.avatar.present?`. This way, no more external call.
Baker, a simple tool for provisioning virtual machines and containers.
Tags: showdev, devops
Published: 2018-08-14 14:36:24

---
title: Baker, a simple tool for provisioning virtual machines and containers.
published: true
description: Introduction to Baker.
tags: showdev, devops
---

Meet Baker! --- a simple tool for provisioning virtual machines and containers. 

Baker allows you to quickly create development environments for developing and running your code. With one tool, you have the functionality of vagrant, docker, ansible, and task runners like grunt.

This example creates a simple development environment for using mkdocs, a static site generator in python.

``` yaml
name: baker-docs
container: 
  ports: 8000
lang:
  - python2
commands:
  build: mkdocs build
  serve: mkdocs serve -a 0.0.0.0:8000
  gh-deploy: mkdocs gh-deploy
```

Quickly provision a VM with docker.

``` yaml
name: docker-env
vm:
  ip: 192.168.8.8
tools:
  - docker
```

To use baker, just place a `baker.yml` file in your current code repository, then run `baker bake`. You can run `baker ssh` to access your environment or run commands inside the environment with `baker run`. Your code is accessible in the baker environment via a shared folder.

For more details, checkout [docs.getbaker.io](https://docs.getbaker.io).
If you've never looked at Clojure before...
Tags: clojure, javascript
Published: 2018-08-14 14:30:58

---
title: If you've never looked at Clojure before...
published: true
description: a few samples of map, filter & reduce in Clojure
tags: #clojure #javascript
---

![women of nasa lego](https://thepracticaldev.s3.amazonaws.com/i/lac6r23g1clszaar0xfe.jpg)

If you've never looked at Clojure before, this brief article may be your first taste and I hope you savour the experience. Clojure is an alternative to Java. It features interop with Java meaning you can access core Java functions within Clojure. It is a server side language and thus you would also need either Javascript or ClojureScript to write web-based client code. 

I'm working on a [series of Clojure & ClojureScript lessons](https://github.com/headwinds/clojure-shed) to help me learn the language, and I've completed the [first lesson](https://glacial-badlands-20785.herokuapp.com/) introducing map, filter & reduce which I'd like to share with you. 

Why should you learn Clojure? If you are a fan of Functional Programming design patterns, you will appreciate the immutable nature of Clojure functions and its FP approach to server side development producing highly testable code. Like Python, Clojure also [features a REPL](https://www.braveclojure.com/getting-started/) where you can experiment and test functions of your program vastly speeding up development.

After a few weeks of writing Clojure and receiving valuable feedback from the much more seasoned Clojure devs at [TODAQ](https://www.todaqfinance.com/), I've managed to get several pull requests merged into our master branch and I've mainly learned to simplify my Clojure functions by pulling out complex sections and breaking them up into smaller, more manageable functions, increasing code readability. Once you begin to refactor deeply nested functions, all those braces begin to make sense and you can achieve some nice terse, code clarity.
Pass arguments from the command line to a Node script
Tags: node, javascript
Published: 2018-08-14 17:33:30

---
title: Pass arguments from the command line to a Node script
published: true
tags: node, javascript
canonical_url: https://flaviocopes.com/node-cli-args/
---

You can pass any number of arguments when invoking a Node.js application using

```
node app.js

```

Arguments can be standalone, or have a key and a value.

For example:

```
node app.js flavio

```

or

```
node app.js name=flavio

```

This changes how you will retrieve this value in the Node code.

The way you retrieve it is using the `process` object built into Node.

It exposes an `argv` property, which is an array that contains all the command line invocation arguments.

The first argument is the full path of the `node` command.

The second element is the full path of the file being executed.

All the additional arguments are present from the third position going forward.

You can iterate over all the arguments (including the node path and the file path) using a loop:

```
process.argv.forEach((val, index) => {
  console.log(`${index}: ${val}`)
})

```

You can get only the additional arguments by creating a new array that excludes the first 2 params:

```
const args = process.argv.slice(2)

```

If you have one argument without an index name, like this:

```
node app.js flavio

```

you can access it using

```
const args = process.argv.slice(2)
args[0]

```

In this case:

```
node app.js name=flavio

```

`args[0]` is `name=flavio`, and you need toparse it. The best way to do so is by using the [`minimist`](https://www.npmjs.com/package/minimist) library, which helps dealing with arguments:

```
const args = require('minimist')(process.argv.slice(2))
args['name'] //flavio

```
Need Advice in creating a Capstone Project 
Tags: student, it, website, discuss
Published: 2018-08-14 11:11:45

---
title: Need Advice in creating a Capstone Project 
published: true
description: 
tags: student, IT, website, discuss
---

Hello! I'm new in this community :) I'm currently a graduating IT Student.

I would like to be advised what possible projects to choose in creating a Capstone Project... 


I'm currently leaning towards in eCommerce or a web-based Stocking System.
My little personal website
Tags: showdev, website, optimization, pagespeed
Published: 2018-08-14 11:08:19

---
title: My little personal website
published: true
description: With focus on Google PageSpeed and metadata
tags: showdev, website, optimization, pagespeed
cover_image: https://thepracticaldev.s3.amazonaws.com/i/r639bhc3df8znwpnxmvl.png
---

Hi devs,

this is my first post on dev.to and I don't know if it is the right place to share [my personal website](https://kai.neuwerth.me/) but I want to give you a little insight what I found interesting while building it.

So on a free sunday I just had the idea to create a tiny personal site to be a bit creative, share my social network accounts and SSH & OpenPGP keys.

I finalized the "design" and wrote down the HTML, CSS & JS. I tested the PageSpeed score with [GTmetrix](https://gtmetrix.com/) and had a pretty bad score. Fortunately GTmetrix provides some really good guides on how to improve certain criterias. Activated some caching here, enabled some webserver mods there and optimized some assets over there: **Neat**!

After that I digged a bit deeper in performance on the loading. There was this flash of contents that really annoyed me. 
Maybe you see, that there is a video looping in the background (maybe not in Safari because Apple blocks auto-playing videos 🤦). So I had to bridge that time before the background video was loaded. The simple solution was just to take the first frame of the background video as background image. That worked great! 🙂

I also added some `dns-prefetch` tags to improve the loading of external assets:
```HTML
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//www.googletagmanager.com">
```

Overall it was interesting to see how granular, even the smallest website, can be optimized.

If you have any questions, critique, improvements or similar experiences, I'd be glad if you just answer here!

The code of my website is also, for sure:
{% github Crease29/kai.neuwerth.me %}

Thanks for reading this!

Kai
Open Hybrid Cloud Management - Automate your Cloud
Tags: opensource, cloudmanagement, cloudcomputing, openstack
Published: 2018-08-14 10:47:14

---
title: Open Hybrid Cloud Management - Automate your Cloud
published: true
description: VirtEngine is an Open Source Hybrid Cloud Management Platform
tags: Open Source, Cloud Management, Cloud Computing, OpenStack
---

Today, it is common to find users running cloud workloads on AWS, Azure, or services like DigitalOcean.

But the most efficient approach of consuming Cloud Resources is generally through Bare-Metal / Dedicated Servers, this is because you are dedicated a complete Physical Machine for your workloads - which can be extremely dense and handle large amounts of workloads spread across Virtual Machines and Containers.

Having a Cloud Management platform that allows you to import workloads from existing Clouds, and then move them across different infrastructure without interruptions in an automated matter can be extremely helpful.

Another use-case is the automation of application orchestration, & the ability to automate repetitive tasks such as Application Deployments, Scaling, Backups, and more.

[VirtEngine](https://virtengine.com) allows you to manage your existing Cloud Workloads based on popular Infrastructure Providers, and Open Source Tools.

VirtEngine currently integrates with OpenStack, and OpenNebula - but future integrations to ProxMox, and MAAS.io, and Kubernetes are on their way.

VirtEngine also works with tools like SLURM, for batch-processing.

VirtEngine also integrates with public cloud providers such as AWS, Azure, DigitalOcean and an Open Public Cloud Marketplace that is coming soon.

So what exactly does VirtEngine do?

- Organization Management
- Team Management
- Project Management
- Resource Consumption Analytics & Metrics
- Event Logs & Audit Logs
- Access to Infrastructure (Compute & Storage) based on various integrations.
- Billing Management (Under our Licensed Products) 

Virtual Private Cloud Management:

![VirtEngine Virtual Private Clouds](https://i.imgur.com/MtVKBxX.png)

Application Orchestration:

![VirtEngine Application Orchestration](https://i.imgur.com/yI4iEl0.png)

Admin User Interface:

![VirtEngine Admin](https://i.imgur.com/RIBNCoK.png)

If you are interested in deploying VirtEngine-Waldur, please check the following documentation:

[VirtEngine Waldur Documentation](http://virtengine.com/VirtEngine_Waldur_Documentation.pdf)
My Github Graveyard Part 1
Tags: graveyard
Published: 2018-08-14 10:44:00

---
title: My Github Graveyard Part 1
published: true
description: 
tags: graveyard
---
There are plenty of dead projects in my [github](https://github.com/vikkio88?tab=repositories).

Basically I treat side projects like this comic strip
![a](https://thepracticaldev.s3.amazonaws.com/i/jipwln0q7zyvdrise5z5.jpeg)

But I will mention the "best" ones

## <=2016
### DsManager-php
One of my many football manager games (only transfer market focused) but in php and ideally working with multiple users [repo](https://github.com/vikkio88/dsManager-php)

## <=2015
### PyDSMANAGER
One of my many football manager games (only transfer market focused) but in python [repo](https://github.com/vikkio88/pyDsManager)

### MaltaParkCrawler/PaltaMark
angularJs wrapper around a shitty classified website (MaltaPark), used a lot in Malta (I used to live in Malta) [PaltaMark](https://github.com/vikkio88/maltaparkcrawler)
## <=2014
### DSManager
a game project made for fun, a football manager simulator in C# and .NET
[repo](https://github.com/vikkio88/dsmanager)
my first attempt of doing a football manager game only focused on transfer market.
### ScreenshotTaker
self explainatory, and in c#, yuck [https://github.com/vikkio88/screenshottaker](https://github.com/vikkio88/screenshottaker)

## <=2010
### Bascit (was supposed to be bash-it) 
a post-it implementation in bash [repo](https://github.com/vikkio88/Bascit)

### PasswordSecurityChecker
a reverse rainbow table checker that control in a list of sites if your password's hash is present or not. [repo](https://github.com/vikkio88/PasswordSecurityChecker)
in ruby, what the hell was wrong with me?

### Coolibree
[https://github.com/vikkio88/Coolibree](https://github.com/vikkio88/Coolibree)
A php cms using flat files, way before composer and proper OOP, I version controlled it as memento of how shitty I was once (not that now I am the greatest programmer of all time)
It was coming after another attempt, poorly attempt [virublog](https://github.com/vikkio88/virublog).
what is the best music genre to program with?
Published: 2018-08-14 09:31:15

---
title: what is the best music genre to program with?
published: true
description: 
tags: 
---

...And why it is dubstep/drum&bass?

Jokes apart, I am not a mdma type of guy, that goes dancing in clubs and stuff like that, but when I am writing code, for some weird reason I can concentrate better with this kind of music.

Probably because is simple and upbeat, and does not make you think.

what about you?


Just if someone is interested, I do have a small "coding playlist" in [here](https://soundcloud.com/vincenzo-ciaccio/likes).