teleren/devto huggingface dataset:
DOCKER+DENO episode 2: Containerize a Deno FULL REST API from Traversymedia Deno Crash course
Tags: deno, api, docker, 100daysofcode
Published: 2020-05-23 19:39:47

To follow Please check the Deno crash course by Traversymedia
https://www.youtube.com/watch?v=NHHhiqwcfRM

Deno is the buzzword of the moment, and we still don't know how it will end. 

Honestly, I am a fan of node, but I was intrigued, after following the Deno Crash Course, by Traversymedia I tried to containerize it with docker.

Warning!
this example is based on this docker image https://hub.docker.com/r/hayd/deno

Which is not an official deno repository

Github Repository: https://github.com/FrancescoXX/deno-docker-api

# JUST TEST
```
docker run -it --init -p 8000:8000 --init francescoxx/deno-docker:0.0.2
```

# Short version

you can just clone the repository
```
git clone https://github.com/FrancescoXX/deno-docker-api
```
navigate to the folder where the docker-compose.yml is located, and run
```
docker-compose up --build
```
Done!
___

# Long version

If you want to follow along, and you use Visual Studio Code, I suggest you install this extension:

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

## Step 1
Follow the traversymedia Deno Crash course
https://www.youtube.com/watch?v=NHHhiqwcfRM

___
## Step 2
then, we create a very simple Dockerfile, using the hayd/alpine-deno:1.0.0 image
```dockerfile
FROM hayd/alpine-deno:1.0.0

EXPOSE 8000

WORKDIR /app

USER deno

COPY . .

CMD ["run", "--allow-net", "server.ts"]
```
___
## STEP 3

And last, we create a very simple docker-compose.yml file, which is no needed for now, but it could be useful in the future, for example, if we start using a database or some other services

We define port 8000 as both inner and outer one and a default network
```yaml
version: "3.7"

services:
  deno:
    image: "deno-docker:0.0.2"
    build: .
    ports:
      - "8000:8000"
    networks: 
      - deno
    
networks:
  deno: {}
```
from the folder where the docker-compose.yml file is located, we build the image:
```
docker-compose build
```

And finally, we can launch the service with this command
```
docker-compose up deno
```

visit localhost:8000 from a browser

Traversymedia Deno Crash course:

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

Github Repository: Github Repository: https://github.com/FrancescoXX/deno-docker-api

Final note: this doesn't seem that useful, as we are just simply containerizing a deno rest api. 
Things will get interesting on the database part :)
Ways social media is changing us and society

Tags: socialmedia
Published: 2020-05-23 19:39:44

Social media has had a profound impact on how we work and live. It ha</a>s made our lives fully <a href="https://blog.sellfy.com/sell-digital-downloads-wordpress-plugins/">digital</a>.

Across brands and industries social media is quickly turning into a core component of a business’s strategy.

<a href="https://planable.io/blog/free-social-media-management-tools/">Social media</a> is completely disrupting the way people consume content. As such social media skills are a key part of a successful resume and a key responsibility in a media outlet. If you want to know what to post, ask your audience for feedback with a <a href="https://paperform.co/">form builder tool</a>.

Social media turns and impacts how the organization runs.

If you’re not sure about the perceptions of your brand create a quiz on social media and decipher changing perceptions around your brand. Social media is a great place to share content and <a href="https://leviolmstead.com/link-building/">get links</a>.

Social media platforms may be the banks of the future

<b>Social media dons new hats</b>
Social media can help you pay off your rent and make investments as well. Social media is changing banking relationships. It’s quickly becoming a core spot for customer service allowing people to send and receive money via online ways

Also social media is quickly leading people to lead double lives. Self- centeredness and the need to be loved and liked by a bunch of social media friends lead people to live lives where their self esteems are part of what others think of you. They tend to show off their <a href="https://2ndkitchen.com/apartments/free-property-management-software/">houses</a> and lives.

If not careful internet being the cruel and uncaring place it is can come back and haunt you for your deeds.

<b>Risks with social media</b>
There are things like identity theft, stalking and others that keep harming others. Companies before hiring someone always run background checks and your past should not be left untouched to come back and haunt you.

Another place where social media is changing us for better or worse is how we communicate with others. Social media channels were heralded as channels of growth where you could simply talk to other people and eliminate the need for phones, emails and clunky letter-sending.

Social media changed communication but more so as a place where we project our real or fake identities and much less a place where we really connect with the other person.

So it changed communication but just not the way we imagined it to change our lives.

