This file contains hidden or 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 Zipper do | |
| defstruct node: nil, focus: [] | |
| @type t :: %__MODULE__{node: BinTree.t(), focus: list({:left | :right, BinTree.t()})} | |
| @doc """ | |
| Get a zipper focused on the root node. | |
| """ | |
| @spec from_tree(BinTree.t()) :: Zipper.t() | |
| def from_tree(bin_tree), do: %__MODULE__{node: bin_tree} |
This file contains hidden or 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
| { | |
| "iex": { | |
| "prefix": "iex", | |
| "body": "require IEx;IEx.pry", | |
| "description": "put iex for debug" | |
| }, | |
| "inspect": { | |
| "prefix": "insp", | |
| "body": "|> IO.inspect()", | |
| "description": "put iex for debug" |
This file contains hidden or 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 MyDecoder do | |
| use Bitwise | |
| def decode_email(encoded) do | |
| r = | |
| encoded | |
| |> String.slice(0..1) | |
| |> Integer.parse(16) | |
| |> elem(0) | |
| :lists.seq(2, String.length(encoded) - 2, 2) |
This file contains hidden or 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
| document.addEventListener('DOMContentLoaded', () => document.querySelectorAll('.alert').forEach((alert) => | |
| alert.addEventListener('click', (_) => alert.style.display = "none"))); |
This file contains hidden or 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
| #!/bin/bash | |
| readonly BKP_TIME_STAMP=$(date +"%Y-%m-%d") | |
| readonly BKP_PATH_NAME=bkp-$BKP_TIME_STAMP | |
| readonly RECIPIENT_MAIL="rm85297@fiap.com.br" | |
| function check_mysql_config_file() { | |
| if [[ ! -f ./.my.cnf ]] | |
| then | |
| echo "Arquivo configuração do mysql não existe" |
This file contains hidden or 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
| [Unit] | |
| Description=Caddy HTTP/2 web server | |
| Documentation=https://caddyserver.com/docs | |
| After=network-online.target | |
| Wants=network-online.target | |
| [Service] | |
| Restart=on-failure | |
| StartLimitInterval=86400 | |
| StartLimitBurst=5 |
This file contains hidden or 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
| [Unit] | |
| Description=Inlets Server Service | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| Restart=always | |
| RestartSec=1 | |
| StartLimitInterval=0 | |
| EnvironmentFile=/etc/default/inlets |
This file contains hidden or 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
| [Unit] | |
| Description=Inlets Client Service | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| Restart=always | |
| RestartSec=1 | |
| StartLimitInterval=0 | |
| EnvironmentFile=/etc/default/inlets |
This file contains hidden or 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
| <img data-defer-src=""> | |
| (function () { | |
| var Elp = Element.prototype; | |
| var observer = new IntersectionObserver(function (entries, observer) { | |
| entries.forEach(function (entry) { | |
| if (!entry.target || entry.target.tagName.toUpperCase() !== 'IMG') { | |
| return; |
This file contains hidden or 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 MyApp.Repo do | |
| use Ecto.Repo, | |
| otp_app: :my_app, | |
| adapter: Ecto.Adapters.Postgres | |
| def unload(_, _, cardinality \\ :one) | |
| def unload(struct, fields, cardinality) when is_list(fields) do | |
| Enum.reduce(fields, struct, fn field, struct_acc -> | |
| unload(struct_acc, field, cardinality) |