teleren/devto huggingface dataset:
Use function hooks to modularise control patterns
Published: 2020-04-21 18:40:15

Hi all,

I'm thrilled to announce a new library [@opbi/toolchain](https://github.com/opbi/toolchain) I'm working on under the open-source initiative OPBI.

I have previously created [@financial-times/n-express-monitor](https://github.com/Financial-Times/n-express-monitor) to automate log and metrics behaviour across a large set of micro-services with pluggable decorators. [@opbi/toolchain](https://github.com/opbi/toolchain) aims to take the lessons learnt and lift the project to a new level to have more universal use cases.

The docs should now be relatively straight-forward. If you have any questions, do leave a comment here. And if you feel this can potentially be useful to you, do give the repo a star as your feedback.

Thanks,
Carl
Discord.js Parity is here!
Tags: javascript, npm, discord
Published: 2020-04-21 18:33:04

so, discord.js v12 has been around for quite a short while... and the community ( including me ) are hating the fact that we need to change HUGE amounts of code before v11 is unsupported, so, to combat that code annoyance, i created ``@jonyk56/discord.js-parody``, an npm package that combines the features of v12 with v11, bringing back rich embeds, while keeping message embeds, and *no conflict* collections with the manager properties still available!

Someday this project will be complete, and ready for discord.js v13, possibly the most stable update ever!
How to make your app harder to write
Tags: distributedsystems, kubernetes, docker, devops
Published: 2020-04-21 18:20:28

{% github https://github.com/dapr/dapr %}

> This is the first post in a series about [Dapr](https://github.com/dapr/dapr)

Software is very easy to write. For lots of us programmers, it's really exciting to create something _new_.

Then it grows and changes over time. Like the foundation of a house, it looks indestructible at first, but the earth has forever to try and break it. It moves, causes cracks and eventually water leaks. The same thing happens to software.

>Software is easy to write but hard to get right

## Challenges of distributed systems

Look at any non-trivial, modern app, and you might be able to find 25% of the bugs that it has in it. You'll have no idea about the rest of them, because time and pressure can only find them.

Your app gets twice as hard to get right if it has to talk to other APIs, databases or microservices. Then you'll hit network blips, slow APIs, out-of-memory errors, and so on. In other words, the world will eventually find a way to break your app. You have to find a way to handle all of that.

## Frameworks

That's where distributed frameworks come in. For modern distributed systems, these are sidecar processes/containers that give your app a simple API that helps you deal with these things. 

They help you:

- Save things to a database
    - Even if there's a problem with the database
- Talk to other services
    - Even when you have to try again
- Tell you what services your app is talking to
    - Even when you can't tell from the code
- Responding to events like pub/sub
    - Even when you don't expect that many events

Dapr a new framework that can help with these things. Stay tuned for my next post to learn more!

{% github https://github.com/dapr/dapr %}
Constantly Evolving Code
Tags: architecture, microservices
Published: 2020-04-21 18:38:16

---
title: Constantly Evolving Code
published: true
date: 2020-04-21 18:14:56 UTC
tags: architecture,microservices
canonical_url: https://blog.wick.technology/architecture/constantly-evolving-code/
---

As software engineer it feels so important to write code or microservices in a consistent way. This helps maintainability and understandability as other engineers work on different parts of the system, but is it actually holding back delivery of working features to users?

When a software system is constantly evolving it can feel strange to have inconsistent ways of doing things across the code base. But this is something that will always be the case. Changes come from new frameworks, new tools, updates of existing frameworks and new architectural patterns. It’s common to talk about business change - and that changes in requirements will always happen. However it may be less common to talk about, and be aware of, technical change.

## You should expect the code you write to be replaced

This is my biggest mindset shift: I expect what I write to be replaced. I expect to be in a constant state of “migrating”. I expect new and better implementations or patterns to be found. I expect to never be finished at the “perfect” implementation.

This means when we’re re-architecting, or re-designing, or upgrading from legacy patterns, it’s not a big deal - it’s part of business as usual. It means I don’t hold on too tightly to the code I wrote because better ways of doing things will be found as we understand our customers and the business better.

Also I don’t expect to get to the end of evolving the architecture, I expect it always to be in constant improvement, which means it’s never finished.

## Don’t prioritise creating a consistently designed system

This seems backwards but I believe you should prioritise building something that works first and then if technical changes/improvements come along, you can go back later and change things. When technical changes are needed, don’t spend time going through the whole system trying to upgrade everything at the same time, so the system is completely consistent. This is part of the advantage of component systems like React or microservice architectures - it allows you to evolve flexibly. For example, some React components can continue to use higher order components, as you upgrade just the components which are most used and changed, to hooks.

I’ve learnt to be ok with the fact the whole system will never be completely written in the same way - some services might use one framework, and other services a newer framework, some might follow an old way of design and some a new design system.

It could be easy to never finish anything if we prioritised design consistency, because as things change you need to go back and update all previous services and this work just gets bigger and bigger as the system evolves.

## Conclusion

I’d encourage you to embrace constantly evolving systems, and allow yourself to evolve flexibly and where it’s most needed.
Water Shader Research Issues
Published: 2020-04-21 18:11:06

The largest issue that I came across when trying to create a water shader was the lack of information. I didn't quite know of a sure way to this, but I had a general idea. I searched the internet for some guidance or at least something to work off of. Soon I learned that there was little to no information relevant or current enough for what I was trying to accomplish. All information was either dated, in a different API with little explanation, or stuffed into a complicated architecture that made it seemingly impossible to unravel given the time.

However, though I had not a lot to work off of, I accomplished in finding something useful. I was at my breaking point, I even tried asking for help online, but then I was pulled back to a specific outdated tutorial. I had often been brought back and at this point, I gave in. It was entangled in some overly complicated architecture and only spoke on the reflective and refractive elements to create water. However, I dug deep and made the best out of the scraps I gathered. There may have been a better source of information I had yet to find, but simply couldn't find it.  I simply worked with what I had and it turned out alright.

I was able to create a water shader that created something resembling a calm pond with subtle movement. It relied on my knowledge of 'render to texture' techniques and shader programming. I figured out how to reflect a texture generated from an object in an entirely unseen scene and pass it as the water reflective or refractive texture.

By Moises Carmona
CloudFormation Exports and Imports
Tags: aws, devops
Published: 2020-04-21 18:07:28

---
title: "CloudFormation Exports and Imports"
published: true
description: "Brief introductory example to using Exports and Imports in Cloudformation templates"
tags: aws,devops
canonical_url: "https://thomasstep.com/blog/cloudformation-exports-and-imports"
---
When writing Cloudformation templates, there is a way to reference a common piece of infrastructure without having to pass it in through a parameter or a hard-coded value. That method is Exports and Imports. I have been using these more lately because I think that they clean up my templates, and coming from a programming background, it makes sense to me to import values from other files (in this case stacks) like a variable. Setting an Export is like defining a variable, and using an Import is like calling that variable. If you are Exporting and Importing a piece of infrastructure's name that may change in the future, then that means you will not have to change anything in your template as long as the Exports keep the same names. Unfortunately, before I learned how to use Exports and Imports, I passed in references through Parameters, which did not scale well into different environments.

Here is a quick and dirty snippet as an example of how to use Exports (in vpc-template) and Imports (in another-template).
```yml
vpc-template.yml
Resources:
  myVPC:
    .
    .
    .

Outputs:
  VPC:
    Description: A reference to the created VPC
    Value: !Ref myVPC
    Export:
      Name: accountVPC



another-template.yml
Resources:
  SecurityGroup:
    Properties:
      .
      .
      .
      VpcId:
        Fn::ImportValue:
          accountVPC
```
The [`Outputs`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html) block is at the top level of your template, then comes the logical name of your output, and finally the `Export` with the `Name` of what you want to export. In order to use a reference to `myVPC` in another template you just need to import it using a [Cloudformation intrinsic function called `ImportValue`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html). When I was trying to figure out how to "use variables in Cloudformation templates", this is what I ended up settling in on. I find that using Exports and Imports helps a ton when you need to reference the same piece of common infrastructure in an account across multiple templates.
Final Project - the beginning
Tags: rails, react
Published: 2020-04-21 17:53:53

---
title: Final Project - the beginning
published: true
description: The bridge between coding bootcamp and my professional life as a dev. This project will not be fully complete in 3 weeks but it will be a proof a concept that I can continue to work on after bootcamp.
tags: rails, react
series: Mod 5 Final Project
---

# The End is Near
Well, it's here; the final 3 weeks of my code bootcamp journey. I've made some amazing friendships, crammed a metric ton of information into my - sometimes unwilling - brain; and I am confident that I have what it takes to be a sucessful software engineer.

Over the next 3 weeks I plan on posting micro-blogs of my progress and journey on this final project.

So lets get this blog series started with this little post and I'll have more everyother day (that's my plan as of now at least).

Enjoy the read, ping me with questions or comments as this series continues and stay healthy all :)
Checking out multiple branches at the same time in git and moving files between them
Tags: git, branch, worktree, stash
Published: 2020-04-21 17:52:00

---
title: Checking out multiple branches at the same time in git and moving files between them
published: true
description: in this short post I'll explain how to checkout multiple branches at the same time and move files between them
tags: git, branch, worktree, stash
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/rje86n68k54va1zyd7s6.jpg
---

Imagine that you're working on some branch that is out of sync with `master` and you have already made a lot of changes. All of the sudden you realise that you want to move some of the files to a new branch that will be sourced from `master` (i.e. changes are needed by other members of the team).

## Git Worktrees

To do that, you first need to create a `git` `worktree`:
```shell
git worktree add <folder> master
```

This will basically create a folder with a repository and checkout `master` branch. It also creates a link between the new and the "original" repository folder.

You can use `git worktree list` to list worktrees and `git worktree remove` to remove them. For more information about `git worktree` please refer to the [official documentation](https://git-scm.com/docs/git-worktree).

## Moving files

As mentioned earlier, `git worktree` creates a link between local folders. That means that your stashes are the same between them. So you can just stash interactively necessary hunks with:
```
git stash -p
```

or you can `git add` unwanted changes, and `git stash -k` to stash the unstaged files. 

Now you need to switch to the new worktree with `master` and create a new branch:
```shell
cd <folder>
git checkout -b new_branch
```

and do `git stash apply`. It's better to use `apply` most of the time and not `pop` since if you have some conflicts you can always abort without losing stashed changes.
Friday Night Deploys #19 - Pretty Much Just 35 Minutes Of Us Complaining About Meetings
Tags: podcast, webdev, jokes
Published: 2020-04-21 17:45:15

## Intro
I hope everyone is doing absolutely fantastic; at least as much as you can be during these times. We're still doing this podcast thing every week, although, we're trying to tighten up the length of our episodes to appeal to the lack of commuting happening now. Feel free to let us know if you like the extra focus or if you want to bring back more fluff of our excitingly boring lives! Always thanks to everyone who listens in to the show; you're all rad, hope you enjoy this week's episode!

This week the DevPlebs talk about: Popping this pop! Getting demonetized! Weezer's Blue Album! Grammy award-winning artist Weird Al Yankovic! The movie UHF! The movie BASEketball! How people who like Weird Al's original songs vs his parodies are superior human beings! Meteor.js! Our (probably) one-millionth stream! Avril Lavigne! Lyme disease! Getting canceled and bringing our podcast back for due to audience demand! The terrible comeback seasons of Arrested Development! Bringing your dogs and kids and cats into your meetings! Becoming Tik Tok famous! Phil's insistence on using inside jokes! The Joe Rogan podcast! Reminding Phil what the show Fear Factor was! A new podcast where we review every individual episode of the Big Bang Theory! How problematic How I Met Your Mother is! We continued down spiral in quality! Being naked from the waist down during meetings!

## Listen to The Full Episode!
{% spotify spotify:episode:3BUlROwvQiwsSbKSOhFTR6%}

_or [listen directly on spotify](https://open.spotify.com/episode/3BUlROwvQiwsSbKSOhFTR6)_

**We're also on...**
**Apple Podcasts:** https://podcasts.apple.com/us/podcast/19-pretty-much-just-35-minutes-us-complaining-about/id1485252900?i=1000471875856

**Google Music Podcasts:** https://play.google.com/music/m/Dnvp5ccbc4zdk3kxyw3msk5indm?t=19_Pretty_Much_Just_35_Minutes_Of_Us_Complaining_About_Meetings-Friday_Night_Deploys

**Our Website:** https://www.devplebs.tech/friday-night-deploys/19-pretty-much-just-35-minutes-of-us-complaining-about-meetings/

## Get In Touch With Us!
Are you currently stuck in meeting hell or have been? If you would like to share for us to read out in the next episode you can reach us at the following...

**Twitter:** [@DevPlebs](https://twitter.com/DevPlebs).
**Email:** deadbeats@devplebs.tech

## Follow Our Twitters... If You Want!
[DevPlebs](https://twitter.com/DevPlebs).
[Keith Brewster](https://twitter.com/brewsterbhg).
[Phil Tietjen](https://twitter.com/phizzard).

You can also ask questions or give us some feedback about the show!
Alpas reached the 100 ⭐️ mark on GitHub!
Tags: kotlin, alpas, webdev
Published: 2020-04-21 17:40:53

[Alpas](https://alpas.dev) is an open source, Kotlin-based web framework and being open-source, we spend money with no real expectation of receiving anything back. 

However, 100 stars actually is a threshold for some generous companies that help sponsor and provide support to open source projects, such as covering infrastructure expenses, that we can now apply for. Hopefully, we will get some assistance. But, if we don't, that's not going to stop us from iterating on Alpas as our main goal is to help others create awesome web apps and APIs while enjoying using Kotlin in a simple, straightforward back-end framework. 

Thanks to all of those who helped support us by staring our [GitHub Repro](https://github.com/alpas/alpas) and especially to those who have taken time to look at Alpas, create their own projecting with Alpas, and provided us with valuable feedback! 🙏
Linux shells: interactive/non-interactive, login and non-login
Published: 2020-04-21 17:31:17


Courtesy of **chaos** at Stack Exchange
Link:
https://unix.stackexchange.com/questions/170493/login-non-login-and-interactive-non-interactive-shells



- login shell: A login shell logs you into the system as a specific user, necessary for this is a username and password. When you hit ctrl+alt+F1 to login into a virtual terminal you get after successful login: a login shell (that is interactive). Sourced files:
        /etc/profile and ~/.profile for Bourne compatible shells (and /etc/profile.d/*)
        ~/.bash_profile for bash
        /etc/zprofile and ~/.zprofile for zsh
        /etc/csh.login and ~/.login for 
- non-login shell: A shell that is executed without logging in, necessary for this is a current logged in user. When you open a graphic terminal in gnome it is a non-login (interactive) shell. Sourced files:
        /etc/bashrc and ~/.bashrc for 

- interactive shell: A shell (login or non-login) where you can interactively type or interrupt commands. For example a gnome terminal (non-login) or a virtual terminal (login). In an interactive shell the prompt variable must be set ($PS1). Sourced files:
        /etc/profile and ~/.profile
        /etc/bashrc or /etc/bash.bashrc for 

- non-interactive shell: A (sub)shell that is probably run from an automated process you will see neither input nor output when the calling process don't handle it. That shell is normally a non-login shell, because the calling user has logged in already. A shell running a script is always a non-interactive shell, but the script can emulate an interactive shell by prompting the user to input values. Sourced files:
        /etc/bashrc or /etc/bash.bashrc for bash (but, mostly you see this at the beginning of the script: [ -z "$PS1" ] && return. That means don't do anything if it's a non-interactive shell).
        depending on shell; some of them read the file in the $ENV variable.
Pure CSS Custom Radio Buttons
Tags: css, tutorial, radio, webdev
Published: 2020-04-21 17:26:59

I like CSS, and if there is a way to things with CSS, I'm all about it.

One thing that's been notoriously difficult (and still is in 2020) is  styling web forms.  They behave and look quite differently between web browsers and CSS support for styling isn't great.  As such, in this tutorial we'll be creating, stying, and animating custom radio buttons using a few tricks!

[Subscribe To The Channel!](http://www.youtube.com/FollowAndrew?sub_confirmation=1)

{% youtube BT7FZooiqWw %}
Watch the Video Tutorial on YouTube for a visual explanation!

There are essentially three main tricks to get this to work:

* Hide the default radio buttons completely
* Source the radio button **labels** to be after the **inputs**
* Style the radio labels using before & after css pseudo elements

##Hide The Radios 

There are a couple of ways to do this (each with some with some accessibility issues)

* Position it out of bounds: left: -9999px
* Use display: none
* Use visibility: hidden
* Use opacity: 0

```css
[type="radio"]{
    opacity:0;
}
```

##Inputs After Labels 

This step is important, as it will allow us to use the CSS "+" Adjacent selector to determine clicked stated

```html
<input type="radio" id="vanilla" name="ice-cream" >
<label for="vanilla">Vanilla</label>
```

##Style The Radios 

Technically, we're stying the **labels** as we've hidden the actual radios.  We'll be using:
 * Before & after pseudo elements
 * + Adjacent selector for click
 * :checked (and not()) pseudo selector

```css
[type="radio"] + label{
    position:relative;
    padding-left:30px;
    cursor:pointer;
    display:inline-block;
    color:#666;
    line-height:25px;
}

[type="radio"] + label::before{
    content:"";
    position:absolute;
    left:0;
    top:0;
    width:18px;
    height:18px;
    border-radius: 100%;
    border:2px solid #aaa;
    background:#fff;

}

[type="radio"]:checked + label::after{
    content:"";
    position:absolute;
    left:4px;
    top:4px;
    width:14px;
    height:14px;
    border-radius:100%;
    background:#aaa;
    transform:scale(1);
    opacity:1;
    transition:all .3s ease;
}

[type="radio"]:not(:checked) + label::after{
    content:"";
    position:absolute;
    left:4px;
    top:4px;
    width:14px;
    height:14px;
    border-radius:100%;
    background:#fff;
    transform:scale(0);
    opacity:0;
}
}
```
Linux Test Session: $PATH
Published: 2020-04-21 17:22:05

To know pathname of file or link that is executed in current environment, use **which**

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


## To add a path variable use **export**

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

we can also use . to add the current directory path to the PATH variable
$`export PATH=$PATH:.`

Path variable can both be prepended or appended, and they are separated by **:**

All changes, however, is temporary. These path variables are deleted when the user signs out, or when the shell is closed.

To make this permanent, the export command needs to be executed every time the system boots. This can be done in two distinct ways:

###1.Via existing files:
when we login to the linux system, the login shell looks for five different startup files to process the commands from.

- /etc/profile
(for login shell)
The main and the default startup file
All users execute this file


- $HOME/.bash_profile 
- $HOME/.bash_login
- $HOME/.profile 
(interactive shell doesn't process .profile file)

- $HOME/.bashrc
(for interactive shell)
This is run from one of the other above three files

   When one of the above four files is encountered, it is executed first, while any file after that is ignored!


###2.Via creating a new .sh file

Create a new .sh file inside /etc/profile.d/ with the export command. This file is executed every time /etc/profile is executed. One advantage of adding an environment variable this way is data will not be lost when system is updated. Eg. /etc/profile may be reset during system update.


Finally, execute *source* command to make the changes apparent to the current shell.
Eg.
`source ~/.bash_profile`
`source ~/.bashrc`



Bash shell can be started in three ways:
1. default login shell at login time
2. Interactive shell that is started by spawning a subshell
3. Non-interactive shell to run a script
100daysofcode Flutter
Tags: 100daysofcode, flutter
Published: 2020-04-21 16:55:38

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

Today learn about didChangeDependencies, to place Modalroute arguments, and some practicing
https://github.com/triyono777/100-days-of-code/blob/master/log.md