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 MyApp.Accounts do | |
# (...) | |
@spec sign_up(params :: %{String.t() => String.t()}) :: | |
{:ok, User.t()} | {:error, Ecto.Changeset.t()} | |
def sign_up(%{} = params) do | |
# Here, a list of params and their types | |
params_schema = %{ | |
name: :string, | |
# (...) |
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
var SlotMachine = (function () { | |
//prettier-ignore | |
var invalidBetError = new Error("Bet should be a number between 1 and 10"); | |
/** | |
* @params params Object { maxRounds: number, maxWins: number } | |
*/ | |
var SlotMachine = function (params) { | |
var winCount = 0; | |
var roundCount = 0; |
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 MyApp.Accounts do | |
# (...) | |
def sign_up(%{} = params) do | |
params_schema = %{ | |
name: :string, | |
email: :string, | |
phone: :string, | |
password: :string | |
} |
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 MyApp.Accounts do | |
import Ecto.Changeset | |
def sign_up(%{} = params) do | |
params_schema = %{ | |
name: :string, | |
email: :string, | |
phone: :string, | |
password: :string | |
} |
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
const change = (payment, coins) => { | |
let _change = {}, | |
remaining = payment; | |
for (let i = 0; i < coins.sort((x, y) => (x < y ? 1 : -1)).length; i++) { | |
const coin = coins[i]; | |
console.log({ coin }); | |
_change[`${coin}`] = Math.floor(remaining / coin); |
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
#!/usr/bin/env bash | |
rm_old_branches() { | |
# rm_old_branches | |
# | |
# Quo corporis ea tempore quisquam ducimus. At tempore nemo qui et distinctio | |
# consectetur quia quaerat. Et quia aliquam ad sed aut libero. | |
# | |
# Non deleniti eligendi est explicabo harum qui. Consequatur et assumenda | |
# aperiam eligendi ut error odit aut. In ut dolores nobis harum facilis vero |
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
# Snippet provided by the Slab Engineering Team | |
input = [ | |
%{"text" => "One", "indent" => 0, "type" => "ordered"}, | |
%{"text" => "Two", "indent" => 0, "type" => "ordered"}, | |
%{"text" => "Alpha", "indent" => 1, "type" => "bullet"}, | |
%{"text" => "Beta", "indent" => 1, "type" => "bullet"}, | |
%{"text" => "I", "indent" => 2, "type" => "ordered"}, | |
%{"text" => "II", "indent" => 2, "type" => "ordered"}, | |
%{"text" => "Three", "indent" => 0, "type" => "ordered"} | |
] |
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
# #!/usr/bin/env sh | |
# https://dragoshmocrii.com/fix-vscode-elixirls-intellisense-for-code-imported-with-use/ | |
function elixirls_update() { | |
if ! ls "${HOME}/.vscode/extensions" | grep "^jakebecker.elixir-ls"; then | |
echo "Aborting operation - extension not installed." | |
else | |
local extension_dirname="$(ls -1 ${HOME}/.vscode/extensions | grep '^jakebecker.elixir-ls' | head -n 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
function number-only() { | |
if test ! -t 0; then | |
strlen "$(</dev/stdin)" | |
else | |
echo -n $@ | | |
xargs | | |
sed -E "s/[^0-9]+//g" | |
fi | |
} |
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 Sorteio do | |
@moduledoc false | |
@people """ | |
Fernando Collor | |
Fernando Henrique Cardoso | |
Luiz da Silva | |
""" | |
def people do |
NewerOlder