teleren/devto huggingface dataset:
Local Email Development Service
Tags: opensource, tutorial
Published: 2021-04-24 17:30:03

Whenever I've worked on any application that sends out emails it's always an issue on how to mimic the behavior on my local laptop.  Usually wherever the app is deployed is configured to be able to just 'work'.  aka you can send email by connecting to localhost with no auth.

Now, how do I mimic locally? In the past i've tried setting up postfix etc in a docker stack, or more recently doing an smtp relay using google services.

For reference the previous pattern:

```sh
#!/usr/bin/env bash 
docker run --restart always --name mail \
    -e RELAY_HOST=smtp.gmail.com \
    -e RELAY_PORT=587 \
    -e RELAY_USERNAME=user \
    -e RELAY_PASSWORD=secret \
    -p 25:25 \ 
    -d bytemark/smtp

```

This pattern requires you to enable unsecured application in your google account.

The new pattern I've started using of late is leveraging the wonderful tool called [MailHog](https://github.com/mailhog/MailHog).

To set it up simply add the following to your docker-compose.yml file.

```yaml
  mail:
    image: mailhog/mailhog:v1.0.1
    container_name: mail
    ports:
      - 8025:8025
      - 1025:1025
```

If your application is running in docker you don't need to expose 1025, if you're running your app outside of docker, you need to get to 1025 to send mail.

don't forget to bring it up via `docker-compose up -d mail`

At this point you just need to configure your SMTP settings.

Here's an example snippet that I used for my app.

```yaml
reporting:
  to: [csgeek@anyemail-host.com]
  from: "donotreply@foobar.com"
  subject: "Report for things"
  hostname: localhost
  username:
  password:
  port: 1025
```
Main parts you should note is the hostname is `localhost`, and port is `1025`.

Then once everything is done you can connect to port 8025 and retrieve your email.


