teleren/devto huggingface dataset:
Daily Developer Jokes - Friday, Jan 31, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-01-31 13:00:12

---
title: "Daily Developer Jokes - Friday, Jan 31, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Friday%2C%20Jan%2031%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259582acfe.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why did the developer have to quit smoking?

___A:___ Because they couldn't afford to pay the new syntax.
 -->
5 useful JavaScript tips
Tags: javascript, tips, beginners
Published: 2020-01-31 12:52:28

---
title: 5 useful JavaScript tips
published: true
description: 
tags: #javascript #tips #beginner 
---

## Copy an array
There are different ways to copy an array
```javascript
//Define a array
const cities = ['New-York', 'Paris', 'Pointe-à-Pitre']

//With slice
const citiesWithSlice = cities.slice(0)
console.log(citiesWithSlice) //['New-York', 'Paris', 'Pointe-à-Pitre']

//With concat
const citiesWithConcat = [].concat(cities)
console.log(citiesWithConcat) //['New-York', 'Paris', 'Pointe-à-Pitre']


//With spread operator
const citiesWithSpread = [...cities]
console.log(citiesWithSpread) //['New-York', 'Paris', 'Pointe-à-Pitre']

```
⚠ this type of copy it's a shallow copy and not a deep copy [see this link](https://www.freecodecamp.org/news/copying-stuff-in-javascript-how-to-differentiate-between-deep-and-shallow-copies-b6d8c1ef09cd/)

## Get object length
```javascript
//Define an object
const user = {
lastname: "Doe",
firstName: "John",
age: 99
}


//Transform the object to array and use the length property to it
const userLength = Object.keys(user).length
console.log(userLength) //3
```

## Ternary expression

Instead of a regular ``if`` statement like 
```javascript
let isLogged = true;
let message;

if (isLogged){
message = "Welcome"
} else {
message = "Sign in"
}

console.log(message) //Welcome
``` 
You can use a simple ternary expression
```javascript
let isLogged = true;
let message = isLogged ? "Welcome" : "Sign in"

console.log(message) //Welcome
```

## Merge multiple objects

In this case we have different objects but we want now to have only one.
let's see 

```javascript

const defaultUser = {
  name : "",
  firstName: "",
  hasHisLicence: false
}

const user = {
  name: "Doe",
  firstName:"John"
}

//With Object.assign
const data = Object.assign(defaultUser, user);
console.log(data) // {name: "Doe",firstName:"John",hasHisLicence: false}


//With spread operator 
const userData = {...defaultUser, ...user}
console.log(UserData) // {name: "Doe",firstName:"John",hasHisLicence: false}

```

## convert to a boolean
This is a magic trick which convert any type to a boolean it's ``!!`` let's see that

```javascript
const arr = []
console.log(arr.length) //0
console.log(!!arr.length) // false
```
lock-your-pc.com: A page made for people that do not lock their PC's
Tags: privacy, satire, fun
Published: 2020-01-31 12:48:10

The last couple of weeks in the office I noticed more and more tardiness when it come to locking PC's.
Since the "shock images" like tubgirl are fun and all you cannot have that being open when customers walk into the office.

With this in mind I created [lock-your-pc.com](https://lock-your-pc.com).

Pop open this page on fullscreen to give tardy people a care.
learning to say no for stack creep
Tags: technology
Published: 2020-01-31 12:35:48

---
title: learning to say no for stack creep
published: true
description: 
tags: technology
---

Programmers love the new stuff. That is a technical term: new stuff.

At any part of your tech stack if there is a new thing and you have a programmer working on it you can almost guarantee he is wanting to update it, change it for something new or completely re-write it.

If you are the architect/business owner/product owner you have to learn to say no to these suggestions. And if you are the programmer you need to curb your own desires and not even make the suggestion.

There is a high cost for technology spread. If you love X and you bring X into our stack. How many other people know X? Can I hire people who know X? What about the bus factor if you are the only person who knows X? Will I immediately want to replace X after you leave?

Older reliable tech is almost always the best choice. And that tech might not even be reliable. Maybe older known tech is the better wording.

There can be a point where you need to switch/upgrade/refactor but it should not be a quick choice.
Designing a Full Website UI using Figma
Tags: beginners, webdev, tutorial, design
Published: 2020-01-31 12:25:29

Figma is a great application for designers.

In this video, I was given a real-world application by a business that needs a website front-end. I decided to design a single page in Figma and go through the thought process each step of the way.

Included in this video: 

* Creating the logo, 
* Creating Website UI section by section
* Using different colours and why they are chosen
* The reasoning behind why the user interface looks a certain way
* Design decisions such as fonts, sizing, shades and more.

{% youtube m0sHva0JjZE%}
pkgreview.dev - The Ratings and Review Website for NPM Packages 🎉
Tags: showdev, npm, javascript, node
Published: 2020-01-31 12:22:46

Hey all! 🙌

I am very thrilled to announce the side-project I have been working on since last week...

I named it **[pkgreview.dev](https://pkgreview.dev)**! The complete product was born out of one tweet.

{% twitter 1218860389833723905 %}

---

# 🎊 `pkgreview.dev`

A lot of people find it very difficult to decide what NPM Package to use.

There comes pkgreview.dev to your rescue!

📦 0.3 Million NPM Packages with GitHub Stats listed!

🎉 Helps analyze NPM Packages

🚨 Write & Read Reviews

⭐️ Star Ratings like _rottentomatoes_!

![React @ pkgreview.dev](https://ph-files.imgix.net/7dc59a54-0d54-4804-8c9d-301482cafb0a?auto=format&auto=compress&codec=mozjpeg&cs=strip&w=582.330383480826&h=380&fit=max&dpr=2)

---

## 🕹 The idea

A lot of people find it very difficult to decide what NPM Package, React Component, Module or Library to use.

**They end up checking on GitHub** to see how active the community is. GitHub does not tell you a clear picture. It is just a part of the picture.

**What people often miss**, is the first-hand experience of the users who have used the library.

`pkgreview.dev` displays all sorts of important metadata of a package (_reviews, ratings, last updated, stargazers, etc._) and also shows `other developers' opinion` about them.

And you can **contribute by posting your review** about the NPM Package. 🎉

## 🔥 Building a Community

The app that you are currently seeing is in its MVP phase.

**To be useful to the masses, we need more reviews.** You, as a developer, can contribute a lot in this process by just posting a review to any useful package.

This project needs the support of the **JavaScript Community**.

**[Login with GitHub (takes two seconds) and write your first review!](https://pkgreview.dev/npm/react)**

---

**This is my first fast-shipped side project. Please do give me feedback on it! 🙌** This is just a start.

## In my Todolist

- Add support for other package managers like PHP Composer, Docker Hub for Images, PIP for Python, and much more!

- Give maintainers of the package special permissions like replying to the review or reporting it.

- Use AI for creating reviews by reading about the package on the web (eg. GitHub issues, Blogposts, etc.)

- Make UI better and less gimmicky.

I will be able to achieve the goals in the todo list only by your support. 

I love positive as well as critical feedback 🙌

---

### About me

I am Kumar Abhirup, a 16-year-old JavaScript React developer from India who keeps learning a new thing every single day.

[Connect with me on Twitter 🐦](https://twitter.com/kumar_abhirup)
[My personal website and portfolio 🖥️](https://kumar.now.sh)

_Comment below your better ways, and suggestions to improve this product. :)_
[PT-BR] Usando o Notepad++ para montar queries
Tags: dba, database, notepad, infra
Published: 2020-01-31 12:02:38

Essa semana foi a mais corrida que tive em toda minha vida: ajustes, inserção e importação de dados, mas com isso saiu uma coisa boa: a ideia de um artigo para vocês, hehehe.

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

##**Mais sobre o Notepad++**##

Notepad++ é um editor de texto e de código fonte. São várias as linguagens de programação suportada por ele e além disso, podemos definir nossas próprias linguagens usando um "sistema de definição de linguagem" integrado.

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

Além de muito mais outras coisas que ele pode fazer, mas o foco desse artigo é como eu uso ele para montar minhas queries de inserção.

Para Windows, pode estar fazendo o download [aqui] (https://notepad-plus-plus.org/downloads/). E no Linux, tem um app parecido com ele, pode fazer o download [aqui] (https://notepadqq.com/s/).

##**Montando a Query**##

Quando vamos fazer uma grande inserção de dados em um sistema, pensamos na maneira mais fácil e rápida de fazer isso. Na maioria das vezes são muitos dados que precisam ser repetidos. Para facilitar isso, podemos usar o comando *alt+shift* e usar as setas para selecionar o que deve ser substituído ou adicionar vírgula ou algo do tipo. 

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

Não posso deixar de falar da sugestão de comandos, que auxilia bastante.

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

E como esperado, possui o tema dark. *Configurações > Configurador de Estilos* e selecione o tema desejado.

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

É uma dica boba, mas imagino que possa ajudar bastante gente. Até a próxima!
🍏 Easy hands-on starter codelab for 
Firebase Cloud firestore!
Tags: firebase, firestore, es6, javascript
Published: 2020-01-31 11:59:44

In this codelab, we're going to learn how to add Firebase to your web app and serve content from the Firebase Cloud Firestore database and make your Web App work offline as well. Cloud Firestore is magical and good for **PWAs** because of its offline capability! 

 ⚽️ Setting up cloud firestore

 ⚽️ ES6 Modules

 ⚽️ Progressive Web App

Codelab url : [https://pwafire.org/developer/codelabs/cloud-firestore-for-web/](https://pwafire.org/developer/codelabs/cloud-firestore-for-web/)
So interesting that I would like to share:
Tags: career
Published: 2020-01-31 11:59:40

It is an article from last year which explains the reasons developers often dislike coding tests. It gave me quite a thoughtful moments.
-><a href="https://www.qualified.io/blog/posts/why-developers-hate-coding-skills-tests">"Why Some Developers Hate Coding Skills Tests."</a> By Geoff Roberts.
Learn How to Use Soft Delete in Laravel 6
Tags: laravel, softdelete, restore, forcedelete
Published: 2020-01-31 11:49:13

In this tutorial i am going to discuss about soft delete in laravel 6. I Will also show you how can we restore our deleted data and can again show it in browser. 

When models are soft deleted, they are not actually removed from your database. Instead, a deleted_at attribute is set on the model and inserted into the database. If a model has a non-null deleted_at value, the model has been soft deleted.

https://www.codechief.org/article/learn-how-to-use-soft-delete-in-laravel-6
A Git from the Future (Comic)
Tags: git, beginners, comics, illustrated
Published: 2020-01-31 11:48:56

---
title: A Git from the Future (Comic)
published: true
description: When working with Git, we often clone existing projects, since this is part of a typical collaboration workflow. What if we want to bootstrap a whole new project of our own?
series: Git Illustrated
tags: git, beginners, comics, illustrated
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/pvb1vbr5k5tirzqxhlp2.jpg
---

So far, we've talked about:

* [Handling File Changes with Commit and Push](https://dev.to/erikaheidi/stage-commit-push-a-git-story-comic-a37)
* [Working with Branches](https://dev.to/erikaheidi/understanding-git-branches-illustrated-ggh)
* [Rewriting Git History with Interactive Rebase](https://dev.to/erikaheidi/pick-squash-drop-rebase-comic-607)

But we haven't talked yet about how Git projects start. When working with Git, we often clone existing projects, since this is part of a typical collaboration workflow. What if we want to bootstrap a whole new project of our own?

In this last comic of the Illustrated Git series, we'll have a recap of previous concepts and commands in a new project workflow using `git init`:

![A Git from the Future comic](https://dev-to-uploads.s3.amazonaws.com/i/0gkmrab7ck790wqyhx68.jpg)

A `git init` will initialize a new Git project in the current folder. A `.git` folder will be created, holding important information about your project's files.

Because you just created a new project instead of cloning an existing one from a remote source, your upstream is still unknown to Git. You'll need to manually set it with a command such as:

```
git remote add upstream https://github.com/USER/PROJECTNAME.git
```

Once the remote upstream is set, you can push your commits to your remote Git repository.

I hope you enjoyed this illustrated Git series!

Do you have a suggestion for a new illustrated series? Share in the comments!
[k8s] Life cycle of volumes
Tags: kubernetes
Published: 2020-01-31 11:45:56


So many types of volumes supported in k8s, when learning the volume concept of k8s, they made me confused, how to choose correct one.

[Types of Volumes in k8s](https://kubernetes.io/docs/concepts/storage/volumes/#types-of-volumes)

Let's try to make it easier by understanding the life cycle of different volumes.

We can sort different types into 3 kinds of life cycle
* life cycle follows Pod
* life cycle follows Node
* Independent life cycle

## Life cycle follows Pod
![emptyDir](https://dev-to-uploads.s3.amazonaws.com/i/fawqu2z6zatxedw8huyy.jpg)
This kind of volume will be created when Pod is up. Wenn pod destroyed, of course the volume is removed. One example is emptyDir. Some use cases are to share files or information between container.


## Life cycle follows Node
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/c6evmxw9k2uqpjbvg8g9.png)
hostPath is the typical example. It mounts a file or directory from host node into pod. When pods are destroyed, it will remain. But if node is unhealth, the volume is down as well.  Use cases like using daemonset to load log files from other pods or sharing configuration files cross pods on the same node.


## Independent Life cycle
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x5n82ttcrkhol1ixycwy.png)
For the last kind of volume, we need to consider which infrastructure we use, because the actual storage is independent from k8s cluster. It means, when node or cluster is done, the data is still persisted in actual storage. If you have any data to persist, please choose this based on your infrastructure, for example, database.

#### pv and pvc
There're two ways to use this. One is refer to persistent volume(pv) directly, and another is to use persistent volume claim(pvc) to bind with persistent volume.

Why do we need pvc? Because pvc provides loose couple between persistent volume and pod. The developer and architect don't need to consider the concrete infrastructure too early. For more details, please see the document of k8s.

## How to choose 
- persistent data?
- share data cross containers, pods, or nodes?
- which infrastructure your product used ex: AWS/Azure/GCP/on-premise


## Final
Hope this article could help someone who is also confused with k8s volume. If any mistake or discussion, please feel free to leave your comment.
Dapps in India
Tags: blockchain, india, blockstack, apps
Published: 2020-01-31 11:32:58

The dapp space is growing fast in India and amongst the newer breed of developers, everyone wants to have a foot in this space as they feel this is the one for the future. Many ecosystems have been coming up in india. It can be ethereum, eos or blockstack which we are going to cover today. Developers have been contributing significantly to the growth of these ecosystems in various forms. Dapp developers are one such category who are contributing to this growing space. 

Some of the developers that are working in the Blockstack ecosystem are developing cool apps like [Visual Bookmarks app] (https://visualbookmarks.online/) which helps your bookmark  
pages you find useful, interesting or inspiring, in a beautiful, visual and fully searchable personal library. [Inner Peace app] ( https://theinnerpeace.me/) is a gratitude journal built on blockstack.  [Pden app] (https://pden.xyz/) is a decentralized social media.[My Feelings app] (https://myfeelings.live/) is a decentralized mood tracker.  All these apps are trying to find user traction before growing further and emerge as business models. They are in early stages of their development.
How to Build a Custom WordPress Theme from Scratch
Published: 2020-01-31 11:21:12

There are around 12 core files. Here is Overview of the main files you will be working with:
• Header.php – Contains everything you’d want to appear at the top of your site.
• Index.php – The core file that load your theme, also act as the homepage.
• Functions.php – A file that can be used to configure the wordpress core,
Without editing core files.
• Sidebar.php – Contains everything you’d want to appear in sidebar.
• Footer.php – Contains everything you’d want to appear at the bottom of your site.
• Archive.php – The template file used when viewing categories, dates, posts by author,etc.
• Single.php – The template file used when viewing the individual post.
• Comments.php – Called at the bottom of single.php file to enable the comments section.
• Page.php – Similar to single.php
• Search.php – The template file used to search display search results.
• 404.php – The template file that display when a 404 error occurs.
• Style.css – All the styling goes here.

Each of these files contains series of php template tag. By using these tags we can insert dynamic content.

• Configuring the stylesheet
All the details of a WordPress theme are contained within the stylesheet. At the top of your style.css add the following code.


index.php
Open the index.php, add this piece of code and save the file:

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


The index-file now contains the code that calls to the header, sidebar and footer template files

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


header.php
Open the header.php, add this piece of code and save the file:

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


footer.php
Open the footer.php, add this piece of code and save the file:

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


sidebar.php
Open the sidebar.php, add this piece of code and save the file:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6i4qqzu3jqryxxep2hnd.png)
Keep moving forward!
Tags: motivation
Published: 2020-01-31 11:13:01


> Once a man told me:
> Give me $100, and I will thank you.
> Teach me how to earn $100, and I will be your friend.
> Share your success with me, and I will support you forever.
> So, share your success with your friends to get their support and spread your knowledge everywhere.


Support plays a great role in our social lives. It can be a support of any kind: you can share your knowledge, you can teach people, you can take part in someone's life.

The number of ways you can support others is innumerable.

I'm living in a world of IT, and I can share about how you can support others:
- You can contribute to the OSS projects. Each contribution matters.
- You can share your insights, productivity hacks, newly obtained knowledge.
- You can make your project an OSS. Thus, you will help others to save their time.
- You can blog about new features, frameworks, libraries, approaches, etc. Spreading the knowledge will help you to solidify your skills.
- You can become an advocate in your area of expertise.
- You can help by promoting tools/projects which you like and use daily.
- You can run a podcast, stream your knowledge using a platform of your choice.
- You can create/edit documentation for OSS projects. This work is very important and done very poor often.

Moreover, any of the listed types of support will be to your benefit. By supporting others, you will create your portfolio and your legacy that will help you to get a job or to start your project!

In the age of the remote revolution, your online profile is one of the best assets you can create.

And that is awesome! You will achieve these goals by keeping your online profile outstanding and crisp:
- You will obtain new knowledge. The more you know, the more freedom you have.
- You will meet new people. You never know who of your peers can boost your career.
- You can earn by supporting others. An explosive combination: learn and earn!
- You will build the world you want to live in. "There's no fate but what we make" (c) The Terminator.

I hope that this post will help people to keep their heads up high and keep on going to their dreams, goals, whatever.

Who knows? Maybe your dream is also a dream of someone else. And by turning dreams into reality, you will support other people as well!

Thank you!

<a href="https://www.buymeacoffee.com/peacefullatom" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
Would you like to know "Who is hosting" this site? [developer friendly tool]
Tags: productivity, showdev, discuss, webdev
Published: 2020-01-31 11:12:07

We have built an interesting tool to spy competitor's website hosting:

https://hostingpill.com/site-hosting-spy/

100% FREE tool for Site Owners. All you need to enter is the Website address. 

Use this tool today and stay ahead of your competition!

If you have any questions related to this tool ask me here...