Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Alex Troush - IEx Cheat Sheet

161 views

Published on

Elixir Club Ternopil - March 25, 2017
Friendly Restoration "Mamont"

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Alex Troush - IEx Cheat Sheet

  1. 1. IEx Cheat Sheet @troush69 | github.com/Troush Presentation.Supervisor.start_link(self(), {:slide, 1})
  2. 2. Alex ~8 Commits to Elixir Core ~1 Commit to Phoenix.HTML ~2 Commits to Ecto 10 month of production Phoenix ~ 2 year of Elixir lurking
  3. 3. Starting IEx
  4. 4. IEx.Server.start
  5. 5. “ctrl+c”
  6. 6. Ctrl + c menu actually `erl` shell menu ● (a)bort - abort interactive mode. Eg: Exit ● (c)ontinue - continue interactive mode ● (p)roc info - get processes information ● (i)nfo - get Erlang runtime information ● (l)oaded – list of loaded modules to current shell ● (v)ersion – version of `erl` ● (k)ill – kill process menu ● (D)b-tables - get info about d/ets avaible in current shell ● (d)istribution - distribution info
  7. 7. Ctrl + g
  8. 8. Ctrl- What I didn’t know is that you can exit the shell by sending Ctrl-. The shell will exit immediately. As far as I know, it has the same effect as aborting the shell in the Break command, it doesn’t affect remote nodes and it also works outside of iex (for example, you can use to terminate your tests)
  9. 9. .iex.exs Every time IEx starts it will look for a .iex.exs configuration file. If it’s not present in the current directory, then the user’s home directory (~/.iex.exs) will be used as the fallback.
  10. 10. .iex.exs 1 IO.puts "Hello, World" $ iex Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] Interactive Elixir (1.4.0) - press Ctrl+C to exit (type h() ENTER for help) Hello, World iex(1)>
  11. 11. Configuring the shell
  12. 12. No limit on IO.inspect IEx.configure [inspect: [limit: :infinity]]
  13. 13. IEx Helpers
  14. 14. h Module
  15. 15. h Module.fn/arity
  16. 16. I “Hello”
  17. 17. v(n -1) Returns the value of the nth expression in the history.
  18. 18. e Module
  19. 19. IEx.pry()
  20. 20. r(module) Recompiles and reloads the given module. Please note that all the modules defined in the same file as module are recompiled and reloaded.
  21. 21. respawn Respawns the current shell by starting a new shell process. Returns true if it worked.
  22. 22. Debugging Phoenix Views
  23. 23. Debugging Phoenix Templates
  24. 24. Debugging Phoenix Tests Don’t forget to run your test suite with: iex -S mix test --trace
  25. 25. remsh
  26. 26. Remsh ctrl+G
  27. 27. epmd Erlang Port Mapper Daemon
  28. 28. Questions?

×