Last active
October 18, 2022 07:51
-
-
Save dinhhuydh/0abec3aa1c58acfe45e943b191f97388 to your computer and use it in GitHub Desktop.
Scripts and note on Elixir
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
# Explain Ecto Query | |
Repo.explain(:all, Analytics.Queries.conversations_created_between(1, start_date, end_date)) | |
# Disable spam log when playing `iex -S mix`. Set config in config/dev.secret.exs | |
config :logger, | |
level: String.to_atom(System.get_env("LOG_LEVEL", "debug")), | |
console: [format: "[$level] $message\n"] | |
# Then run the command | |
LOG_LEVEL=warning iex -S mix | |
# Run mix dialyzer without halting, compact output to fix | |
mix dialyzer --ignore-exit-status --format short | |
# Get time zone abbreviation | |
{:ok, %{zone_abbr: zone_abbr} } = DateTime.now("Europe/Copenhagen", Tzdata.TimeZoneDatabase) | |
# Time now with timezone | |
DateTime.now("Europe/Copenhagen", Tzdata.TimeZoneDatabase) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment