teleren/devto huggingface dataset:
Snob - Simple CLI that fetches movies and TV shows info, written in Go.
Tags: go, opensource, showdev, github
Published: 2022-08-18 15:41:00

If you're anything like me, you probably value your time too much to invest it in something like a less-than-great TV show with endless seasons and episodes, only to find out in the end that your time would be better spent doing something else.

I like to do my research and have an idea that my time will be well spent watching something I'll enjoy or something that will bring some kind of value, like knowledge, in the case of documentaries for example. 

That's the reason I like to joke with the idea that I'm a snob, with my typical self-deprecating humor, since I usually do some research before committing with something. Doing that research, however, typically means opening my browser and navigating to multiple websites to check for reviews and information about the respective movies or TV shows, which is less than optimal.

Joining this idea with the fact that I wanted to practice more of [Go](https://go.dev/), I created [Snob](https://github.com/nunogois/snob) - A simple CLI that fetches movies and TV shows info, written in Go:

![Snob](https://github.com/nunogois/snob/raw/main/.github/screenshot.png?raw=true)

## Trying it out

If you have [Homebrew](https://brew.sh/) available, you can easily install it by running:

`brew install nunogois/brews/snob`

This also means you can upgrade to a new version at any time by running `brew upgrade snob`.

You can check other ways of installing it through the GitHub README. Cloning the repo and building it yourself is always an option as well.

### Setup

Before doing a search, you should set it up with your own [OMDb API](https://www.omdbapi.com/) key by following [these steps](https://www.omdbapi.com/apikey.aspx).

After you have your key, you can set it like this:

`snob -k <your-api-key>`

Then you can do a search, e.g.:

`snob lost ark`

Running `snob` or `snob -h` lists all available commands.

## Final Thoughts

Want to know more about how it was done? 
Check out the [Dev Log post](https://www.nunogois.com/blog/snob-dev-log-4hd0).

I'll try to share more about some of my side projects in the future, so stay tuned for that!

I'll try to prioritise my more recent/relevant projects, or the ones that are most popular/starred - So if you like my work, feel free to engage with it in any way and star it, it's much appreciated.

Thanks for reading!
How do you turn a weakness into a strength?
Tags: discuss
Published: 2022-08-18 15:30:16

Interesting post here:

{% embed https://dev.to/sloan/what-is-your-greatest-weakness-as-a-software-developer-3i8h %}

I had a follow-up question, how do you take something you're not great at and train it to become something you are proficient at?

Have you ever done this?
If you're a programmer, these 10 git commands will save you hours of research🧵👇
Published: 2022-08-18 15:28:19

Pull from remote overwriting local changes.

i) git stash (revert and stash changes locally)
ii) git pull (pull from remote normally)

tip: to retrieve changes, do 'git stash apply'

- Delete only untracked files from working tree
  git clean -f -d

- Unstage files from index (but keep the files locally)
  git rm --cached

- Undo a merge
i) git checkout branch-name
ii) git log --oneline
iii) git revert -m commit-id

- Remove a file from remote
i) git rm filename (remove file from git)
ii) git commit -m "commit message"
iii) git push

- Undo last n commits
git reset --soft HEAD^n (where n is the number of last commits you want to undo)

- See diff between branches
git diff branch_1..branch_2

- Remove a tag from branch
i) git push origin :refs/tags/tagname
ii) git tag -d

- Rename a branch locally & remote
i) git checkout old-branch
ii) git branch -m new-name
iii) git push origin :old-name new-name

- Move existing, uncommitted work to a new branch
git switch -c <new-branch> (git 2.3 onwards)
How to trigger operation after mounting the editor?
Published: 2022-08-18 14:44:05


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/06zfg96bveuygbqy2u3g.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yratw82cno16a69rkm0j.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ak2p4pcd4alk2kojbuj.png)
I want to Pass the data in a text editor called quill editor but I am getting an error while inserting because it I have to do that insertion operation after the editor mounts. Please help.
How to use Ruby on Rails Concerns
Tags: ruby, webdev, rails, bestpractices
Published: 2022-08-18 14:43:36


A Rails concern is a module that extends the `ActiveSupport::Concern` module.

You can use Сoncerns to store common code for several classes there, or for refactoring to separate semantically similar code in separate modules.

A concern provides two blocks:
```ruby
module SampleConcern
  extend ActiveSupport::Concern
  
  included do
    ...
  end
  
  class_methods do
    ...
  end
end
```

