Simple Phoenix LiveView App: Socket Session info, CSRF & .leex
Part 4 of the Simple Phoenix LiveView App series. This episode covers three things:
- Pass connection info to our socket in endpoint.ex
- Set up CSRF tokens for use with LiveView via sockets
- Convert the embedded ~L template in our LiveView render function to a separate .leex file
https://alchemist.camp/episodes/phoenix-live-view-socket-csrf
phoenix_integration 0.8.0 pre-release
Have just merged in a great PR by @marick into phoenix_integration, which much improves form testing. Am going to leave it in master for a week before pushing to hex, so let me/us know if there is any feedback. This bumps the version to 0.8.0
ElixirConf EU 30 speakers and training announced
ElixirConf EU 30 speakers and training all live and early bird open. New website too and its hosted on github, any ideas on anything you’d like to see added? https://www.elixirconf.eu/
Elixir Wizards S3E12 - Sean Lewis from Divvy on Performance and Hiring
Latest episode of the Elixir Wizards podcast out today! Check it out here: https://podcast.smartlogic.io/s3e12-divvy
ExARI: An Elixir Library for interfacing with Asterisk the Open Source Communications Software using ARI
ARI stands for Asterisk REST Interface. It provides a REST and websocket interface for controlling an Asterisk server. Check out the Elixir Forum post at https://elixirforum.com/t/exari-an-elixir-library-for-interfacing-with-asterisk-the-open-source-communications-software-using-ari/29077 #asterisk #voip #myelixirstatus
Skogsrå: Simplifying Your Elixir Configuration
Once an Elixir project is large enough, maintaining config files and config variables becomes a nightmare.
This blog post shows the basics of using Skogsra to simplify your Elixir project’s configuration:
https://dev.to/alexdesousa/skogsra-simplifying-your-elixir-configuration-35im
Easy Authentication in Elixir & Phoenix with the pow & pow_assent libraries
Learn how quick & easy setting up authentication can be with @danschultzer‘s pow & pow_assent libraries.
Screencast
Using Phoenix Presence in LiveView |> A Simple Example
In this post of Real World Phoenix I discover how easy it can be to incorporate Phoenix Presence inside LiveView
https://realworldphoenix.com/blog/2020-02-11/simple_phoenix_presence
Turns ABNF into parser https://github.com/princemaple/abnf_parsec
Made this little thing, if anyone finds it useful
ABNF in, parser out https://github.com/princemaple/abnf_parsec
- Brevity - flattens unnecessary nesting in parsed ABNF
- Easy to config and customzie
- Full test coverage
Make your stateful library easier to use
In my ongoing quest to convince people to stop using Application env so much, I decided to write about one of the patterns I use for making “stateful” libraries (libraries that provide processes, ets tables, etc.) more configurable and reusable.
Hades - A wrapper for NMAP written in Elixir
https://github.com/fklement/hades/tree/0.0.1-alpha
Example
Simple ping scan
The snippet below ping scans the network, and lists the target machine if it responds to ping.
iex> Hades.new_command()
...> |> Hades.add_argument(Hades.Arguments.ScanTechniques.arg_sP())
...> |> Hades.add_target("192.168.120.42")
...> |> Hades.scan()
12:19:25.739 [info] NMAP Output: "Starting Nmap 7.80 ( https://nmap.org ) at 2020-02-07 12:19 CET\n"
12:19:25.788 [info] NMAP Output: "Nmap scan report for Felix-MACNCHEESEPRO.root.box (192.168.120.42)\nHost is up (0.00045s latency).\n"
12:19:25.788 [info] NMAP Output: "Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds\n"
12:19:25.789 [info] Port exit: :exit_status: 0
12:19:25.789 [info] EXIT
12:19:25.790 [info] DOWN message from port: #Port<0.14>
%{
hosts: [
%{hostname: "Felix-MACNCHEESEPRO.root.box", ip: "192.168.120.42", ports: []}
],
time: %{
elapsed: 0.06,
endstr: "Fri Feb 7 12:19:25 2020",
startstr: "Fri Feb 7 12:19:25 2020",
unix: 1581074365
}
}
Schoolbus - Manage one or more PubSub instances using the Elixir registry
https://github.com/rupurt/schoolbus
Start the bus
iex(1)> {:ok, _bus} = Schoolbus.start_link([])
{:ok, #PID<0.212.0>}
Register a topic
iex(2)> Schoolbus.register(:games)
:ok
Register a namespaced topic
iex(3)> Schoolbus.register({:songs, :diplo})
:ok
iex(4)> Schoolbus.register({:songs, :tiesto})
:ok
Subscribe to a registered topic
iex(3)> Schoolbus.subscribers()
[]
iex(4)> Schoolbus.subscribe(:games)
{:ok, [:games]}
iex(5)> self()
#PID<0.208.0>
iex(6)> Schoolbus.subscribers()
[games: #PID<0.208.0>]
Subscribe to all topics within a namespace
iex(7)> Schoolbus.subscribers()
[games: #PID<0.208.0>]
iex(8)> Schoolbus.subscribe({:songs, "*"})
{:ok, [songs: :diplo, songs: :tiesto]}
iex(9)> self()
#PID<0.208.0>
iex(10)> Schoolbus.subscribers()
[
{{:songs, :tiesto}, #PID<0.208.0>},
{{:songs, :diplo}, #PID<0.208.0>},
{:games, #PID<0.208.0>}
]
Broadcast a topic to all subscribers
iex(11)> flush
:ok
iex(12)> Schoolbus.broadcast(:games, :uno)
:ok
iex(13)> flush
:uno
:ok
10 Killer Elixir Tips —#10
https://elixir-tips.blackode.in/2020/02/06/killer-elixir-tips-10.html
You Can also find this article on MEDIUM
Escalate your Elixir with this collection of Coding Tips.
Happy Coding
Elixir Wizards S3E11 - Paul Schoenfelder and Hans Elias Josephsen on Lumen and Performance
Episode 11 of Elixir Wizards out today! Check it out: https://podcast.smartlogic.io/s3e11-lumen
DateTimeParser 1.0.0 released
https://hexdocs.pm/date_time_parser
https://github.com/taxjar/date_time_parser
- No longer converts to UTC. Converting to UTC too early could be bad. Options still available.
- No longer assumes date or time. No information is better than bad information. Options still available.
- Added bang variants
-
Added
parse/2that will return best match. - Fixed bugs
- Calling it stable.
ElixirMix Podcast 087: Zip Generation using Packmatic with Evadne Wu
In this episode of ElixirMix, we talk with Evadne Wu about the Packmatic library. Packmatic supports zipping streams on the fly for improved performance and UX. We cover streams, Zip64, supporting a public library, and much more!
Monitoring the Erlang VM With AppSignal's Magic Dashboard
Walk through monitoring the Erlang VM with the metrics automatically shown in AppSignal’s Magic Dashboard - https://blog.appsignal.com/2020/02/04/elixir-monitoring-erlangvm-with-magic-dashboards.html
gen_rmq 2.4.0 version release (with Telemetry support)
GenRMQ is a set of behaviours meant to be used to create RabbitMQ consumers and publishers.
- Add telemetry support - https://github.com/meltwater/gen_rmq#telemetry
- Refactor consumer settings
- Give the possibility to override all metadata fields
IntelliJ Elixir v11.5.0
Enhancements
-
Ignore the
incompleteCodeflag and instead always use the criteria used whenincompleteCodewas set.name prefix exact name ResolveResult valid ❌ N/A ❌ N/A ✅ ❌ ✅ ❌ ✅ ✅ ✅ ✅ This extends #1617 to more cases.
-
Qualified calls (
Process.flag(…), etc) -
Type specs (
@spec foo(…)) -
Aliases (
alias Foo…) -
Module Attributes (
@attribute) -
Variables (
foo) -
Protocolreserved module attributes (@protocoland@for)
-
Qualified calls (
Bug Fixes
- Fix debugger evaluator for Elixir >= 1.9.2. Ports elixir-lang/elixir@7002554.
Trans has been updated to 2.2.0
Trans, the small library for embedded translations in Elixir schemas has been updated to 2.2.0.
The main change in this new version is that Trans.Translator.translate/3 can now receive a string, allowing us to use the output of Gettext.get_locale/0. For example, we can now write:
Trans.Translator.translate(Article, :title, Gettext.get_locale())
This release also removes Faker as a dependency, updates ExDoc and removes support for Elixir versions older than 1.6 (which are not officially supported by the core team anymore).
You can see the release notes on GitHub or fetch the new version from hex.pm.
