wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoload -Uz vcs_info | |
precmd() { vcs_info } | |
zstyle ':vcs_info:git:*' formats '%b ' | |
setopt PROMPT_SUBST | |
PS1='%F{green}@%n%f %F{blue}%1d%f %F{cyan}${vcs_info_msg_0_}%f | |
$ ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
PS1='\[\033[01;32m\]@\u\[\033[00m\] \[\033[01;34m\]\W\[\033[00m\]\[\033[01;36m\]$(parse_git_branch)\[\033[00m\]\n$ ' | |
# Don't forget | |
# $ source ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A solução que consegui encontrar para `setState() called after dispose()` foi justamente validar usando `mounted`. | |
Pelo que pesquisei já foi até sugestão de issue o setState checar o `mounted` por default. https://github.com/flutter/flutter/issues/107070 | |
Em um app com multiplas telas dados são carregados assincronamente, em alguns casos widgets estão fechados(unmounted - fora da árvore de widgets) | |
antes dos dados serem carregados completamente. Se um `setState` é executado em um `widget` que não está mais na tela teremos um erro. | |
Pode ocorrer de fluxos de outros widgets não apresentem erro. Entretanto não deixar um check para o `mounted` | |
deixa esse potencial ponto de falha em um widget que pode ser usado em várias partes do App. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Ab do | |
def abs(x) when x < 0, do: x * -1 | |
def abs(x), do: x | |
end | |
defmodule Solution do | |
IO.read(:all) | |
|> String.split | |
|> Enum.map(&String.to_integer/1) | |
|> Enum.map(&Ab.abs/1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Arr do | |
def count(arr) do | |
c(arr, 0) | |
end | |
def c([_ | tail], acc) do | |
c(tail, acc + 1) | |
end | |
def c([], acc) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I miss interpreted the function, but the outcome was cool | |
defmodule ListUtil do | |
def su(list) do | |
sum(list, 0) | |
end | |
def sum([head | tail], acc) do | |
sum(tail, head + acc) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ListUtil do | |
def invert([head | tail], acc) do | |
invert(tail, [head | acc]) | |
end | |
def invert([], acc) do | |
acc | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Solution do | |
IO.read(:all) | |
|> String.to_integer | |
|> (&(Range.new(1, &1))).() | |
|> Enum.to_list | |
|> IO.inspect | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Solution do | |
IO.read(:all) | |
|> String.split | |
|> Enum.drop_every(2) | |
|> Enum.each(&IO.puts/1) | |
end |
NewerOlder