## included:
The code inside the included block is evaluated in the context of the including class.

## class_methods:
Here you can implement methods that will become methods of the class to which the container is included.

Let’s look at an example:

## Concern:

```ruby
module AuthenticationConcern
  extend ActiveSupport::Concern
  
  included do
    before_action :authenticate
  end
  
  private
    def authenticate
      if authenticated_user = User.find_by(id: cookies.encrypted[:user_id])
        current_user = authenticated_user
      else
        redirect_to new_session_url
      end
    end
end
```

## Controller:
```ruby
class ApiBaseController < ActionController::Base
  include AuthenticationConcern
  ...
end
```
By using Сoncerns, we have moved the code responsible for user authorization to a separate module.

## Testing
Concerns are also convenient in that they can be tested in isolation instead of covering all classes where the concern is included with tests.
```ruby
require 'rails_helper'
class FakeController < ApplicationController
  include AuthenticationConcern
  
  def new; end
end
RSpec.describe FakeController, type: :controller do    
  context '#new' do
    context 'valid user'  do
      get :new, headers: {token: 'valid_token'}     
      it { expect(response).to have_http_status(:success) }
    end
    
    context 'invalid user' do 
      get :new, headers: {token: 'invalid_token'}
      it { expect(response).to redirect_to(new_session_url) }
    end
  end
end
```
Bash and exclamation marks !!!!
Tags: bash, cheatsheet, terminal, shortcut
Published: 2022-08-18 14:40:33

---
title: Bash and exclamation marks !!!!
published: true
description: Did you knew about exclamation marks in bash ?
tags: bash, cheatsheet, terminal, shortcut
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxb7aoju35vafwy0m5ls.jpg
# Use a ratio of 100:42 for best results.
---

In case you didn't know, exclamation marks play an important role in the bash workflow, especially for your command history!

![Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gh260avy87m5rzw4yhrh.png)

ok... let me explain this weird thing, actually it's simple : 
- The first part of the command will take the first command item from the second most recent command you   wrote, then concatenate to "add" and the second item of the most recent command, `git add second_folder`.
 
- For the second part, it's a substitution command of "status" by "checkout" for the second command that i wrote, in reverse order on my bash history; it will take as arguments, those that i gave to my second command in the same order.
That said, the output of this command will be:
`git checkout second_folder`

**Pretty NEAT right !?**

So let's talk about it, the `!` invokes history expansion, a feature that originally appeared in the C shell, back in the days before you could count on terminals to have arrow keys. It's especially useful if you add the current command number to the prompt `(PS1="\!$ ")` so you can quickly look at your screen to get numbers for past commands.

So, am not going to go deep inside possibilities here but just give some cool cheat-sheets from exclamations marks when you're on your terminal !

This is a pretty short list of the cool ones :
- `!!` run the latest command,
       ```bash
     # Ex :
     $ apt-get update
     $ sudo !!
       ```


- `!-3` run the third command in the reverse order from my bash history; this is also available for positive values such as the first command, from your `~/.bash_history` -> `!1`


- `!*` get arguments passed to the most recent command ran,
       ```bash
     # Ex :
     $ touch filex, test4, example
     $ chmod 777 !*
       ```


- `!ls` to run a command from your history starting with `ls`

With these 4 items, you can basically play/mix around with your bash history and get great stuffs like the one up there with a substitution string.

Thanks for reading, feel free to like and/or subscribe for more 🐼.
Essentialism - Book Notes
Tags: beginners, productivity, career
Published: 2022-08-18 14:39:00

# TL;DR: Read this Book, when… 📔
- You feel that you are doing too much but not getting anything done
- You feel overwhelmed by your duties

# Overview
This book is mainly about pretty simple but useful strategies to ignore the noise and focus on the important things.

# Notes 📝

Essentialism: is the disciplined pursuit of less

**If you don't prioritize your life someone else will**

you need to have the courage to live a life true to yourself, not the life others expect from you

**Process** 🔝
- Explore: The right thing, time, and reason
- Eliminate: Cut off the trivial many
- Execute: Less but better

## Choose 
You have to decide, you need to exercise the power of choice

## Discern 
Certain types of effort yield higher returns than others
## Trade off
Decide which problems you want

# -Explore 👓

## Escape
Create space to explore life, concentrate and read
## Look
Find the essence in the information
## Play
Play sparks exploration
## Sleep
Sleep is key, needed for high performers
## Select
Use narrow criteria, look for the thing where you can make the highest point of contribution

