teleren/devto huggingface dataset:
AssemblyLift: Dev Update & License Change
Tags: webassembly, news, showdev, opensource
Published: 2020-06-19 21:54:29

[AssemblyLift](https://github.com/akkoro/assemblylift) is getting verrrry close to its first 'useable' release! Being unstable, versioning will start at 0.1 according to [semver](https://semver.org/).

Ultimately I wanted to wait until the CLI got to a point where it could be used for 'core' tasks; initialization, building, and deploying. There's an issue up on Github [here](https://github.com/akkoro/assemblylift/issues/14) that gives a more detailed overview of how `asml` will manage your projects.

The CLI bundles and piggy-backs off of [Terraform](https://terraform.io) for managing infrastructure, however it shouldn't be necessary to know any Terraform to use AssemblyLift!

### License Change

I originally published AssemblyLift under the Apache 2.0 license.

In advance of the 0.1 release, I have changed the source license to [The Hippocratic License 2.1](https://firstdonoharm.dev/version/2/1/license.html). This license was created by [Coraline Ehmke](https://where.coraline.codes/), who also authored the Contributor Covenant 'code of conduct' which is now quite popular on Github.

In practical terms, I am skeptical of how much power a license such as this actually has in terms of limiting the use of the code by those who would use it for abuse.

However, I think it's important to draw attention to the fact that software is not politically neutral. Software is written and/or repurposed all the time by people and institutions with less-than-pure intentions. When you build software that (you hope) lets small teams do big things quickly, I believe that comes with a responsibility to ensure that the power you delivered is not weaponized. This is especially true of open-core development, I think, since we are are not able to accomplish this by simply choosing not to sell to a particular individual. It is out in the world for all, from indie dev to corrupt nation-state.

### Feedback

If you're still reading and you have comments on anything I've discussed, I'd love to hear it :)
Jails & VNET a Guide
Tags: freebsd, jail, virtualnetwork, virtualization
Published: 2020-06-19 21:41:30

I was working with jails in FreeBSD and wanted to model the infrastructure using jails and virtual networks. This project led me through a learning journey on how to use vnets and jails. Vnets were useful for jail isolation at the network level.

I ended up writing a guide for anyone that needs it. If you are interested, you can get the guide here:

https://rderik.com/guides/

You can get the guide in different formats:

+ ePub
+ Mobi
+ PDF
+ Plain text

I also include the source code. The plain text is handy when you would like to copy any command in the examples.

The guide is free, but if you would like to support my work, you can pay anything you want. In any case, I hope you find it useful.
How to use the ?. operator in Javascript
Tags: javascript, typescript, tutorial, webdev
Published: 2020-06-19 21:33:55

Because in Javascript objects can be very complex and have unpredictable structures, sometimes is hard to access their properties. There's a real possibility that some nested objects or  properties might not exist so when trying to use them, we run into errors. `Optional chaining`, as a part of `ES2020`, changes and simplifies the way properties are accessed from deep objects structures. It is also available in TypeScript, starting from `version 3.7`.

>*The `optional chaining operator` (?.) permits reading the value of a property located deep within a chain of connected objects without having to expressly validate that each reference in the chain is valid. The `?.` operator functions similarly to the . chaining operator, except that instead of causing an error if a reference is nullish (null or undefined), the expression short-circuits with a return value of undefined. When used with function calls, it returns undefined if the given function does not exist.*

Without the `optional chaining operator`, if we want to check for properties inside a deeply nested object, for example, we would need to first check if every reference exists, otherwise we risk getting into errors. 

```javascript

let person = {
    name: "Ben",
    age: 35,
    bankDetails: {
        IBAN: 781265489634,
        accountNumber: 5689245522221

    }
}

console.log(person.hobbies.fishing); // Uncaught TypeError: Cannot read property 'sum' of undefined

```
We get an error because we are trying to read the `fishing` property on the `hobbies` object but the `person` object has no such nested object inside it. A workaround for this would be to write the code like so, using the `&&` operator: 

```javascript

let person = {
    name: "Ben",
    age: 35,
    bankDetails: {
        IBAN: 781265489634,
        accountNumber: 5689245522221

    }
}

console.log(person && person.hobbies && person.hobbies.fishing); // undefined

```
The property still doesn't exist, but instead of a TypeError exception we not get back "undefined". Adding the `&&` operator makes sure that all properties we're trying to check exist but it seems like a lot of work to always write it and it's hard to read too.

This is how the same code looks like with the `chaining operator`.

```javascript

let person = {
    name: "Ben",
    age: 35,
    bankDetails: {
        IBAN: 781265489634,
        accountNumber: 5689245522221

    }
}

console.log(person?.hobbies?.fishing);// undefined

```
The code looks much shorter and cleaner. The way the `optional chaining operator` works is that it stops the evaluation and returns `undefined` if the part before `?.` is `null` or `undefined`.

**A small warning**: not all browsers support this operator so make sure you don't need to use polyfills to avoid issues. You can check the compatibility [here](https://caniuse.com/#search=optional%20chaining).


*Image source: Startup Stock Photos/ @startup-stock-photos on Pexels*
🇬🇧🕵️ GDPR, can I avoid that giant preference modal?
Tags: help
Published: 2020-06-19 21:19:59

GDPR ruined my initial experience of websites all over the place, mostly the web in the UK, I hate it so much. Can I be compliant without displaying a massive deceptive banner? How do some large companies avoid it? Does local storage count? does indexdb count?

I like giving the user options that's great but not so intrusive. Is it possible?
Should I use In-app purchase or Apple pay?
Tags: ios
Published: 2020-06-19 21:05:33

I am currently developing a social iOS mobile app.
Thinking about adding subscription features to give limited access to the users for the app.

I would like to show the consent sheet looks like Tantan app when the user presses the purchase button.

I have added apple-pay. But the result doesn't look the same.

Is there any way I can do this?
Please help me.

Below is the link of the image I would like to implement.
https://dev-to-uploads.s3.amazonaws.com/i/h0ec1ov3wryy2wzlkfka.PNG
Website powered by dev.to github code base
Tags: github, powered
Published: 2020-06-19 21:03:54

Looking for list of website which is powered by dev.to github open source code base?

Are we having dev.to code base ready for self hosting websites? I can see 2.2K forks are there and 446 contributors on github? There must be some updates on it?

It seems to me that this page https://docs.dev.to/self-hosting/ is outdated. 

Please comments and share your knowledge on this. thanks
#018 .dockerignore
Tags: docker, devops, tutorial
Published: 2020-06-19 20:59:01

# Introduction

this is part 18 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.
***

# Docker ignore
if you use git before (if not I will cover it somewhere in the journey) there is .gitignore file where when you push your files to github he will ignore to push files listed in .gitignore same here for docker.

what we should ignore ? maybe some environments files , cached files , node_modules folder .
and for security reasons , let's say you need to safe some api_key locally or login credentials.

![meme](https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fimg.devrant.com%2Fdevrant%2Frant%2Fr_1483693_8eKeq.jpg)

***

# Download app_018
![app_015](https://dev-to-uploads.s3.amazonaws.com/i/vvdddf48acyxqdwnvfa7.png)

if you follow [part 9](https://dev.to/elkhatibomar/009-dockerfile-113f)

```bash
cd location/DevOpsJourney/
git pull
cd app_018/
```
replace location with where you put the DevOpsJourney

if your new go to [part 9](https://dev.to/elkhatibomar/009-dockerfile-113f) and do same steps will download old lecture files and new one.

***

# lab

![adding a file](https://dev-to-uploads.s3.amazonaws.com/i/iyicl4fyfh09b2cp11xr.png)

if you clone the repo and go to app_018 you should see our login file already there.

let's create our .dockerignore file
i use vim to it , inside folder app_018
```bash
vim .dockerignore
```
![ignore](https://dev-to-uploads.s3.amazonaws.com/i/k11qtm9uaqu1o4f3w0ht.png)

as you see i put .dockerignore and logindata.txt
so when we are going to build he will not copy those to our image that we will build so it's stay locally.
some patterns you may find help full

```
.git
*.json
location/*.txt
```

if your project will be uploaded to git you should ignore the .git folder , usually you not gonna see it because every folder start with . will be hidden in linux you can run

```bash
ls -a
```
to see all the files in directory.

*.json , * mean all so here I am telling him ignore all json files

location/*.txt mean ignore all the txt files inside a folder (location is folder name)

***
# build and see

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

```bash
docker image build -t app_018 .
```
always when you follow me watch out for where i am running my commands , here I am inside ~/Documents/DevOpsJourney/app_018 so to build I need to use . (mean Dockerfile is here in this folder)

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

```bash
docker run --rm --name app_018 -exec -it app_018 sh
ls
```
as we can see the image does not have the logindata.txt inside , cool!
as challange try to not copy Dockerfile also
ReactJS Web App Browser Issue
Tags: react
Published: 2020-06-19 20:47:06

Hello Everyone, 

I have a Reactjs frontend for my application. Some reason when I open the application from a browser from a mobile android Zebra scanner which is the Mobile Chrome, I don't get back my application. The desktop version I have no issues. I also tried to change my user-agent in the Dev Tools and still no issue. Any idea what could be going on? What is the best way to debug this issue?
Rubber Duck Session: Rails Polymorphic Attributes with Karim Talek
Tags: videos, active, post, rails
Published: 2020-11-08 18:23:44

---
title: Rubber Duck Session: Rails Polymorphic Attributes with Karim Talek
published: true
date: 2020-06-19 20:31:21 UTC
tags: Videos,active,post,rails
canonical_url: https://avdi.codes/rubber-duck-session-rails-polymorphic-attributes-with-karim-talek/
---

In this public [Rubber Duck Session](https://avdi.codes/duck/), my pairing partner Karim wanted to move some logic for editing message-display rules from the frontend to the backend. We settled on using JSONB and Rails polymorphic attributes as our implementation strategy.

<iframe width="770" height="434" src="https://www.youtube.com/embed/nVgf-ugbFJA?version=3&amp;rel=1&amp;fs=1&amp;autohide=2&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;wmode=transparent" allowfullscreen="true" style="border:0;"></iframe>
What are good ways to optimize images from Markdown?
Tags: webperf, webdev, discuss, image
Published: 2020-06-19 20:29:07

Especially when you generating images from

- Hotlinking (which probably you shouldn't do)
- Pasting from clipboard

This is an example of such pasting function,

{% gist https://gist.github.com/patarapolw/6a17ce6264b62018bd830903bc9c4337 %}

So, what do you recommend I do?

- Proxy with Cloudinary?
- Make my own proxy server?
- Save image locally, then parse to multiple sizes (probably with [sharp](https://www.npmjs.com/package/sharp))?
  - Are there some guidelines on how to do this?
- Or, just use a headless CMS?
Project Rambles
Published: 2020-06-19 20:27:59

This week I discovered this awesome program called [Chingu](https://www.chingu.io/howitworks)! You join a cohort of other learning coders, and together you make a project. There are three tiers of difficulty, and the fee to join is small.

I'm excited, as it will be a great opportunity to build my portfolio and show employers some experience working with a remote development team.

Anyways, before the cohort starts (mine is slated for 6/29), you have to complete and submit a small solo-project, to show your chops and help make sure you've placed yourself in the right tier. You can submit something you've already made, but I thought it would be a good opportunity to get some practice in, so I decided to make one of their suggested starter projects. I chose the matching game - that classic memory game where you flip cards two at a time to find matches.

It's a pretty simple application, but is still stretching my coding muscles nicely. I decided to use React, since I like it, and the 'cards' seemed to lend themselves to it nicely.


Here's what it looks like so far: ![At the top of the screen is a 'new game' button, a title declaring 'Match 'Em!' and a turn counter. Below that are a few rows of green cards with question marks on them. Three cards are flipped over to show different symbols, two of which match.](https://dev-to-uploads.s3.amazonaws.com/i/v6o471z5b0j499mlzxt0.png)

It still needs work before I'll be satisfied with its appearance, but for now I'm pleased to say it's got basic functionality! 

The components are pretty simple - There is only the main App, then a Board, and inside of that, Game Cards. Once you start building out the functionality, it's surprising how many little details you need to account for.

I have state (through React Hooks - really glad to have learned them!) keeping track of the order of the cards, because they should be shuffled for each new game. State keeping track of which cards are flipped and which cards are matched. State tracking number of turns taken, and state that tells the board when to make cards un-clickable, so that users don't click on more cards while the system is assessing their choices.

For the animation to flip the cards, I decided not to reinvent the wheel and looked up who might have made such a functionality for React already, and indeed was able to find a plug-in pretty easily. I believe it's just called ReactCardFlip. 

I don't have a super concrete or coherent point to make about this project, there isn't, for instance, a super specific and interesting bug I've overcome. Mostly it's been an exercise in keeping my JS/React skills sharp and puzzling out what level will be best to keep different pieces of state in. 

I'm excited to get the final functionality (such as notifications for a win or loss, and maybe a timer) working, and to get it prettied up. I'll be taking the opportunity to learn some more about dynamic sizing. 

But I'm even more excited to start Chingu in a couple weeks!
#017 Docker Data sharing between containers
Tags: docker, devops, tutorial
Published: 2020-06-19 20:14:23

# Introduction

this is part 17 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.

***

# Download app_017
![app_015](https://dev-to-uploads.s3.amazonaws.com/i/vvdddf48acyxqdwnvfa7.png)

if you follow [part 9](https://dev.to/elkhatibomar/009-dockerfile-113f)

```bash
cd location/DevOpsJourney/
git pull
cd app_017/
```
replace location with where you put the DevOpsJourney

if your new go to [part 9](https://dev.to/elkhatibomar/009-dockerfile-113f) and do same steps will download old lecture files and new one.

***

# Dockerfile
In this short tutorial we are going to share data between 2 containers using volume

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

in this app_017 I add something to docker file (only for container1)

```bash
volume ["/app/share"]
```

it's mean we are going to create a volume attached to it while building the image

***

# Building

I am going to build my images

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

```bash
docker image build -t app_017_1 container1/
```

we can notice that he create the volume while building

![image2](https://dev-to-uploads.s3.amazonaws.com/i/g5xz1qdi6viadxhdzkcn.png)
```bash
docker image build -t app_017_2 container2/
```

***

# running containers and share data

![magic is here](https://dev-to-uploads.s3.amazonaws.com/i/n5mvrq09amvxehu8yyzi.png)

on the left 
```bash
docker run --rm --name app_017_1 -exec -it app_017_1 sh
```
we need the --name here because we are going to use it to mention the volume in container2

inside the shell
```bash
echo "Hello i am inside container 1" > share/file.txt
```
echo is an linux also windows program to write some text into a file it goes like
```bash
echo string > location/file.extension
```
then to make sure that my file created
```bash
cat share/file.txt
```
we can see our file successfully created.

let's move to the right split

```bash
docker run --rm --name app_017_2 --volumes-from app_017_1 -exec -it app_017_2 sh
```

it's a long command but we cover all what those mean already in previous lectures what I care for now --volumes-from app_017_1 , app_017_1 is the --name of first container.

inside the shell let's make share that our shared file is here
```bash
ls
cat share/file.txt
```

we can see that we are able to share the files between containers.
Add Hot Reload to React Rails 6
Tags: react, rails, webpacker
Published: 2020-06-19 20:08:53

---
title: Add Hot Reload to React Rails 6
published: true
description: Install A hot reloader to a Rails 6 / React Project
tags: React, Rails, webpacker
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bgk6fha7kcg2nqngp5ru.jpeg
---
[Photo Cred : Moritz Jager](https://unsplash.com/@momo0505)

## Assumptions

- Your running Rails 6
- You have a React Component Entry Point
- You have webpack installed in your Rails Repo

### Install Dependencies:

```ruby
yarn add react-hot-loader
```

### Configure Plugins

`babel.config.js`
```
...
plugins: [
      'react-hot-loader/babel',
]
...
```

### Modify Root Component

`app.js`
```javascript

import React from "react"
import { hot } from 'react-hot-loader'

class App extends React.Component {
  render () {
    return (
      <React.Fragment>
        <Main/>
      </React.Fragment>
    );
  }
}

export default hot(App);

```

## Thats it!

Now we just need to import `hot` into our base/root component and wrap our export in it. 

make sure your running the `rails server -p 3000` and also `./bin/webpack-dev-server` in another window

This is literally all i needed to do to get hot reloading working for my project. 

leave a comment below if you have any issues , and we can try and figure it out!
How do I create a database schema design for followers and followings model?
Tags: database, mongodb, strapi, graphql
Published: 2020-06-19 20:01:54

I am trying to create a twitter like following-followers database schema using strapi with mongodb. I am confused how do I separate the collections and design the schemas. So far I found very less solutions on stackoverflow which is not helping me. Also how the query should look like to fetch or update these data with graphql?
Join a new and diverse community 
Published: 2020-06-19 19:34:56

looking for people in colorado to start up a coding group join through this link  https://join.slack.com/t/coloradocodeclub/shared_invite/zt-fghlz4xc-5fH~YSI9G~dxGhJDO~QPbQ The purpose of this group is for everyone to help out and for individuals learning to code in the colorado area to be able to link up (after COVID is over of course). NO matter if your beginner or pro this is a coding hangout place for all levels of skill. please be respectful and have fun, make jokes and connect with others.
P.S this Club will not turn away anyone even if you are not from Colorado just know that this group is catered to Coloradans. As long as you are respectful of others we would love to have you!!!!
Go - Build URL Query String
Tags: go
Published: 2020-06-19 19:28:46

---
title: Go - Build URL Query String
published: true
description: 
tags: go
//cover_image: https://direct_url_to_image.jpg
---

```go
params := url.Values{
    "keyword": {"some"},
}
reqUrl := "https://yourendpoint.example.com?" + params.Encode()
```

# Reference
https://golang.org/pkg/net/url/#URL.Query
Avoid Request -> Response functions for HTTP Servers
Tags: design
Published: 2020-06-19 19:15:37

Many web frameworks and libraries model themselves around the  premise of a function that maps a request into a response. It initially seems like a good idea - it's simple, intuitive and models HTTP pretty well. However, it has many shortcomings and simply isn't powerful enough to be feasible for a fully-featured HTTP server.

# It doesn't model HTTP well

HTTP isn't just the simple "client sends request server sends response" paradigm we'd like it to be. The server can send as many intermediate bodyless 1XX responses as it likes before sending the final response. And sometimes the server is _required_ to send a 100 Continue before the client can proceed with its request - if the client sets `Expect: 100-continue` in its headers it won't send the body until the server responds with 100.

Some HTTP servers sidestep this issue by simply automatically sending a 100 response whenever it sees an `Expect: 100-continue`. However, this loses out on all the benefit this feature was added for in the first place.

# It doesn't allow for HTTP/2 pushes

HTTP/2 comes with the ability for the server to send the client a response at any time even when they haven't sent a request. This allows the server to "push" data it thinks the client will ask for in the near future, saving the delay of a full request-response round trip. A `Request -> Response` simply doesn't allow this, leading to slower request times and more unnecessary data sent along the connection.

# It is inefficient

This mostly applies to compiled languages but can apply to others too. With `Request -> Response` you are forced to return an response that allocates all of its data, and no extra data, on the heap. However, this prevents many optimizations such as streaming stack-local data directly to the TCP connection and sending a subset of a full allocation, all of which result in a slower server.

# Conclusion

A `Request -> Response` model is certainly the simplest way to write an HTTP server library. But for a fully-featured web server, it just lacks the flexibility needed. The solution is of course to pass in a `Responder` type or have it return a sequence of responses - as long as it's not just `Request -> Response`.
Using Seesaw To Balance
Tags: codenewbie, beginners, codepen
Published: 2020-06-19 18:47:10

It’s a super simple activity and any child can build it.

Materials:

1. Lego Bricks
3. Nuts, Rice, Lentils
2. Creativity

Let your kid build a seesaw like the picture and at the edges you can create two lego baskets. Inside the baskets you can put little items and balance them to see which one is more heavy.

**For the complete lesson you can contact me by email:
antonia.symeonidou@outlook.com