Social media is also doubling up as a place to show your resume.

If you have skills, show don’t tell. Social media is the single most place where you can showcase your expertise by showing what you can do. How well you manage your pages is testimony to your digital marketing skills.
Arrow Functions
Tags: javascript, webdev, react, reactnative
Published: 2020-05-23 19:39:01

![Alt text of image](https://miro.medium.com/proxy/1*3BK_UMTK8T2GGnrt4nKhxA.png)

In this article, we will see how to use another important feature of JavaScript which is Arrow Functions.
#Regular Function Syntax
{% gist https://gist.github.com/mbilgil/a787a482450dd351fe1a2e9cbc09e1a3.js %}

#Arrow Function Syntax

{% gist https://gist.github.com/mbilgil/2e510eb718c4394ef2f192de591a4a3e.js %}

#Difference Between Regular Function and Arrow Function

The value of this keyword inside Regular function depends on how that function was called (The object that made a call)


The value of this keyword inside Arrow function depends on where the function was defined (the scope that defined the function)


Regular Function gives access to its ‘calling‘ environment.


Arrow Function gives access to its ‘defining‘ environment.


Let’s understand this with an example;

{% gist https://gist.github.com/mbilgil/28d3345eca5152df70da031865397e8e.js %}

We have defined two functions inside the const variable CallerObj. First one (func1) is Regular function and Second (func2) is Arrow function.


When you call both functions and see results in the console window of browser you see that func1’s this keyword value is associated with the calling object (CallerObj).


and, func2’s this keyword value is associated with the window object.


So, the conclusion is that in the Arrow function value of this doesn’t decide on who is calling it. It is decided at the time of definition of this.


Here are the results of the above code;
![Alt text of image](https://www.tutorialfunda.com/wp-content/uploads/2019/10/Arrow-Functions-in-JavaScript.png)

#Single Line Function

An arrow function is useful where a function has a single line of code. For example, a function is returning some value.


Let’s look at examples,


1-Below is the Arrow function which returns multiplication values.
2-You can write this function in one line.
{% gist https://gist.github.com/mbilgil/4ce43164f3dfec6619fcee76855871a3.js %}

Example of map function which takes arrow function as a parameter.

{% gist https://gist.github.com/mbilgil/8e38933450969e809d87c386180d9646.js %}

There are several other uses of arrow functions but for learning React above points mentioned about Arrow functions are enough. If you want to go deeper then you can learn [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) more about them.
BLAKE3 Go Libraries simple comparison
Tags: go, blake
Published: 2020-05-23 19:34:03

Official Go Library for BLAKE3 is [not available at the time of this post](https://github.com/golang/go/issues/36632).

**But, we have two alternative:**
[github.com/lukechampine/blake3](https://github.com/lukechampine/blake3)
_A pure Go implementation of the BLAKE3 cryptographic hash function_


[github.com/zeebo/blake3](https://github.com/zeebo/blake3) 
_Pure Go implementation of BLAKE3 with AVX2 and SSE4.1 acceleration_

CPU used: intel i7-8550U

Simple benchmark code
```go
package main

import (
	"bytes"
	"encoding/hex"
	"fmt"
	"testing"

	zeeboBLAKE3 "github.com/zeebo/blake3"
	lukechampineBLAKE3 "lukechampine.com/blake3"
)

var longBytes = bytes.Repeat([]byte("A"), 1000000)

func benchmarkLukechampine(b *testing.B) {
	for i := 0; i < b.N; i++ {
		hasher := lukechampineBLAKE3.New(32, nil)
		hasher.Write([]byte(longBytes))
		hex.EncodeToString(hasher.Sum(nil))
	}
}
func benchmarkZeebo(b *testing.B) {
	for i := 0; i < b.N; i++ {
		hasher := zeeboBLAKE3.New()
		hasher.Write([]byte(longBytes))
		hex.EncodeToString(hasher.Sum(nil))
	}
}

func main() {
	fmt.Println("lukechampine 1st test:", testing.Benchmark(benchmarkLukechampine))
	fmt.Println("zeebo 1st test:", testing.Benchmark(benchmarkZeebo))
	fmt.Println("lukechampine 2nd test:", testing.Benchmark(benchmarkLukechampine))
	fmt.Println("zeebo 2nd test:", testing.Benchmark(benchmarkZeebo))
}

```

The result
```
lukechampine 1st test:      577	   2171834 ns/op
zeebo 1st test:     4146	    302500 ns/op
lukechampine 2nd test:      532	   2282167 ns/op
zeebo 2nd test:     3448	    331177 ns/op
```

Performance wise, the **zeebo** lib is faster. This benchmark is still limited since other resources not taken into consideration. If you guys want to try [BLAKE3 hasher online](https://toolkitbay.com/tkb/tool/BLAKE3) or [generate fancy text](https://toolkitbay.com/tkb/tool/unicode-text-converter). Thank you.
My first open-source project: The Messaging Mediator
Tags: opensource, php, ddd
Published: 2020-05-23 19:22:52

Hello fellow coders,

I want to show you my first open-source project. It is a relatively small library for PHP that enables you to model a more beautiful domain model using DDD practices.

## What it does

> The messaging mediator hooks into your message bus, giving you the ability to yield messages from your application and domain layer, including message handlers, aggregates, value objects, domain services, etc.
>
> Publish domain events, dispatch commands and issue queries and get their results without any dependency to your message bus.

Look at the repository's `README` file to see how you can use it (section "Use Cases")

{% github coajaxial/messaging-mediator %}

If you have any questions about my project, please feel free to ask them here!
Physiotherapy Web Application #githubsdp
Tags: octograd2020
Published: 2020-05-23 19:13:17

## My Project
- Engaging Landing Pages
- Friction-less On-boarding Process
- Dynamic tables to view clients
- Ability to create new exercises
- Ability to create new feedback forms
- Appointments that open in Skype
- Payments through PayPal

## Link to Code
- Unfortunately this was built for a real client so I can't show the code. Here is the PowerPoint presentation:

## How I built it
- ember
- nodejs
- mongdDB


## Additional Thoughts / Feelings / Stories
- We had some issues unpacking objects with Ember. Most of the team had Angular experience though so it was nice to learn more about another framework.
CLI Backups
Published: 2020-05-23 19:12:54

I’m curious to know if anyone currently saves their shell configuration in a way that makes it easier to import to a new machine instead of having to rebuild it all over again. 

The thought I have is to convert my configurations to git repos. Such as...

`~/.zshrc`
`~/.vimrc`
`~/.oh-my-zsh`
And an export of `brew list`
51: The New Mathematics
Published: 2020-05-23 19:10:56

I have been discovering the true needs of studying mathematics, How? and Why?



--- 

#HOW
I started to study programming one year ago, had been taking time to get over one year, so, now, I became slowly understanding everything mathematically. I accepted the reality, to be more functional, to achieve my goal, I realized that there needs to face problems on my own and create my words with numbers, logic, and references.

---
##WHY
Math focus on solving problems only, I want to tell about the process, and how it goes on my programming.

Math requires the right reasons to solve problems, mathematical thinking is organizing the steps for one problem. So I expect myself to think like a programmer.

By studying fundamental mathematics, I want to understand all of the reasons how I approached studying software engineering, I want to start over my roadmap with evident proofs, glad that I can express my opinion towards mathematics.

---
###To set the limitation
I would challenge next for 100 days, to build the new routine, and adjust the new environment, with the source of discrete mathematics.
CENTRALIZAÇÃO DE LOGS DO KUBERNETES COM GRAYLOG + FLUENTD
Tags: graylog, fluentd, kubernetes
Published: 2020-05-23 19:07:58

Neste tutorial será mostrado como centralizar os logs do Kubernetes com Graylog + Fluentd.

Existem outras maneiras talvez mais elegantes, mas optamos em enviar os logs (stdout/stderr) dos pods para o Graylog utilizando o [fluentd-kubernetes-daemonset](https://github.com/fluent/fluentd-kubernetes-daemonset). 
O fluentd(daemonset) irá utilizar as configurações passadas pelo configmap.

Repositório com os arquivos no [github] (https://github.com/aloisiobilck/graylog.git)  


### Documentação oficial

- [Graylog](https://docs.graylog.org/en/3.2/index.html#)
- [Fluentd](https://www.fluentd.org/) 
- [Kubernetes](https://kubernetes.io/)

### Versões utilizadas
- Graylog >= 3.1 
- fluentd >= 1.10 

## Use sua configuração

Disponibilizamos dois manifestos de configmap.

- fluent-configmap.yaml: Responsável pelo arquivo de configuração do fluent.conf
- fluent-kubernetes-configmap.yaml: Responsável pelo arquivo de configuração do kubernetes.conf


Exemplo de como criar um configmap usando como base um arquivo.
```bash 
kubectl create configmap fluent-kubernetes-configmap --from-file=kubernetes.conf --namespace=kube-system

kubectl create configmap fluent-configmap --from-file=fluent.conf --namespace=kube-system
```


## Uso   

1. Execute os manifestos do configmap. 
```bash
kubectl create -f fluent-kubernetes-configmap.yaml -f fluent-configmap.yaml
```
2. Execute o manifesto do rbac.  
```bash
kubectl create -f rbac.yaml
```
3. Execute o manifesto do daemonset 
```bash 
kubectl create -f fluent-daemonset.yaml
```


## Graylog

1. Configure um input gelf. (Protocolo (TCP/UDP) e porta de sua escolha)
2. No Input gelf criado anteriormente, vá em Manager Extractors
  ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1dp0jqp0tagnq2zic8s7.png)
3. Adicione um extractor
  ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2qeq0vtn24u04r6rr75k.png)
4. Load a mensagem e crie um json. 
  ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rjzjjhkhw2fmdtf3l290.png)
5. Caso não queira realizar os passos anteriores (1-4) manualmente, disponibilizamos um content-pack na pasta `./files/` para criação do input+extractors. [Repositório no github](https://github.com/aloisiobilck/graylog.git). Necessário apenas importar o content pack e instalar!
6. Exemplo de mensagem 
  ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7w0o7tosok2tfufx7b14.jpg)
How to decide which program language to learn first
Tags: codenewbie, career
Published: 2020-05-23 19:04:48

This article was first published on my blog
“How to decide which program language to learn first” by pandaquests https://link.medium.com/UErj0gAyy6

Deciding which programming language to learn first can be very difficult in the beginning. Among all the languages, framework, and ecosystem that exists today, it’s not an easy choice. Here are three easy steps of how you can systematically decide which language is best to learn first for you.

#1. Find out the WHY first

So why do you want to learn how to program? Do you do it just for fun or is it more professional? Do you have an idea in mind? Do you want to switch career? Answering the question why you want to do something will take you far. If you know why you are doing certain things, you will keep up the motivation even if the endeavor is not always going to be easy — trust me, learning how to program is not always easy.

#2. Do your research

Once you know why you are doing it, then do your research.

If it is for a career change, then research what is in demand in your area. Look at job postings on LinkedIn or StackOverflow.

If it is for a personal project, then research what similar apps have been built in. For Websites, you can use for example Wappalyzer.

#3. Decide

If you there are multiple languages you could use, then look for in demand languages and languages that have been around for quite a while. Learning a language that is in demand right now, will make you more attractive in the job market. Using a language that exists for a long time increase the chances that the language and it’s ecosystem is mature.

Tell me in the comment section the why you want to learn how to program and whether my tips helped you.
Music Genres: My Second NPM Package
Tags: node, music, javascript, npm
Published: 2020-05-23 19:03:04

---
title: Music Genres: My Second NPM Package
published: true
date: 2020-05-23 18:53:49 UTC
tags: nodejs,music,javascript,npm
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*gLBig78AOTrgfu3uxwX3kQ.png)

In case you haven’t already noticed, I love music. Not the way everyone says they do, I **actually** love it. So after yesterdays SLAAAYER rush, I quickly dove into my next music-related NPM project: Music Genres.

The package is simple: install and require it, and then you’ll have access to three functions:

1. getAllGenres()
2. getRandomGenre()
3. getRandomSubgenre()

The first will return all the stored genres and sub-genres (of which there are currently 13 and 222, respectively) in a JavaScript Object. The second will Return a random genre, an array holding sub-genres. Lastly, the third will return a random sub-genre, which is a string.

### Example

```javascript
const musicGenres = require("music-genres");
 
musicGenres.getAllGenres();
// Returns all genres - an object holding genres
 
musicGenres.getRandomGenre();
// Returns random genre - an array holding sub-genres
 
musicGenres.getRandomSubgenre();
// Returns random sub-genre - a string
```

You can install the package here: [https://www.npmjs.com/package/music-genres](https://www.npmjs.com/package/music-genres)

I’d love any and all feedback. Say hi on twitter [@gschnei](https://twitter.com/gschnei).
Github Action - Clean up resources
Tags: webdev, ci, javascript
Published: 2020-05-23 18:49:51

---
title: Github Action - Clean up resources
published: true
description: 
tags: webdev, ci, javascript
cover_image: https://i.ibb.co/yyNJpWV/adli-wahid-MC124-FE4-Qj4-unsplash.jpg
---

A typical CI workflow with Github Actions looks like this:
- Check out git repo.
- Build project.
- Deploy to a Demo environment.
- **Clean up the Demo environment after a while.**

The last step is what everybody usually forgets or doesn't have time to take care of it. Over time, that will lead to orphaned deployments and surprising bills from cloud providers.

### Github Action - clean up resources

Use this Github Action to clean up resources after X minutes by triggering a URL endpoint.

#### Use cases
- After deploying to a demo environment, 1 day later, we want it to clean up itself by triggering an API endpoint to remove that demo environment.
- After running some steps, we want to trigger an endpoint to notify somebody, etc.

#### Usage

Add this to your Yaml file:

```yml
jobs:
  clean:
    runs-on: ubuntu-latest
    steps:
      - name: cleanup
        uses: ngduc/clean-up-action@master
        with:
          projectId: setYourProjectId # set your unique projectId, example: myProjectId1
          expiryMins: 1440 # after X minutes, invoke the below URL endpoint.
          method: 'POST' # one of these methods: GET, POST, PUT, PATCH, DELETE
          url: https://some.cleanup.api.endpoint # some URL endpoint to clean up resources.
          headers: '' # headers (JSON string).
          payload: '{ "someResourceId": 1234 }' # payload for url (JSON string).
```

I created this little project to help with that cleanup step. I hope you find it useful. Any feedback is appreciated.

### Links

- Github repo: https://github.com/ngduc/clean-up-action
- Marketplace link: [marketplace/actions/clean-up-resources](https://github.com/marketplace/actions/clean-up-resources)
- Usage example: https://github.com/ngduc/parcelui/blob/master/.github/workflows/ci.yml#L26-L34
Difference Between Java and JavaScript
Tags: javascript, java
Published: 2020-05-23 18:48:19

What is the Java
Here, Java does need to run before compile. what is the compiler’s work? the compiler converts scripting language to machine language.

Hence, java is used to itself. Also, java is used to object-oriented features. As well as, java’s main features have encapsulation, polymorphism, inheritance.

Even more, we do not need a browser to run the program. Also, javascript supports multithreading and by all means, we can be used multiple tasks at the same time with multithreading. <a href="https://wlearnsmart.com/difference-between-java-and-javascript/">Difference Between Java and JavaScript</a>


 
Afterward, if you more learn java and want java projects for learning as well  as how to setup java should find download java

Difference Between Java and JavaScript

What is the JavaScript
As can be seen, javaScript language means it is a simple language. Also, JavaScript does not need to run before Compile.

Similarly, no need to compile for javascript and Javascript language not run individual. Therefore, it would run with a language with HTML code and also PHP language.Learn the most important topic with <a href="https://wlearnsmart.com/sql-insert-multiple-rows/">SQL Insert Multiple Rows</a>

So, in javascript object-based language actually, they have already predefined objects. In fact, we can include their predefined object for the program. we need a browser to run a program.
Top Forex API to Use in 2020
Published: 2020-05-23 17:47:05

Currency trading is a global market where currencies are bought and sold. To facilitate trading, many brokerage companies provide an online infrastructure that makes it easy for traders to access the global currency market. In recent years these companies have also provided APIs (Application Programmable interface) to help third-party application integrate with there platform. In this article, we will look at five [forex apis](https://blog.api.rakuten.net/top-10-best-forex-apis-yahoo-finance-tradingview-oanda-and-more/) you can use with confidence in 2020.

1. [Yahoo Finance API](https://blog.api.rakuten.net/api-tutorial-yahoo-finance/) - Yahoo Finance API allows developers to access and integrate financial data from the stock market and other financial establishments into third-party applications.

2. [Tradingview API](https://in.tradingview.com/rest-api-spec/) - Tradingview allows brokers and developers to connect their backend systems to TradingView, this will allow third-party applications to use the charts and other trading tools within their application

3. [Oanda API](https://developer.oanda.com/) - Oanda API allows developers to Connect directly with OANDA to develop trading strategies and automate their trading experience.

4. [Stocktwits API](https://api.stocktwits.com/developers/docs) - With this API developer can access the StockTwits social graph, display curated data streams, integrate watch lists, and easily share messages, links and charts directly from your application.

5. [Fixer API](https://fixer.io/) - Fixer API allows developers to connect directly to Fixers powerful back-end infrastructure. Using this API these developers can connect easily integrate their application getting access to essential financial data like exchange rates for 170 world currencies, returning Time-Series data and fluctuation data.