Inertiajs Adapter for Phoenix

Just released a Phoenix adapter for Inertiajs (The Modern Monolith):

https://github.com/devato/inertia_phoenix

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.

inner_cotton v0.6.0

inner_cotton is a set of static analysis of Elixir codes, and a set of mix tasks to help initializing and maintaining OSS/production codes.

https://hex.pm/packages/inner_cotton/0.6.0

Changes in v0.6.0 are :

  • Support Elixir 1.10
  • Drop Support Elixir 1.8 (It may work but not supported.)
  • rrrene/inch_ex returns
  • Moves Travis CI from mix cotton.init to mix cotton.init.travisci
  • Supports GitHub Action in mix cotton.init.github
  • Supports GitLab CI in mix cotton.init.gitlab
  • Remove fast_yaml dependency
  • Update deps

Adventures in Ecto and PostgreSQL: Partial unique indexes and upserts with associations

Article about pitfalls when handling partial unique indexes and upserts with Ecto. And dog politics.

https://medium.com/@woylie/adventures-in-ecto-and-postgresql-partial-unique-indexes-and-upserts-with-associations-ccf20114dfa1

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.

Complex Unique Constraints with PostgreSQL Triggers in Ecto

http://johnwilger.com/2020/02/16/ecto-custom-unique-constraint-trigger.html

I recently needed to enforce a database constraint similar in spirit to a unique index, however the criteria for what should be considered “unique” was more complex than what a simple unique index in PostgreSQL would be able to deal with. Knowing that Ecto’s unique constraint validation works by intercepting an error raised by the database, I set out to see if I could implement the complex unique constraint logic in the database and still be able to use the Ecto.Changeset.unique_constraint/3 validation without needing to modify any Elixir code.

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

https://github.com/boydm/phoenix_integration

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

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.

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.

https://keathley.io/blog/reusable-libraries.html

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

Changelog:

  • 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/2 that 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!

Podcast Episode