![Storage Classes](https://esamir.com/images/mailhog_dev_pattern/mailhog_screen.png)
Back to yarn 1x after migrating to the 2x "Berry" version
Tags: help, yarn, npm
Published: 2021-04-24 17:18:31

If you are like me and wanted to test yarn 2x "Berry" and a few seconds later you were doing `npm uninstall -g yarn` and then `npm install -g yarn` but the version still was 2x, you can revert to the 1x version by doing:
```yarn set version 1.22.10``` 
(knowing that 1.22.10 is the version I want to use)
Bye 👋 ✌️
Angular 6 Custom Pipe | with Parameterizing a pipe | Angular Pure pipes + Impure pipes
Tags: angular, custome
Published: 2021-04-24 17:08:49

https://grokonez.com/frontend/angular/angular-6/angular-6-custom-pipe-with-parameterizing-a-pipe-angular-pure-pipes-impure-pipes

Angular 6 Custom Pipe | with Parameterizing a pipe | Angular Pure pipes + Impure pipes

In the tutorial, we show how to create an Angular Custom Pipe with Angular Pure Pipe, and Angular Impure Pipe.

Related posts:
- <a href="https://grokonez.com/frontend/angular-built-in-datepipe-example-pre-defined-format-timezone-locale-custom-format">Angular Built-in DatePipe Example | Pre-defined Format + Timezone + Locale + Custom Format</a>
- <a href="https://grokonez.com/frontend/angular-6-keyvalue-pipe-ngfor-loop-through-object-map-example">Angular 6 – KeyValue Pipe – *ngFor Loop through Object, Map example</a>
– <a href="https://grokonez.com/frontend/angular/angular-6/how-to-integrate-bootstrap-with-angular-angular-6">How to Integrate Bootstrap with Angular (Angular 6)</a>
– <a href="https://grokonez.com/frontend/angular-6-component-how-to-create-integrate-new-angular-6-component">Angular 6 Component – How to create & integrate New Angular 6 Component</a>
– <a href="https://grokonez.com/frontend/angular/angular-6/angular-6-ngfor-repeater-directive-loop-over-a-collection">Angular NgFor Repeater Directive – Loop over a Collection (Angular 6)</a>

Related pages:
<ul>
<li><a href="https://grokonez.com/angular-tutorial">Angular Tutorial</a></li>
</ul>
<!--more-->
<h2>Custom Pipe</h2>
We can write our own custom pipes.

Example: create a pipe that calculates a logarithm of a number with the base value.
->

<pre><code class="language-javascript">
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({name: 'logbase'})
export class Logarithm  implements PipeTransform {
    transform(value: number, base: number): string {
        return (Math.log(value) / Math.log(base)).toPrecision(2);
    }
}</code></pre>

- The <code>@Pipe</code> decorator allows you to define the pipe name that you'll use within template expressions.
- <code>PipeTransform</code> interface's <code>transform</code> method that accepts an input value followed by optional parameters and returns the transformed value.
->

https://grokonez.com/frontend/angular/angular-6/angular-6-custom-pipe-with-parameterizing-a-pipe-angular-pure-pipes-impure-pipes

Angular 6 Custom Pipe | with Parameterizing a pipe | Angular Pure pipes + Impure pipes
Let your team make errors
Published: 2021-04-24 17:05:55

"Teamwork is the ability to work together toward a common vision. The ability to direct individual accomplishments toward organizational objectives. It is the fuel that allows common people to attain uncommon results." --Andrew Carnegie

If you asked me what was my biggest error as CTO, I would say it was managing my team too much. I guess you could call it micromanagement. It is not an excuse but from one day to the following I took a lot of responsibility and I got crazy with my teams. I wanted to control everything, I assigned every issue, I tracked all the work in progress, I was aware of any problem. All this every day until I gave up.

I realized I was doing it badly, I made the most common error that everybody starting with Agile makes, not trusting my team. You don't need to worry if they are working harder or if their decisions are the best or… no, no, no, you must focus on product quality and goals accomplishment. Let them make mistakes! If they make the wrong decisions, if the code quality is poor the throughput will be affected because to make changes will be more expensive and the todo list will be polluted with bugs, the team will note it and you too, and together will have to seek for solutions. If the team is not able to reach a sustainable pace, you will have to help them. You should be next to the team when they fail and they deliver zero value to the rest of the company or the client. But that is all.

Some important thing: you must share a common vision with your team, you must agree on common goals for the iteration, you must provide support for every problem and the most important you must work with professionals not with children pretending to be professionals and believe me this is the most difficult thing, but without it to have a trust relationship with your team is impossible and that is the base of everything else.
SCRUM can't fix your broken culture either
Published: 2021-04-24 17:05:10

I was having a coffee with some mates, we were pointing at all the things we can't stand in our company. This is more a drill since our boss is unable to take action based on our complaints. It's a way to mitigate our frustration.

Suddenly from the bottom of the room, we heard: "Why are we not using SCRUM? it will resolve all our problems, won't it?". After a quick silence, everybody started to discuss if we are using SCRUM yet, why and why not and all this kind of stuff that really bored us.

One of the worst thing SCRUM, and Agile by extension, have brought with them is the idea that practices and rituals can fix your broken culture. From my view, to believe that some processes described in a book are going to solve problems which you can't fix is a very naive idea. In this particular case is an example that this person has understood nothing.

To make SCRUM work you need to build a culture based on confidence in every member of the team, between client and team and business people and team. Before that, you need to build a multidisciplinary team of professionals and again that is not the goal, but it is the vehicle to achieve our goals. Even with a team, even with a trusted relationship, the application of SCRUM can still fail. You have to lay the foundation before you start to build.

The good thing about Agile is it could help you to build these kinds of teams and relationships. You can use the practices and rituals described by the people behind the acronym and get some success but the most important thing is to interiorize the agile principles and to understand the gist of these practices and rituals, in this way you will be able to adapt them to your context.

In this industry, there aren't silver bullets nor shortcuts and you will have to deal with other people.

"It's much easier to convince the processor to do what I want than some people." Marko Poutiainen
NestJS with mongoose populate()
Published: 2021-04-24 16:56:04

ตัว mongoose เองมี method populate() ที่ช่วยในการ $lookup อยู่แล้ว โดยเราสามารถใช้งานได้จากตัวของ model

```typescript

// declare
constructor(
    @Inject(firstModelProviders[0].provide) private firstModel: Model<FirstModelDocument>,
    @Inject(secondModelProviders[0].provide) private secondModel: Model<SecondModelDocument>,
  ) {}

// use
const firstModelRepo = await this.firstModel.find().populate('secondModelForeignKey', '', this.secondModel).exec();
```
I Wrote a Book - An Introduction to Code
Tags: python, books, programming
Published: 2021-04-24 16:52:50

I have wrote a book that explains how to program for new developers/programmers by using the Python programming language.
Python was chosen as it is an easy language to pick up and learn for new developers, there is not a huge amount of up front learning cost before you can start writing code.

<h3>About the Book</h3>
It starts by showing how to install Python, what variables are and how to use them, data structures, control flow techniques, object-orientated programming, etc.
There are plenty of small exercises and code snippets throughout to get you reading and writing code.

Near the end of the book there are bigger exercises (activities) that explain the process of creating bigger projects (a to do list, a simple login system, etc) with step-by-step explanations of the code and 'stretch' goals to challenge the reader further.

<h3>Theory/Computer Science</h3>
I also cover more theoretical/computer science concepts such as the difference between compilers and interpreters, how programming languages are created, how variables are stored and managed in memory, how different data structures work in memory, and more. These sections are all linked back to how Python works, to give the reader a better understanding of the programming language they have been using and learning.

<h3>Disclaimer</h3> 
the digital/ebook copy is in full colour (unless reading on a b/w kindle). However, the paperback/physical copy is printed in black and white.
This was done to keep the cost down (Amazon charge a lot more for colour printing). 
This should a very minimal effect on reading the book. There are little bits that talk about colour (when using the 'turtle' module and when creating GUIs). 
This is just about how to change the colour the turtle uses and the colour of the background/foreground of widgets, this is not a major part of the book.
When you write the code out on your own machine you will obviously see all the colours.

<h3>Get a Copy</h3>
Affiliate Link: https://amzn.to/2QOKU4x
Non-Affiliate Link: https://www.amazon.co.uk/dp/B093CHHF5M
(The affiliate link will give me a bigger royalty/kickback on every sale)

This is the first book I have ever written, so any sales/feedback is very appreciated.
P.S. if you do pick up a paperback/physical copy please feel free to send me a photo of it on Twitter (@acroynon)
What is hotwire with RoR?
Published: 2021-04-24 16:38:53

#Introduction
Earlier this year the creator of Ruby on Rails, David Heinemeier Hansson (aka DHH) spoke at a conference in Chicago and discussed a new framework he helped to created called "Hotwire". DHH stated that Hotwire is "an alternative approach to building modern web applications without using much JavaScript." Hotwire is described as "HTML over-the-wire" therefore it generates HTML instead of JSON and delivers it to the server. 

# Why Use Hotwire
I've been researching Hotwire lately and I asked myself this question: "Why use Hotwire instead of JavaScript or a JavaScript framework or library?" This is what I have determined. 
* It's a great option for full-stack development. I don't think it's any secret that a lot of programmers were using Rails as a backend only for an application. I think with the release of Hotwire, DHH is attempting to make Ruby on Rails once again, more relevant for full-stack web development. 
* Hotwire comes with something called [Turbo](https://turbo.hotwire.dev/). Turbo uses complementary techniques to dramatically reduce the amount of custom JavaScript that most web applications will need to write. Turbo makes links and forms submissions quicker by removing the need for full page reloads. 
* While Turbo handles at least 80% of the interactivity that would typically be handled by JavaScript, you may find yourself in a situation where you need a small amount of JavaScript code, in that case, Stimulus is available. Stimulus uses an HTML-centric approach to state and wiring.

# So, how do I get Hotwire?
The first step I'd recommend is going to [Hotwire For Rails On Github](https://github.com/hotwired/hotwire-rails#:~:text=README.md-,Hotwire%20for%20Rails,of%20JSON%20over%20the%20wire.&text=This%20gem%20installs%20both%20Turbo,ES6%2FESM%20in%20the%20browser.) 
Installation:
1. Add `hotwire-rails gem to your Gemfile.
2. Run `bundle install`
3. Run `hotwire:install
Hotwire also has the following resources available:
[Hotwired Turbo Rails](https://github.com/hotwired/turbo-rails )
[Hotwired Stimulus-rails](https://github.com/hotwired/stimulus-rails)

#Final Thoughts 
I think Hotwire is a good option for programmers that's don't necessarily love working with JavaScript. I think the folks that think Rails is "too slow" and "can't scale" may give Hotwire a shot and see what they think of it. I also like the fact that you can use a tiny bit of JavaScript when needed by way of Stimulus. 

Have you used Hotwire with Rails? Let me know what you think!
Patch-Note | Mooneria
Tags: java, plugin, eclipse
Published: 2021-04-24 16:35:07

Nous avons réglés les problèmes avec la ArrayList du vanish, voici le code:```private ArrayList<Player> vanished = new ArrayList<Player>();```

Elle avait un problème de syncronisation sur les serveurs de test donc nous avons passé une bonne heure pour pouvoir regarder toute les classes du projet jusqu'à arriver sur ce bug de ArrayList.

Aussi nous avons réglés le bug de monture avec le loup ou nous allions trop vite, voici le code:```public static double maxHealth = 1.2d;
public static float mountSpeed = 0.15F;```

Et pour finir nous avions des problèmes : events BungeeCord avec la lib, que nous avons réglés avec spigot, voici le code(des libs):```bungeecord.jar - spigot-mooneria.jar```

Le spigot mooneria et un spigot moddé pour tous ce qui est PvP, fight...

Voici le patch-note fais par les développeur de Mooneria !
Wordpress Development With Timber
Tags: wordpress, theme, gutenberg
Published: 2021-04-24 16:12:24

URL of the starter theme: 
https://github.com/prosenjit-manna/wp-twig-public

## Video 
{% youtube ruZ07PzgG8c %}

## Features included with this starter theme
- Stylesheet optimization 
- Javascript optimization 
- Gutenberg block generate with Lazy block plugin (Included with theme )
- Block specific stylesheet loading automatically only for used pages
- BLock specific Javascript loading automatically only for used pages
- Lazy loading images 
- On the fly image resize
- Redux option panel added for theme option 
- CMB2 added for page meta generate


## Development workspace features 
- .gitignore files added to removed common files from git 
- Vscode common settings included to enforece indentation 
- Deploy script added
What are type hints in Python?
Tags: python, beginners
Published: 2021-04-24 16:07:20

Python is a dynamically typed language. This means we don’t need to explicitly specify the type of a variable while declaring it. Python runtime engine infers variables' data type based on the value assigned to them. Here are few examples:
```python
greeting = ‘hello’
print(type(greeting))   # <class 'str'>
count = 10
print(type(count))       # <class 'int'>
```
Even though the above way of declaration makes the code more concise, it is prone to type errors if the application being developed has a large number of modules and classes.

<h4>What are type hints?</h4>
Typing module introduced in Python 3.5 supports declaration of type hints to variables and function return types. Although Python runtime does not enforce variable and function return type annotations, these type hints can be used by Integrated Development Environments (IDEs) and type checkers to enforce static types. Thereby reducing bugs early during the development process.

<h4>Examples</h4>
```python
from typing import List, Optional

def sum_nunbers(num1: int, num2: int) -> int:
    return num1 + num2

def get_square_list(max_num: int) -> List[int]:
    return [n * n for n in range(max_num)]

# An argument could be explicitly marked optional using below type hint 
def create_greeting(name: Optional[str] = 'World') -> str:
    return f"Hello, {name}"

print(sum_nunbers(10, 20))  # 30
print(get_square_list(5))   # [0, 1, 4, 9, 16]
print(create_greeting('Joe')) # Hello, Joe
print(create_greeting()) # Hello, World
```

<h4>Benefits of type hints</h4>
* Type hints serve as a great documentation in larger applications
* These type declarations could help uncover some of the type errors with the help of IDEs and type checkers 

<h4>Further Learning</h4>
Although, type hints may be overkill for small experimental Python modules, they would be much more useful in a larger application. I think **type hints** if used consistently would help promote clean code that is easier to understand. To learn more visit - https://docs.python.org/3/library/typing.html
Workshop para o GDG
Tags: chatbot, dialogflow, actionsbuilder, bots
Published: 2021-04-24 16:05:37

# Contato da Amanda Cavallaro:
Linkedin: https://www.linkedin.com/in/amandacavallaro/
Twitter: https://twitter.com/chibichibibr
Faça-me perguntas: https://docs.google.com/document/d/192-NnKPEKKOH8fV1ZKN_Ij_5VNduPJxJ3uBNqGClCWc/edit?usp=sharing

## **Pathways:**
Construa chatbots com dialogflow: https://developers.google.com/learn/pathways/chatbots-dialogflow

Construa ações para o Google Assistente: https://developers.google.com/learn/pathways/aog-basics

Construa um chatbot responsivo e customizado no Google Cloud: https://developers.google.com/learn/pathways/custom-responsive-chatbots?hl=en


## Conteúdo Extra Criado Por Amanda: 

https://www.youtube.com/playlist?list=PLnQRGULXeBkf23RxQi0Sq_aAab8OJGMc

Crie Actions para o Google Assistente - {% post https://dev.to/chibichibibr/crie-actions-para-o-google-assistente-49ok %} 

Actions Builder com Leitura e Escrita Firebase - 
{% github amdcaruso/firebase-read-write %}


Obrigada!
Creating a png of Your Memoji Contact Photo (the easy way)
Tags: productivity, macos, ios
Published: 2021-04-24 16:05:08

If you, like me, are one of the many people who adore the ability to generate a slick memoji profile picture with a nice pastel background, and then have the novel idea that you'd like to use that picture outside of your iMessage, read on!

You *will* need a mac to use this workflow! We will use the built-in tool Preview to do our modifications, but you can use many other services to accomplish the same thing.

Easy as 1-2-3!

1. Create your memoji profile picture (either on macOS or iOS). While creating your profile picture, take a screenshot after you choose a background (e.g. this stage:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mg7f1udaylonzrum2mec.PNG)

2. If you're on an iPhone/iPad, send that over to your Mac. Now on your Mac, open that screenshot in Preview where we will crop it to a square. Click the icon highlighted to use the rectangular crop tool, and proceed to crop a square around your profile picture by pressing ⌘ + K.

> if you don't see the toolbar you can click "Help" in the menubar and type "mark" and then select the "Show Markup Toolbar" option.

![Screenshot_2021-04-24 08.45.28_bLKPbj](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ddibajp5m9ofhhrtry0s.png)
 

3. Now we can use the magic tool which apparently is called "instant alpha". This is a nice little hidden tool inside Preview that allows you to select the perimeter of a matching color up to that color's boundary, and then delete that to make said area transparent. Here's where you can find it:
![Screenshot_2021-04-24 08.48.17_7mQHsD](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhjkci91tbry6e151as1.png)

All you need to do is click inside the boundary. Depending on your crop you may need to do it four times, but I just needed to do it once:
![Screenshot_2021-04-24 08.54.28_NtQdTG](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlmp45rbp4e6solow06e.png)
 
Press delete to remove those colored pixels and voilá! We now have a beautiful seemingly circular memoji profile picture we can use wherever we please! Make sure to save it in a good location and start sharing this workflow with your friends 😉.

End result:
![memoji profile picture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ivc0k6p93ace33vvka0.png) 

> quick note about this guide: I think the ability to export the profile picture should be built into the creation of said picture, and in the future, it may be! If it is now different than when I wrote this post, please let me know and I will update it :)