Skip to content

Instantly share code, notes, and snippets.

@dinhhuydh
Last active October 18, 2022 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinhhuydh/0abec3aa1c58acfe45e943b191f97388 to your computer and use it in GitHub Desktop.
Save dinhhuydh/0abec3aa1c58acfe45e943b191f97388 to your computer and use it in GitHub Desktop.
Scripts and note on Elixir
# 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