# - Eliminate ❌

## Clarify
Find the purpose, find the **Why**
## Dare
Have the courage to say NO, **we can say no and regret it for a few minutes or days, or we can say yes and regret it for weeks, months, or even years**
## Uncommit
Avoid the sunk-cost bias (giving up even when you lose something is sometimes the best choice)
## Edit
Making things better means subtracting something
## Limit
Boundaries are liberating

# - Execute 🚀

## Buffer 
Build-in buffer for unexpected events
## Subtract 
Remove obstacles to progress
## Progress 
Start small and get big results, **small wins create momentum and affirm our faith in our further success**
## Flow
Routine enables difficult things to become easy (cue, routine, reward)
## Focus
At work do what you enjoy, **In family be completely present**
## Be
Live a life that matters

# - Leadership 👨‍🎤

- Fewer things are done better
- The Mindset is less but way better
- In hiring be selective
- In strategy remove the obstacles and focus on the *WHY*
- Focus on the highest goal and points of contribution

# Conclusion ✍️

Actually few things in life matter, our current society is full of noise and many trivial things, we should strive for a life full of good moments with family, joy, deep work, and enjoy and reconnect with the essential things.
Deploy a .NET 6 Web Application to an Azure App Service by the command line
Tags: azure, programming, webdev, dotnet
Published: 2022-08-18 14:30:48

CI/CD is a good approach to deploy web applications (and not only web applications) but there a lot of reasons for not configuring an entire workflow from the beginning of the project (**disclaimer**: I am a big fan of CI/CD or GitHub Actions or Azure DevOps).

We will use the Azure Command-Line Interface (Az CLI) to create and manage resources on Azure.
If you don't have the Az CLI installed on your machine, you can follow the steps from the official documentation to install it.
It's very easy and you can use the CLI from Windows, Mac or Linux.
This is one of the reasons why I prefer the Az CLI instead of PowerShell.
[Installation Guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli#install)

After the installation you can login on your Azure Tenant with the command:

```
az login
```

## Publish and Zip the application
First of all, we need to publish the application and create a zip file with all the binaries.
Let's do that with the following commands:

```
dotnet publish -o publish
cd .\publish
Compress-Archive . publish.zip
```

> Compress-Archive is a PowerShell command. If you are using the Az CLI from another OS, you can find the right way to create a zip file for folder from the command line.

## Execute the deployment
Now you are ready to deploy the web application with the zip deploy.
From the publish folder, you can launch the following script:

```
az webapp deployment source config-zip --src .\publish.zip -n "appServiceName" -g "resourceGroupName"
```
Remember to replace the appServiceName and the resourceGroupName placeholders with your right values for these two parameters.
If you are using PowerShell you can also create two variables before that line. It's more clear and easier to maintain.

```
$appServiceName = "app_service_name"
$resourceGroupName = "resource_group_name"

az webapp deployment source config-zip --src .\publish.zip -n $appServiceName -g $resourceGroupName

```

If everything works, you see the result of the activities after a while, directly in the console.

![az CLI deploy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsxq68pfp7xtmze0smtf.png)
Top 10 Best Login Form | CSS & JavaScript
Tags: javascript, beginners, webdev, css
Published: 2022-08-18 14:23:29

{% youtube MJqaTVGPU3g %}

***

🏆Top 10 Best Login Form🏆

01 -> 🎬Login & Registration Form Using HTML & CSS & JS✨
👉https://youtu.be/I5_T547tHf0

02 -> 🎬Log In / Sign Up | html & css
👉https://youtu.be/JbWdz88oi90

03 -> 🎬Neumorphism Login Form | HTML & CSS✨
👉https://youtu.be/QWh0S-3D7uY

04 -> 🎬How To Make Login & Registration Form | HTML CSS & Vanilla JavaScript✨
👉https://youtu.be/FtnCieJKAMQ

05 -> 🎬Animated Login Form | HTML, CSS & JavaScript✨
👉https://youtu.be/ogNwc45qHKo

06 -> 🎬Slider Sign In / Sign Up Form | HTML CSS Vanilla JS✨
👉https://youtu.be/Wz5THk0-Y1s

07 ->🦶🏼Multi Step Form With Progress | HTML CSS & JavaScript✨
👉https://youtu.be/ySQB42xQnPU

08 -> 🎬Claymorphism Login Form | HTML & CSS✨
👉https://youtu.be/JwO54kIV1uI

09 -> 🎬Login Form Validation | HTML CSS & Javascript
👉https://youtu.be/svGQe889mmo

10 -> 🎬Input Label Animation | HTML & CSS
👉 https://youtu.be/m4Ybr7OUoEo

***
Java Efetivo Essencial - HashCode()
Tags: java, backend, programming, beginners
Published: 2022-08-18 14:08:00

## Sobrescreva sempre o método Hashcode ao sobrescrever o método equals

_Esta é uma série baseada no entendimento de tópicos relacionados ao livro com foco no resumo._

**Entendendo**

Assim como o método Equals(), o método Hashcode() também é herdado da classe Object.
Esse método é utilizado especialmente em estrutura de dados do Java, como na api de Collections e Map.
Em caso de você sobrescrever o Equals() e não sobrescrever o Hashcode() estará violando o contrato geral do método Hashcode() e implicará no mal funcionamento dessas estruturas de dados no Java.

**Contrato Geral**

Existem algumas regras que devem ser respitadas pelo método Hashcode():

- Sempre que um método hashcode for executado repetidas vezes para o mesmo objeto deve sempre retornar o mesmo valor desde que nenhum dos dados usados no equals seja modificado;
- Se dois objetos forem iguais através do método equals então o método hashcode desses objetos deve retornar o mesmo valor;
- Se dois objetos não forem iguais no método equals(), não é necessário que o resultado do hashcode() seja diferente dos dois, porém é importante o programador entender que resultados diferentes melhora o desempenho de tabelas hash utilizadas nas estrutura de dados do Java;

**Como deveria ser?**

Não é preciso incluir campos do objeto não utilizado no método Equals().
Utilizar a mesma ordem dos campos possibilita uma função hash melhor.
Se calcularmos o Hash na mão o recomendado pelo livro é utilizar um número primo, como no exemplo abaixo:

```java
@Override
public int hashCode() {
  int result = nome.hashCode();
  result = 31 * result + email.hashCode();
  result = 31 * result + nascimento.hashCode();
  return result;
}
```

Existem bibliotecas que realizam o calculo do hash de maneira mais segura, o livro recomenda o Guava do Google e também a da própria classe Objects do Java.
Ele traz apenas um alerta sobre o método da classe Objects em termos de performance.

```java
@Override
public int hashCode() {
    return Objects.hash(nome, email, nascimento);
}
```

Se trabalha com classes Imutáveis uma abordagem seria o armazenamento do hashcode em cache para não ficar recalculando toda vez que o método for utilizado.

**Concluindo**

O livro ressalta a importância de utilizarmos todos os campos que são significativos para identificar o objeto, ou seja, mesmo que sejam muitos devemos manter eles  e garantir que estes sejam presentes.

Entenda que sempre que sobrescrever um método será necessário sobrescrever o outro para que seu programa funcione corretamente.
Obdeça na sobrescrita as regras que esse método deve atender.

Algumas IDEs facilitam isso para o desenvolvedor como é o caso do Intellij que já possui uma opção em conjunto de sobrescrita dos dois itens.
Adding business days to a date using SQL
Tags: sql, database, tutorial
Published: 2022-08-18 14:10:17

Recently I had a task that seemed very simple at first. I had a table with billing start dates and number of business days to bill. The task was to calculate the end date for each row. Basically to calculate the start date + number of business days without having to worry about holidays.

I was surprised that there is no built-in solution for this seemingly common problem. Here is my own take on the problem.

The logic is quite simple:
 - for each 5 working days add an entire calendar week to the starting date
 - after adding the whole weeks add the remaining days (for example adding 8 days means adding 1 week and 3 days)
 - if the resulting date is a Saturday then add 2 more days
 - if the resulting date is a Saturday then add 1 more day

And here is the resulting code:
```
create function addWorkingDays(@startDate datetime, @workingDays int)
returns datetime
as begin
	if @workingDays = 0
		return @startDate

	declare @calendarDays int = 
		(@workingDays / 5) * 7 +  -- add whole weeks 
		(@workingDays % 5) -- add remaining days

	declare @resultDate datetime = dateadd(d, @calendarDays, @startDate)

	declare @dayOfWeek int = ((datepart(DW, @resultdate) - 1) + @@datefirst ) % 7 --the @@datefirst part is needed if you are outside of US where 0 is Monday 

	return case 
		when @dayOfWeek = 0 then --Sunday
			dateadd(d, @calendarDays, @startDate) + 1
		when @dayOfWeek = 6 then -- Saturday
		    dateadd(d, @calendarDays, @startDate) + 2
		else
			dateadd(d, @calendarDays, @startDate)
	end
end
```

The bellow table lists a few test cases:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0cdq3g17cjnd3ffkk16.png)
Choose the Right UI Frameworks for your New React.js App
Tags: react, developer, reactframework
Published: 2022-08-18 14:09:55


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k94bfhnixh1grhqtv7gv.png)
React js is one of the most popular libraries for web development, it ranked on to 40% of the most popular library. It is most popular among developers for native or single-page mobile applications. Infact most popular applications like Netflix, Salesforce, and Reddit, are made using this platform. [This post](https://www.mrlaboratory.info/2022/08/best-ui-frameworks-for-your-new-reactjs.html) discusses some of the best UI frameworks you can use for your new React.js app 

UI in reactjs is time saving as there one doesn't have to create a custom UI, also it is easy to integrate with and helps developers in in managing the content.

**5 Most Popular Framework in Reactjs**

1) Material UI:
2) Ant Design:
3) Semantic UI React
4) Chakra UI:
5) Fluent UI:

