Skip to content

Instantly share code, notes, and snippets.

View noelworden's full-sized avatar

Noel Worden noelworden

View GitHub Profile
@noelworden
noelworden / test_envs_07.ex
Created October 1, 2025 22:10
#blog_snippets
defp set_other_secret(_) do
original_config = Application.get_env(:my_app, MyApp.Example)
hash = generate_fake_hash()
updated_config = Keyword.put(original_config, :other_secret, hash)
Application.put_env(:my_app, MyApp.Example, updated_config)
on_exit(fn ->
Application.put_env(:my_app, MyApp.Example, original_config)
end)
@noelworden
noelworden / test_envs_06.ex
Last active October 1, 2025 22:11
#blog_snippets
[other_secret: "original_secret"]
@noelworden
noelworden / test_envs_05.ex
Created October 1, 2025 22:07
#blog_snippets
Application.put_env(:my_app, MyApp.Example, other_secret: original_secret)
@noelworden
noelworden / test_envs_04.ex
Created October 1, 2025 22:07
#blog_snippets
defp set_other_secret(_) do
original_secret = Application.get_env(:my_app, MyApp.Example)[:other_secret]
hash = fake_hash()
Application.put_env(:my_app, MyApp.Example, other_secret: hash)
on_exit(fn ->
Application.put_env(:my_app, MyApp.Example, other_secret: original_secret)
end)
{:ok, other_secret: hash}
@noelworden
noelworden / test_envs_03.ex
Created October 1, 2025 22:05
#blog_snippets
[other_secret: "original_secret"]
@noelworden
noelworden / test_envs_02.ex
Created October 1, 2025 21:36
#blog_snippets
@config Application.compile_env(:my_app, MyApp.Example)
@api_key @config[:api_key]
@base_url @config[:base_url]
@noelworden
noelworden / test_envs_01.ex
Last active October 1, 2025 22:13
#blog_snippets
config :my_app, MyApp.Example,
api_key: env!("EXAMPLE_API_KEY", :string, ""),
hook_secret: env!("EXAMPLE_HOOK_SECRET", :string, ""),
verification_secret: env!("EXAMPLE_VERIFICATION_SECRET", :string, ""),
base_url: "https://myapp.api.example.com"
@noelworden
noelworden / prying_debugging.md
Last active February 18, 2021 22:08
#helpers
@noelworden
noelworden / column_data07.ex
Created November 30, 2020 23:43
#blog_snippets
Mapping.create_destination()
@noelworden
noelworden / seed_command
Last active November 30, 2020 23:30
#blog_snippets
docker-compose web mix run priv/repo/seeds.exs