teleren/devto huggingface dataset:
Introducing action-router
Tags: github, node
Published: 2020-05-03 18:00:14

If you’re building a GitHub Action that contains multiple triggers that have slightly different actions, you may find yourself writing code that looks like the following:

```javascript
// We're working with PRs
if (tools.context.event == "pull_request") {
  if (tools.context.payload.action == "opened") {
    // Some logic for opened PRs
    handleOpenedPr(tools)
  }
  if (tools.context.payload.action == "labeled") {
    // Some logic for labelled PRs
    handleLabels(tools)
  }

  handleAnyPrEvent(tools)
}

// But we also want the label functionality to work for issues
if (
  tools.context.event == "issue" &&
  tools.context.payload.action == "labeled"
) {
  handleLabels(tools)
}
```

After I found myself writing code like the above repeatedly, I realised that what my more complex actions were missing was a router. Something to work out what the event type and subtype are and delegate to another method. I ended up building [action-router](https://github.com/mheap/action-router) which allows you to do the following:

```javascript
router(
  {
    "issue.labeled": [handleLabels],
    "pull_request.opened": [handleOpenedPr],
    "pull_request.labeled": [handleLabels],
    pull_request: [handleAnyPrEvent],
  },
  [tools]
)
```

The router expects anything that’s callable, which means that so long as it can be called as a function you can `require` the code, define functions in the same file or even pass anonymous functions directly.

```javascript
router({
  pull_request: [require("./allPr")],
  "pull_request.opened": [handleOpenedPr],
  "pull_request.labeled": [
    tools => {
      tools.github.removeLabel({ owner, repo, name })
    },
  ],
})
```

All of the methods that match the event type and subtype are run concurrently. This means that in the first router example both `handleOpenedPr` and `handleAnyPrEvent` would run together whenever a `pull_request` is opened. The results of these methods are returned as an array of promises, which means you can run the following:

```javascript
const results = await router({
  "issue.labeled": [handleLabels],
})

// Results is an array of results. results[0] will be the return value of `handleLabels`
console.log(results)
```

I’ve used the router in anger on a few actions now and it’s definitely reducing the amount of boilerplate code I’m writing. If you’re interested in giving it a go, installation and usage instructions are available [on GitHub](https://github.com/mheap/action-router)
Create PHP Object from JSON Content
Tags: php, json, popo, jsonparser
Published: 2020-05-03 17:57:29

---
title: Create PHP Object from JSON Content
published: true
description: Fill Plain Old PHP Object with JSON content.
tags: php, json, popo, json-parser
---

Consider that you have `example.json` with the following content:

```json
{
  "firstName": "Temuri",
  "lastName": "Takalandze",
  "active": true,
  "position": {
    "title": "Developer",
    "department": {
      "title": "IT"
    }
  }
}
```

and several POPO classes to represent this JSON data:

`Department.php`

```php
<?php

class Department
{
    /**
     * @var string
     */
    private $title;

    // Getters and Setters here...
}
```

`Position.php`

```php
<?php

class Position
{
    /**
     * @var string
     */
    private $title;

    /**
     * @var \ABGEO\POPO\Example\Department
     */
    private $department;

    // Getters and Setters here...
}
```

`Person.php`

```php
<?php

class Person
{
    /**
     * @var string
     */
    private $firstName;

    /**
     * @var string
     */
    private $lastName;

    /**
     * @var bool
     */
    private $active;

    /**
     * @var \ABGEO\POPO\Example\Position
     */
    private $position;

    // Getters and Setters here...
}
```

Now you want to convert this JSON to POPO with relations. The [ABGEO07/json-to-popo](https://github.com/ABGEO07/json-to-popo) package gives you this ability. Install it using [Composer](https://getcomposer.org/): 
`composer require abgeo/json-to-popo`

Now let's create new `ABGEO\POPO\Composer` object and read `example.json` content:

```php
$composer = new Composer();
$jsonContent = file_get_contents(__DIR__ . '/example.json');
```

Time for magic! Call `composeObject()` with the contents of JSON and the main class, and this will give you POPO:

```php
$resultObject = $composer->composeObject($jsonContent, Person::class);
```

Print `$resultObject`:

```php
var_dump($resultObject);

//class ABGEO\POPO\Example\Person#2 (4) {
//  private $firstName =>
//  string(6) "Temuri"
//  private $lastName =>
//  string(10) "Takalandze"
//  private $active =>
//  bool(true)
//  private $position =>
//  class ABGEO\POPO\Example\Position#4 (2) {
//    private $title =>
//    string(9) "Developer"
//    private $department =>
//    class ABGEO\POPO\Example\Department#7 (1) {
//      private $title =>
//      string(2) "IT"
//    }
//  }
//}
```

- [json-to-popo on GitHub](https://github.com/ABGEO07/json-to-popo)
- [json-to-popo on Packagist](https://packagist.org/packages/abgeo/json-to-popo)
It's has been a year since my first gem was published. What I have learned so far?
Tags: ruby, rails, opensource, github
Published: 2020-05-03 17:48:17

Things happen **fast**! One year ago I was a Junior Developer building a really *small* gem for Ruby on Rails **[sort_n_params](https://github.com/JuannFerrari/sort_n_params)**, my first contribution as a developer to the open source's scene.

##What have I learned since then?


###1.- It's always good to build *things*, no matter how small.
If you have an idea, **build it up**. Ask for help from your colleagues if you're stuck -- it doesn't matter if your idea sounds silly or small, building and finishing things helps us improve our skills.

###2.- Publish and share your work!
The solution you have found may be useful to others, so share it. Maybe someone else will help you improve your solution. **Don't be shy!**

![Image One](https://miro.medium.com/max/638/1*sLTZaWc3aktXcGaC3OjGUw.png)

###3.- An example of what you can do
Maybe you're looking for your first job in the industry, but a lot of interviewers ask you about previous experience. Having your own project published in **Github** or deployed in **Heroku** will help you prove that you already have some experience with coding.

###4.- The importance of testing and continuous integration
Technology is advancing rapidly and it is very possible that our code will change in the near future. Testing our code prevents problems and saves time and setting up a continuous integration service like **[TravisCI](https://travis-ci.org/)** to our repository ensures the proper functioning of our project.

![Image Two](https://upload.wikimedia.org/wikipedia/en/5/55/King-Size_Homer.png)

###5.- It's good to contribute to the Open Source scene
It doesn't matter if you only make a small contribution, it will help you improve and meet a world that is growing every day

###6.- Publishing a gem is really easy
**Don't be scared!** If you want to publish a new gem, there are plenty of tutorials on the web and it doesn't take long to do so.

I hope my experience encourages you to make your own gems and projects. **Let's code!**
If a todo app rated your day, Would you use it?
Tags: discuss, productivity, watercooler
Published: 2020-05-03 17:42:25

### Hey dev community, I'm building yet another todo app!!! 

Staying at home and working from home during the quarrantine has become the new norm now. 

But lately, I am having this small thought of wanting to "measure" the amount of stuff - work wise, blog wise and otherwise, that I get done in a day.  So that I can look back and see how my days turned out to be and whether I put them to good use. 

For the same reason, I have started to work on a **tasklist** app. But is not jist another **tasker** app, is different. 

### Let me explain
I am planning to have a system where I can assign tasks as **small, medium and large**. And, the app would not let me take up more than a certain number of tasks in a day, knowing that it would lead me to failure. 

### Key Feature
A key feature of the app is that, based on the small, medium, large tasks completed on a particular day, the app will **rate your day** on a scale of **7 stars** and I can go back and have a look at all the days and compare them. 

The question is, does this use case sount relevant to you? Or am I the only one?
Build your own open dashboard to keep track of COVID-19
Tags: dashboard, python, covid19, platypush
Published: 2020-07-08 09:39:16

---
title: Build your own open dashboard to keep track of COVID-19
published: true
date: 2020-05-03 17:39:18 UTC
tags: dashboard,python,covid19,platypush
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/1828/1*1WfU6ZFoKLlviRN7drPx-Q.png)](https://towardsdatascience.com/build-your-own-open-dashboard-to-keep-track-of-covid-19-f2b09e817320?source=rss-a6a7a8202c31------2)

We’re living in relatively unprecedented times, as none of those alive today (except the few that were around in 1918) have gone through a…

[Continue reading on Towards Data Science »](https://towardsdatascience.com/build-your-own-open-dashboard-to-keep-track-of-covid-19-f2b09e817320?source=rss-a6a7a8202c31------2)
Awesome Text Animation Effect Tutorial using pure HTML CSS [video format]
Tags: css, beginners, tutorial, html
Published: 2020-05-03 17:15:14

{% youtube 1DWJ65XP-zs %}

In this tutorial, I'll explain how to 

## add Awesome Text Animation Sliding Effect

using pure **HTML CSS (Keyframes, Animation & Transform)** in your website from Scratch. 🔥

By the end of this tutorial, you will have a strong understanding of CSS animations. You'll also be able to add this cool effect to your **portfolio showcasing** your practical skills to potential companies/clients.
Learn the Fundamentals Of Web Dev
Tags: html, css, javascript, beginners
Published: 2020-05-03 17:14:32



Jump Start your Web Dev Career with these two beginner tutorials 

 - Web Development Fundamentals

https://www.youtube.com/watch?v=ppEopMiiOvA&t=1s

In this video, I go over the core fundamentals of web development. HTML, CSS, JS, and deployment. You need no prior knowledge of any code to follow along. 

Links below are related to the video:

Here is a link to VSCode Editor 
https://code.visualstudio.com/download

Here is a link to Netlify Drop 
https://app.netlify.com/drop

 - Separation of Concerns

https://www.youtube.com/watch?v=a1nN6Biwwr8

In this video we are going to learn about how to organize and structure our websites. This video is best watched on a computer or laptop and does require the basics of web development and a text editor. If you need to learn about those check out my last video in the description, on web development fundamentals. 

Here is a link to VSCode Editor 
https://code.visualstudio.com/download

Check me out on the internet
https://ethaneisenhard.com/
https://www.instagram.com/ethan.eisenhard
https://twitter.com/ethaneisenhard
First post 🥴
Tags: firstpost, rantalert
Published: 2020-05-03 17:13:57

---
title:  First post 🥴
published: true
description: A little something about what you can find under this handle name. I don't want to waste your time. Please proceed with caution. 
tags: first post, rant alert
---
# Hello y'all 👋 How you Doin? 😉

> This is a trial post by all means feel free to skip this post. And read something else that is more worth your time... Honestly ☺️

So moving on... 📝

## Welcome to my Dev Log 💃

It is highly likely that you would find logs related to the following domains 
1. **CSS** images and animations cause I am a *CSS hobyist* 🔥
2. Solution to a *competitive programming* question and possibly an analysis on different approaches or languages mostly **Python C and C++** ❄️
3. Simple **HTML / CSS / JS** remake of existing web pages using minimal or no libraries, purely concentrating on how to *Design a webpage* without dependencies 🌈
4. *Data analysis and Interpretation* of simple Kaggle problems using **Python** 📊
5. Simple remake of single level games in **Unity with C#** or **PhaserJS in MEAN stack** 👾
6. A fantasy fiction story if its allowed here 🤔 need to check on that 
6. And some side projects that piqués my interest at any give point in time ⛄

I own a laptop that has Ubuntu installed cause memory, money and security problems 😶

I am a kinda one level up newbie ✨ I do have a CS degree but it's mostly theoretical. I do have a day job but it's not... Well I can't talk about it cause it's a bank job and mostly confidential 🙄 I have made a few apps on my own but nothing functional or original or not googled or even useful for that matter 😅

This Dev Log of mine is purely for personal benefit. I want to develop and design looking at existing models and develop and document best practices that I do learn in these endeavours and word it out so that it stays with me and maybe someone else might benefit too. And plus, I really like the community here and you guys seem friendly and nice when compared to medium which was overwhelming 🙈

IF and when I feel like I accomplished something that I would be proud of to read about in the future there will be a log about it here... Hopefully 😅

📝 **To my future self**: Keep at it 💪 you have gone a long way and you are stronger than you give yourself credit for 🤗 #gambate
Build a Docker container for spring-boot application.
Tags: java, docker, springboot, maven
Published: 2020-05-03 17:12:19

---
title: Build a Docker container for spring-boot application. 
published: true
description: 
tags: java, docker, springboot, maven
---

Reduce a docker image size of spring-boot application by dockerfile multiple-stage.


```
# Create builder stage for build application.
FROM maven:3-openjdk-8 as builder

WORKDIR /app

COPY . /app

# Build maven application
RUN mvn clean package

RUN mv target/*.jar app.jar

# Reduce image size
FROM openjdk:8-jdk-alpine

WORKDIR /app

COPY --from=builder /app/app.jar /app/app.jar

ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","app.jar"]
```
Towards Application Express Principles of Good Practice
Tags: orclapex
Published: 2020-05-03 16:57:44

I recently posted an article "Application Express Principles of Good Practice".

The idea for this format came from my job at the National Association of Independent Schools. NAIS published a series of Principles of Good Practice for different areas of school operations that were extremely popular. To me this was a very compelling idea. Rather than tell schools how to run themselves, they provided a framework for decision making. So rather than tell others how to design and code in APEX, I thought I would offer a framework for decision making.

The principles start with an explanation of their goals. *The principles seek to maximize these qualities: Declarative; Discoverable; Explainable; and Maintainable.* There can be other goals but I chose these as a framework for how to weigh tradeoffs. Each of the 10 principles is rooted in one or more of the four goals. 

The perspective I wrote from comes from years of experience and, more recently, working on a large system that is the accumulation of years of work by several different developers, in succession. It's obvious that each of these developers, including myself, had different ways of building. Most of them, myself included, appear to have optimized for laziness. That is to say, they needed to get the most done in the shortest amount of time.

I think that most developers struggle with producing versus engineering. Time is never on our side which means we aim to keep it simple but often really choose easy.

There are no right or wrong answers, just tradeoffs. I hope the principles help make those tradeoffs more conscious.
Teleogical Programming
Published: 2020-05-03 17:10:57


I would comment an exceptional use of exceptions but probably would not stress over such a decision otherwise.

I try to think about programming concepts in a descriptive rather than a prescriptive fashion.

For example, I prefer "const variables in C permit the type checker to disallow writes and possibly link static constants into read only sections" over "a const variable in C is prescribed for read only purposes."

Compilers do not understand the intent behind variable names and they do not understand the intent behind for loops, goto, exceptions and all the rest of program structure. Compilers do not even understand the intent of the language designer. Compilers only do what they were programmed to do.

Sometimes teleogical thinking is important such as for understanding what uses of an API are supported but I try not to get locked into it.

Being locked into a language or API designer's vision also locks you into their mistakes. Dennis Ritchie is not an authority on the correct or permitted use of for loops. There is no correct or prescribed use of for loops just only what for loops actually do. What classes or any other language construct ought to be used for is a similarly pointless discussion.

I try to see things for what they are not what they ought to be.

Exceptions are not for exceptional conditions. Exceptions are a syntax construct. Teleogical thinking mistakes programming languages for human languages. Describing what a program is intended to do is for comments.
Change query string to allow for multiple values
Tags: html, django
Published: 2020-05-03 17:03:49


Can anyone help with my Stack question? Having a problem with my Django search. I'm using a multi select (Select2) on the front-end and when multiple values are selected it's only the last value that's searched. e.g ?Query=value1&Query=Value2.

The desired result would be Query=value1+Query=Value2 or
 ?Query=value1+Value2. 

Any help appreciated!

{% stackoverflow 61561296 %}
Why I'm focusing on learning Rails
Tags: rails, ruby, productivity
Published: 2020-05-03 17:01:50

I know what you're probably already saying: "Laz, don't spend your mental energy on ON that". But here is my reasons why.

## It's helping me understand the larger, and more heavy frameworks.

Last year, I focused on learning Laravel. And even though the documentation, tutorials, and Stack Overflow answers were very helpful I didn't really get the full grasp of it. The distraction-free code of ruby keeps the core concepts of the large frameworks but allows beginners like me to fully understand them. 

## It's not dead yet
People keep telling me "Lazar, learn something like `{{insert_framework_here}}`, no need to learn Rails". But I tend to disagree. It's not like I am resting my future career on Rails, or that is what I expect to get a job in. But I've asked many developers, "Is ruby on rails dead?" So far the answer is no.

## It's great for prototyping
What I like about rails, is you can write an application in a weekend. 
It's scalable, as any developer will tell you, and due to the number of gems, you can take a prebuilt module approach.

## As you see...
So, it might not be the language that's going to get me into silicon valley, but I think it's something that will help me in my future.

### btw
I also got a twitter account recently! @lazar1134
Optional Chaining & Nullish Coalescing
Tags: javascript, beginners, es2020, es6
Published: 2020-05-03 16:55:45

Take a look at the code below. Does it look familiar?

```javascript
const resident = {
         name: 'John',
          address: {
              city: 'Mombasa',
              town: 'Mishomoroni'
          },
          gender: 'Male' 
 }
```
If we use the `&&` operator to check for a property in the above object:

```javascript
const apartment = resident && resident.address && resident.address.apartment
console.log(apartment) //undefined
```
When one wants to reach an object's property, the go-to method has been the use of `&&` operator. This is to avoid errors when whatever is referenced is nullish ( i.e `null` or `undefined`).

The result would be `undefined` since the property `apartment` does not exist anywhere within the object's 'tree'.

What if we can make the above code clearer and less verbose? Here comes **optional chaining**

![It's Showtime!](https://gifs.ninja/r/the-interview-its-showtime.gif)

#Optional Chaining
In simple terms optional chaining refers to the use of `?.` (question mark followed by a dot) to check the property of a value that may be located deep within a chain of connected objects.

Now let's improve our previous code in checking for the `apartment` property:

```javascript
const apartment = resident?.address?.apartment;
console.log(apartment) //undefined
```

As expected, result would be undefined since the property `apartment` does not exist in the `resident` object.

Let's spice up things a bit with **nullish coalescing**

![Spice it up](https://img.buzzfeed.com/buzzfeed-static/static/2018-07/10/10/asset/buzzfeed-prod-web-05/anigif_sub-buzz-25890-1531233597-2.gif?downsize=600:*&output-format=auto&output-quality=auto)

#Nullish Coalescing
The **nullish coalsecing** operator, `??.`, is a complementary feature for optional chaining. It can be used after optional chaining to give a default result or value when the refrenced property is not found.

```javascript
const apartment = resident?.address?.apartment ??"Apartment not found";
console.log(apartment) //Apartment not found
```
As seen above, the default value is now `Apartment not found` instead of `undefined`.

Optional Chaining & Nullish Coalescing is one of the proposals that have reached stage 4, and are included in the latest draft of the ES2020. Read more about ES2020 [here](https://tc39.es/ecma262/#sec-intro)
ExtendsClass.com - Free Online Toolbox for developers
Tags: programming, python, javascript, php
Published: 2020-05-03 16:49:02

---
title: ExtendsClass.com - Free Online Toolbox for developers
published: true
description: Free Online Toolbox for developers
tags: programming, python, javascript, php
---
I created [ExtendsClass.com](https://extendsclass.com) to ~~help developers~~ pass time. 

This online toolbox includes **Testers** (Regex, XPath, JSONPath), **Random Data Generators** (JSON, CSV, SQL), **API tools** (XSD generator, JSON Storage, MOCK API, REST/SOAP clients), **Comparators** (XML, JSON, CSV), **Formatters** (XML, JSON, HTML, CSS, JS), ...

Some tools are open source, you can retrieve source code [here](https://github.com/cyrilbois).
Reading The Fancy Manual: Documentation in Bash
Tags: discuss, codenewbie
Published: 2020-05-03 16:40:51

Good afternoon quaranteam! I have a Sunday afternoon coffee question:

To read documentation for a command, such as `ls` in Bash in macOS, we use `man ls`, but in Linux we use `ls --help` (or `ls -h`).
Both macOS and Linux are built on Unix, so...

What accounts for this difference in the way we access documentation?
What other subtle differences do you think a beginner should be aware of?
100daysofcode Flutter
Tags: 100daysofcode, flutter
Published: 2020-05-03 16:36:05

day 55/100 of #100daysofcode #Flutter
Learning Flutter , courses Udemy from
@maxedapps

Today learn http.patch , implement try catch,
https://github.com/triyono777/100-days-of-code/blob/master/log.md
Git & GitHub 101
Tags: learningtocode, softwareengineering, programming, softwaredevelopment
Published: 2020-05-13 04:16:50

---
title: Git & GitHub 101
published: true
date: 2020-05-03 15:42:08 UTC
tags: learning-to-code,software-engineering,programming,software-development
canonical_url: https://medium.com/@bryn.bennett/git-github-101-ec7850487e97
---

[![](https://cdn-images-1.medium.com/max/2600/1*-M6Na71eFprGeFRQj5M4ug.jpeg)](https://medium.com/@bryn.bennett/git-github-101-ec7850487e97?source=rss-5676ca6163ee------2)

A total breakdown of the fundamentals of version control and best practices for new software engineers.

[Continue reading on Medium »](https://medium.com/@bryn.bennett/git-github-101-ec7850487e97?source=rss-5676ca6163ee------2)