alex troush - iex cheat sheet. guide to win with iex on your day to day job
TRANSCRIPT
![Page 1: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/1.jpg)
IEx Cheat Sheet
@troush69 | github.com/Troush
![Page 2: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/2.jpg)
Presentation.Supervisor.start_link(self(), {:slide, 1})
![Page 3: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/3.jpg)
Starting IEx 1 iex 2 3 iex -S mix #Starting IEx in the context of your app
![Page 4: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/4.jpg)
1 iex(1)> sum = fn (a, b) -> 2 ...(1)> c + b 3 BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded 4 (v)ersion (k)ill (D)b-tables (d)istribution
“ctrl+c”
![Page 5: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/5.jpg)
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
![Page 6: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/6.jpg)
Ctrl + g 1 User switch command 2 --> s 'Elixir.IEx' 3 --> c 4 5 6 User switch command 7 --> c 1
![Page 7: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/7.jpg)
Ctrl + g
● c [nn] - connect to job● i [nn] - interrupt job● k [nn] - kill job● j - list all jobs● s [shell] - start local shell● r [node [shell]] - start remote shell● q - quit erlang● ? | h - this message
![Page 8: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/8.jpg)
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)
![Page 9: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/9.jpg)
.iex.ex
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.
![Page 10: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/10.jpg)
.iex.ex
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)>
![Page 11: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/11.jpg)
Configuring the shell
![Page 12: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/12.jpg)
![Page 13: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/13.jpg)
No limit on IO.inspect
IEx.configure [inspect: [limit: :infinity]]
![Page 14: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/14.jpg)
IEx Helpers
![Page 15: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/15.jpg)
h Module
![Page 16: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/16.jpg)
h Module.fn/arity
![Page 17: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/17.jpg)
v(n \\ -1)Returns the value of the nth expression in the history.
![Page 18: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/18.jpg)
IEx.pry()
![Page 19: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/19.jpg)
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.
![Page 20: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/20.jpg)
respawnRespawns the current shell by starting a new shell process.
Returns true if it worked.
![Page 21: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/21.jpg)
Debugging Phoenix
Views
![Page 22: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/22.jpg)
Debugging Phoenix
Templates
![Page 23: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/23.jpg)
Debugging Phoenix
Tests
Don’t forget to run your test suite with:
iex -S mix test --trace
![Page 24: Alex Troush - IEx Cheat Sheet. Guide to Win with IEx on your Day to Day Job](https://reader030.vdocuments.net/reader030/viewer/2022021507/58e4e6891a28ab87378b4f4b/html5/thumbnails/24.jpg)
Questions?