Alex Troush - IEx Cheat Sheet
-
Upload
elixir-meetup -
Category
Technology
-
view
24 -
download
1
Transcript of Alex Troush - IEx Cheat Sheet
IEx Cheat Sheet
@troush69 | github.com/Troush
Presentation.Supervisor.start_link(self(), {:slide, 1})
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
Starting IEx
IEx.Server.start
“ctrl+c”
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
Ctrl + g
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)
.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.
.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)>
Configuring the shell
No limit on IO.inspect
IEx.configure [inspect: [limit: :infinity]]
IEx Helpers
h Module
h Module.fn/arity
I “Hello”
v(n \\ -1)Returns the value of the nth expression in the history.
e Module
IEx.pry()
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.
respawnRespawns the current shell by starting a new shell process.
Returns true if it worked.
Debugging Phoenix
Views
Debugging Phoenix
Templates
Debugging Phoenix
Tests
Don’t forget to run your test suite with:
iex -S mix test --trace
remsh
Remsh ctrl+G
epmdErlang Port Mapper Daemon
Questions?