teleren/devto huggingface dataset:
How hard is it to be an indie?
Tags: motivation, beginners, codenewbie, discuss
Published: 2020-12-20 20:07:06

## Where to start?
Normally people really like to do something like make and edit videos, play and stream, write and draw, create and etc.
If you are one of these, congratulations! You deserve all the support in your stuff!. And if you aren't so maybe this article it's not for you.

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

## How hard is it?
We can split this ''hard'' part into two meanings:

### The Hardest Part Number 1
**The ''Hardest'' will be how much difficulty you do your content. ** If you are really good in to do what you like so well done!! If you take more time or if you have always a lot of problems to struggle with, don't worry...** Just keep it doing and you will be better and faster, also, you are able to find better ways to do your stuff..** *yes, your stuff!*

The last comment here is: **Keep Going!**

### The Hardest Part Number 2
**Here the ''Hardest'' part will be having the resources and support** like software licenses, hardware, audience, and followers. Because for sure it will come the time that you are doing your stuff and getting better and you think that nobody cares because of 1001 reasons.

**Stop it! Don't worry about that, breathe, and keep going!**
You can do your amazing stuff and think that nobody cares but that is not true. The people who care did not discover you yet. 

Keep working and for sure someday someone really cool will notice your incredible content!

## Before go

This post is long and I don't have sure that you read it all so.. very quickly:
- If you like what you do, keep doing it!
Thank you for your time! ☺

#### Social Media

[Youtube](https://www.youtube.com/c/DavidRicardo97)
[Twitter](https://twitter.com/DavidCRicardo)

### Credits to:
- Cover Image: [Inspiring Decisions](https://www.inspiring-decisions.com/lorem-ipsum-8/)
- Image on the post: [Elipsis Service](https://elipsisservice.com/blog/que-es-un-content-creator-y-por-que-lo-necesitas/)
Why did you decide to study Software Engineering?
Published: 2020-12-20 20:05:28

At the beginning of 2020, I started a new position as a packaging engineer after graduating from Michigan State University. As COVID-19 hit I slowly realized my time was going to be limited in this position. I started working from home in March and had some extra time on my hands, so I took advantage of free courses on Coursera for software engineering. I was always into video games and computers and after my friend had shown me his github and things he had created using C++ and Python I decided that it was worth a shot. 

My initial reaction to programming was great as I felt rewarded every time I wrote a program I could instantly see my work being put to use. I enjoy solving puzzles and all the programming assignments I worked on felt like that. I felt like I could see my knowledge growth and after completing the courses on Coursera for Python, I found myself building dashboards that called API's and even building games on Pygame. 

Overall, I decided to choose software engineering because I enjoy the challenges I face with every program I try and build and the reward of seeing your creation in action!
Padrão Builder em Python
Published: 2020-12-20 20:02:05

O Builder é um **padrão de projeto criacional**,  este facilita a criação de objetos complexos que são compostos por vários campos e objetos agrupados, permitindo a representação de diferentes versões deste objeto usando o mesmo código de construção.

####Exemplo de código em Python
```python
class Builder(ABC):
    @abstractproperty
    def product(self) -> None:
        pass

    @abstractmethod
    def produce_part_a(self) -> None:
        pass

    @abstractmethod
    def produce_part_b(self) -> None:
        pass

    @abstractmethod
    def produce_part_c(self) -> None:
        pass
```
A classe *Builder* representa a interface que especifica os métodos para criar as diferentes partes do objeto.

```python
class ConcreteBuilder1(Builder):

    def __init__(self) -> None:
        self.reset()

    def reset(self) -> None:
        self._product = Product1()

    @property
    def product(self) -> Product1:
        product = self._product
        self.reset()
        return product

    def produce_part_a(self) -> None:
        self._product.add("PartA1")

    def produce_part_b(self) -> None:
        self._product.add("PartB1")

    def produce_part_c(self) -> None:
        self._product.add("PartC1")
```
A classe *ConcreteBuilder* segue as especificações da interface *Builder* e provê nos seus métodos as implementações especificas do seu objeto. Estas especificações são necessárias uma vez que diferentes builders podem criar objetos completamente diferentes. A função reset é chamada para garantir que o ao final da criação de um objeto o builder esteja pronto para criar outro.

```python
class Product1():

    def __init__(self) -> None:
        self.parts = []

    def add(self, part: Any) -> None:
        self.parts.append(part)

    def list_parts(self) -> None:
        print(f"Product parts: {', '.join(self.parts)}", end=""

if __name__ == "__main__":

    builder = ConcreteBuilder1()

    print("Custom product: ")
    builder.produce_part_a()
    builder.produce_part_b()
    builder.product.list_parts()
)
```
A classe *Product1* representa uma instância de produto que vai ser criado utilizando os passos especificados no builder. No main está um exemplo de objeto criado pelo builder.

A implementação em Python não tem nenhuma particularidade em relação a implementação em Java.

***
**Referências**
[Padrões de Projeto](https://diogomoreira.gitbook.io/padroes-de-projeto/) (Diogo Moreira, 2020)
[Mergulho nos Padrões de Projeto - v2020-1.14](https://refactoring.guru/pt-br/design-patterns/book) (Alexander Shvets, 2020)
*Os códigos usados como exemplo foram retirados do livro Mergulho nos Padrões de Projeto.*
My JavaScriptmas solutions
Tags: scrimba, javascriptmas
Published: 2020-12-20 19:55:12

## Merry Xmas ! 🎄 🎁 🎄 
### Here's a list of all my Javascriptmas (Scrimba's challenge) solutions. 💻

Day 1 - [Candies](https://scrimba.com/scrim/co37646de9e54d84594b0ce4f)
Day 2 - [Deposit profit](https://scrimba.com/scrim/coe58419ebe73011b1a83ec35)
Day 3 - [Chunky monkey](https://scrimba.com/learn/adventcalendar/note-at-0-51-co9bf4ca3aa783f0d2d68e15f)
Day 4 - [Century from year](https://scrimba.com/learn/adventcalendar/note-at-0-06-cod474fee86671e129d33f113)
Day 5 - [Reverse a string](https://scrimba.com/learn/adventcalendar/note-at-0-04-co84a4d01a10d09ceea100d2b)
Day 6 - [Sort by length](https://scrimba.com/learn/adventcalendar/note-at-0-02-cocc04a3fb3b0cc4532918519)
Day 7 - [Count vowel consonant](https://scrimba.com/learn/adventcalendar/note-at-0-06-cofcb419281a2e56650a317a6)
Day 8 - [Rolling dice](https://scrimba.com/scrim/co0a940bf866254699d9a3f3a)
Day 9 - [Sum odd Fibonacci numbers](https://scrimba.com/scrim/cobda423d9bf0a5d3787d6b36)
Day 10 - [Adjacent elements products](https://scrimba.com/scrim/coee244b090756f3f017902d2)
Day 11 - [Avoid obstacles](https://scrimba.com/scrim/co99845ecbf67c1308e9d1c1b)
Day 12 - [Valid time](https://scrimba.com/scrim/co67341d3b0a7bb9a1d9ce9bd)
Day 13 - [Extract each Kth](https://scrimba.com/scrim/coea64086a81026c5a1a35300)
Day 14 - [Maximal adjacent difference](https://scrimba.com/scrim/coc644bc28f61d615764aef62)
Day 15 - [Carousel](https://scrimba.com/scrim/cof164482a1ed5572cba99b74)
Day 16 - [Insert dashes](https://scrimba.com/scrim/cocd54734ab0d250bb70f3c94)
Day 17 - [Different symbols naive](https://scrimba.com/scrim/co29a45928fe7424934c50d43)
Day 18 - [Array previous less](https://scrimba.com/scrim/co93e4c7785b3fedc99069573)
Day 19 - [Alphabet subsequence](https://scrimba.com/scrim/cof3448ecb607e6904e2034d4)
Day 20 - [Domain type](https://scrimba.com/scrim/cof494cc997d4229ed20f1cc9)
Day 21 - [Sum of 2](https://scrimba.com/scrim/co768478da99d391a1d3dcc49)
Day 22 - [Extract Matrix Column](https://scrimba.com/scrim/co2444687b87919293e6579f6)
Day 23 - [Social media input](https://scrimba.com/scrim/co9bb479bb2204631c59cbebe)
Day 24 - [Test Your Agility]
(https://scrimba.com/scrim/coeb347b7a005c6cf98d1fb9d)
How to request variable for Powershell / Bash Task group
Tags: azuredevops
Published: 2020-12-20 19:36:53

<sub><span>Photo by <a href="https://unsplash.com/@drosie">Donnie Rosie</a> on <a href="https://unsplash.com/s/photos/brick">Unsplash</a></span></sub>

I have tried to automate a group of pipelines and makes them independent from specifying variables. So everything should be based on convention.

But, i failed to deduce everything based on Build.DefinitionName, for example.

The biggest issue, is to pass specific variable (based on names) to Powershell script. 

The script can request for variables by specifying the following:

```powershell
$(myVariable)
```

but i can't feed them using expression :(

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

It's the same for bash script.

Hope this helps !
Migrating from sqlite3 to postgresql in Rails apps.
Tags: rails, postgres, sqlite3, heroku
Published: 2020-12-20 19:33:24

Heroku for some reason doesn't support sqlite3 in their deployments. So, it is must to migrate your db from default sqlite3 to mysql or postgresql. 

- In order to do that you need to first add pg gem to your Gemfile file:
`gem 'pg'`

- Then install the gem with bundle install.
`bundle install`

- change database.yml file to use postgresql
config/database.yml

```yml
development:
  adapter: postgresql
  database: my_app_development
  pool: 5
  timeout: 5000
test:
  adapter: postgresql
  database: my_app_test
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: my_app_production
  pool: 5
  timeout: 5000
```
- Start postgres as service on your local machine: `brew services start postgresql`
- Now create the database by running `rake db:create`
this creates local db

- Create the tables using the famous `rake db:migrate` command.

- If you have seed data like I do, then do rake db:seed

## Troubleshooting
Sometimes the postgresql that's on your machine might be old one and so it becomes problematic to run postgresql service and create local database that your development env is trying to connect to. If that's the case then you need to update your postgres version

1. Update postgresql
`brew postgresql-upgrade-database`
2. Restart postgres service
`brew services restart postgresql`
3. Go to your apps root & create the database in postgresql
`rails db:create`
This will create a new `my_app_development` db in your local postgres instance
4. Now the usual steps follow like migrating db & seeding data if you have any.
`rails db:migrate`
`rails db:seed`
PHP-Doc in Blade-Views
Tags: laravel, blade, tipstricks
Published: 2020-12-20 19:30:30

In my [Telegram Newsletter](https://gummibeer.dev/blog/2020/telegram-newsletter-command) post I've used PHP-doc type-hints without explaining them as I'm doing it every day.
In the comments [@alexfwulf](https://twitter.com/alexfwulf/status/1339576771222642689) mentioned that this was learning for him. So I'm dedicating a whole post on that topic.

With Laravel 7 we got Blade Components which are beautiful but also introduced even more ways to inject variables in a Blade View and for components we get some default variables.

Even before it was hard to know which variables are available in a Blade View and even harder what type they're.

The [Laravel IDEA](https://laravel-idea.com) plug-in gets better and better in resolving them. But isn't perfect so some manual work is still required.
My solution is to put PHP-doc variable type-hints to the start of my Blade files.
This way I immediately know which variables I can use and what type they're.

I'm using a single line and PHP-tag per type-hint. This way it's easier to copy or remove them.

```php
<?php /** @var \Illuminate\Support\Collection|\App\Models\User[] $users */ ?>
<?php /** @var string $name */ ?>
```

After I've added all the tags I can use the variables and can use PhpStorm awesome suggestions/autocompletion.

## Blade components

I start every Blade component with one to two tags as these are default component variables.
Primary the `$attributes` variable has a lot of undocumented methods you can use to do cool things like cherry-picking special attributes.

```php
<?php /** @var \Illuminate\View\ComponentAttributeBag $attributes */ ?>
<?php /** @var \Illuminate\Support\HtmlString $slot */ ?>
```
Sit-standing, 6 months later
Published: 2020-12-20 18:52:18

![2020-12-19-01.jpg](https://devthat.rocks/public/posts/2020-12-19-01.jpg)

*Originally posted on devthat.rocks*

I'm working from home since December 2019, even before the spread of the virus. At that time I was working on a project that needed more commitment, so I decided to take some days from the Christmas holidays while staying at home.

The initial setup was not so cool: an old desk with a red chair, just an easy starting point. After a few months I started to look around for something that could potentially improve my efficiency. I spent a lot of time in defining a target and after assigning a budget, I finally moved to a sit-standing approach.

I decided to go for a [manual-crank desk](https://www.ikea.com/us/en/p/skarsta-desk-sit-stand-white-s59324818/) with [support](https://www.ikea.com/us/en/p/lidkullen-sit-stand-support-gunnared-dark-gray-50445787/), both white-painted coming from IKEA. I usually start the day sitting, but then I stand up until lunch. After that, I'll be back on the seat but just for one hour. It's not a time-boxed activity: I try to alternate the two positions, it's a continuous movement. That's the beauty of this approach.

Let me report some findings from these six months.

- I found that doing PR reviews is better while standing. Maybe because it's something I'm used to do before leaving for lunch or at the end of the day.
- I move often during meetings, especially for longer ones (backlog refinements on the top!).
- While coding, it's good to have a 5 minutes break to switch the position (see [Pomodoro Technique](https://en.wikipedia.org/wiki/Pomodoro_Technique)). This gives the chance to have a quick-stretching session.

Productivity is directly linked to ergonomics, and after six months I feel more productive. Nothing more to say.
When you feel comfortable with the tools and the environment you brought up, even working is easier.
In the end, it has been one of the best choices of the year!
Getting to know DO App platform
Tags: dohackathon, node, typescript, nextjs
Published: 2020-12-20 19:21:54

# Intro

I am junior dev, but I have previous experience with Heroku and DO droplets. So I decided that I should try an alternative.

### First step

So I decided to deploy strapi to DO App platform, just to test it.

Setup seemed **easy**, evnironment, databases, everything one click.

### But then came the **deployment**.
I was waiting up to **20 minutes** for some deployments!!!
One single change in strapi? Waiting 20 minutes. Just like that. I hope it is only for the first build. 
I am using the $5 plan, but waiting 20 minutes every time would be unacceptable.

### Update 
Any subsequent builds run on average for 3 minutes, which is on par with heroku. So I see no problem here.


I will be updating as I progress.
Do you have similar experience, or some tips?
Concurrency in Golang
Tags: go, concurrency, programming
Published: 2020-12-20 19:06:01

In golang, concurrency is made possible through the use of goroutines and channels.
goroutines are basically "thread-like" lightweight structures that complete activities without blocking the main thread. They are basically a "fire and forget" cause go cleans up when a goroutine is completed. If however, we want to get data out of our goroutine process when it is done then we can use channels.
```go
import "fmt"

// Essentially this is how we fire a goroutine

func runForAWhile(){
  // do something pretty that takes 5 secs or 2 yrs
}

func main(){
  go runForAWhile()
  fmt.Println("I am not waiting for that...")
}
```
Once we use the `go` keyword, Go knows to send the operation of that function out of the main scope and continue executing the rest of the code. The program does not end however until the goroutine is complete.
When you run the above example, you'd notice that the `Println` statement runs almost instantly while the program itself ends after the goroutine has supposedly ended.
Channels are an effective way to wait on output from our goroutine before ending the program. Let's say we made two API calls using two goroutines, we surely want to get that result back into the main scope. Here is an example code that describes how you could achieve that:
```go
import "fmt"

func apiRequest1(c chan string){
  var result string
  result = makeApiCall1()
  c <- result
}

func apiRequest2(c chan string){
  var result string
  result = makeApiCall2()
  c <- result
}

func main(){
  var channel1, channel2 chan string
  go apiRequest1(channel1)
  go apiRequest2(channel2)

  result1 := <- channel1
  result2 := <- channel2

  fmt.Println(result1, result2)
}
```
React spring carousel js
Tags: react, typescript, javascript, carousel
Published: 2020-12-20 18:30:23

## What I built
`react-spring-carouse.js` is a React carousel powered by `react-spring` and `react-use-gesture`.

### App Link
https://react-spring-carousel-js.emilianobucci.com/

### Description
`react-spring-carouse.js` is a new way of approach the implementation of a carousel. We give you the API, and you decide where to put the carousel elements and how interact with it. It embraces the philosophy of **Headless UI** (not 100% of course, but almost).

### Link to Source Code
https://github.com/Emiliano-Bucci/react-spring-carousel-js
https://www.npmjs.com/package/react-spring-carousel-js

### Permissive License
MIT License

## Background
I decided to build this library - specifically following this new approach in carousel's world - because many times, while trying to implement a carousel in my site/app - i never felt totally free. I always had the feeling that i had to do some dirty hack to adapt the carousel to work in a decent way in my UI, and of course i never like that. I never like the idea of having to override stuff, or not being totally free of implement my own components in the way i needed to.

The second point was that animations never feel very natural, always having the feeling that something wasn't quite right, even if i wasn't able to tell specifically what.

### How I built it 
I had to admit, this is my first open source library :D I built it using the package of `create-react-library` -> https://www.npmjs.com/package/create-react-library.

The main technologies that power this carousel are **react-spring** and **react-use-gesture**.

### Additional Resources/Info
https://www.react-spring.io/
https://use-gesture.netlify.app/
How do you test your VSCode extensions?
Tags: vscode, testing
Published: 2020-12-20 18:24:53

I'm searching for some well maintained VSCode extensions that are well tested.

How do you do this? What is your plan while testing your VSCode extension?

Any good example (test) code?

I try to get my head around this and wonder how do you do this as an extension maintainer?

Greets,

Andi
Open Source Opportunity! 
Published: 2020-12-20 18:16:56

# Background 

I created a very small npm package that solves a very specific issue (for me at least). I found a particular step in my work flow that could be automated, creating the files for a static web site. You know, `index.html`, `style.css`, and `main.js`. My package does exactly that. By typing `npx create-static-web` In your projects directory, my package will create those files with some starter code to get your project going!

The package can be found [here](https://www.npmjs.com/package/web-starter-template). 

## Open Sourcing 

While I am still new to web development, I have found many ways to make a website. While a static site is the easiest to create, web applications that are made in the MERN, MEAN, or other stacks are more challenging to scaffold. I am looking for anyone who has a favorite tech stack to join me in expanding this package. 

You can view the source code [here](https://github.com/cdthomp1/web-starter-template)

If you have any improvements for the package, please submit a PR! 

I am excited to work on this with all of you!
Next.js: What's Possible
Tags: jamstack, netlify, jamstackconference, fitc
Published: 2020-12-20 18:14:49

Recently I attended a session at Jamstack conference. The title of the session was “Next.js: What’s Possible”. The speaker here is Cassidy Williams, Principal Developer Experience Engineer at Netlify. In this session she dives into Next.js. Next.js is an open-source React front-end development web framework that enables functionality such as server-side rendering and generating static websites for React based web applications. I was completely new to Next.js but I’ve learnt some basics of React.js before so I was hoping to explore Next.js. It has a ton of capabilities built in for an awesome developer experience for both indie developers and enterprises alike.
So, let’s dive into what’s possible with Next.js. First thing is next-on-netlify package. The next-on-netlify package is a npm package recently absorbed by Netlify. This package allow Server-Side Rendering(SSR) of Next.js that are built into Next.js and we can use Netlify function to power those sites. So, this means we can use the Next.js or basically the React.js apps with the backend hosted as functions on Netlify.
Second thing which I learned about is Incremental Static Regeneration. This is included in Next.js 9.5. It allows us to create pages that don’t necessarily exist like we can take concepts from route of the URL and we can use that to change something about the page. So, it’s kind of lets you render pages that you haven’t necessarily defined. So, it allows for dynamic routing which is really a cool feature to work on. 
Third thing that I learned about is the Next.js Head API. It allows a built-in component for appending elements to the ‘head’ of the page. To avoid duplicate tags in ‘head’ we can use ‘key’ property which makes sure that the tag is rendered only once. I think its really a good feature that we can edit the head area of the page and change meta data or contents based on current information.
Later on, she talks about how she pranked and tricked people to believing people for a fake like by just changing the head of the page to look like real one and then posted that link on twitter. So, the twitter previewed the information on the basis of head tag. I really think that the serverless architecture is progressing in a really fast manner and in near future we may see many big applications running via the serverless backend.