These are the most widely accepted Recatjs framework, because they are simple to use. Reactjs is undoubtedly one of the most popular framework among the developers.
[Ruby][Sorbet] How to check RBI file update omission with CI
Tags: sorbet, ruby, rails
Published: 2022-08-20 16:39:41

---
title: [Ruby][Sorbet] How to check RBI file update omission with CI
published: true
date: 2022-08-18 14:04:25 UTC
tags: ["Sorbet", "Ruby", "Rails"]
canonical_url: https://note.hiko1129.com/posts/1660831465/
---

<a href="https://note-hiko1129-com.translate.goog/posts/1660831465/?_x_tr_sl=ja&_x_tr_tl=en&_x_tr_hl=ja&_x_tr_pto=wapp" target="_blank" rel=”noopener noreferrer”>Translate ja to en</a>

tapiocaに関しては--verifyオプションが用意されているのでそれを利用する

```
bin/tapioca gems --verify
bin/tapioca dsl --verify
```

sorbet-railsに関してはtapiocaのようなオプションが用意されていないようなので下記の感じで差分があるか確認する
```
bin/rails db:schema:load # ridgepoleを使っている場合にはridgepole --applyを。
bundle exec rake rails_rbi:all
git diff --exit-code --quiet
```

実際のところ現状だと各RBIのコンフリクト解消が関わってくるので自分は下記のような感じで対応しています
```
bundle exec srb rbi sorbet-typed
bin/rails db:schema:load
bin/rails rails_rbi:all
bin/tapioca gem --workers=8
bin/tapioca todo
bundle exec srb rbi suggest-typed # コンフリクト解消をここで行ってから差分がでないことを確認する。こうしないとコンフリクト解消前の状態とコンフリクト解消後の状態の比較になってしまい差分が頻繁に発生する状態になってしまいほぼ常にCIで引っかかる状態になってしまう

git diff --exit-code --quiet
if [ $? -ne 0 ]; then
    echo "Please resolve the difference of RBI files"
    exit 1
fi
```

参考:
* https://github.com/Shopify/tapioca#keeping-rbi-files-for-gems-up-to-date
* https://github.com/Shopify/tapioca#keeping-rbi-files-for-dsls-up-to-date
Refactoring to Configurable Dependency in 5 Steps
Tags: hexagonalarchitectur, programming, cleanarchitecture, dependencyinjection
Published: 2022-12-03 14:51:54

---
title: Refactoring to Configurable Dependency in 5 Steps
published: true
date: 2022-08-18 13:33:50 UTC
tags: hexagonalarchitectur,programming,cleanarchitecture,dependencyinjection
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2600/0*BDPeblYOSqBl5Vyf)](https://bertilmuth.medium.com/refactoring-to-configurable-dependency-in-5-steps-4b3077ac0e26?source=rss-a74297325869------2)

Configurable Dependency, a.k.a. Dependency Injection, is a pattern that enables you to switch dependencies of your application. The term…

[Continue reading on Medium »](https://bertilmuth.medium.com/refactoring-to-configurable-dependency-in-5-steps-4b3077ac0e26?source=rss-a74297325869------2)