What Elixir related stuff are you doing?

Working on a library that turns ExUnit test cases and their tags into markdown documentation to use with ExDoc. It parses the ast and build up an intermediate representation to output as json/markdown/?. https://github.com/Ch4s3/bartleby

2 Likes

Hah, that looks cool, you should post it in its own thread when it gets docs and published! :slight_smile:

1 Like

Yeah I intend to. It’s basically a tool for satisfying some client requirements for “compliance” in the health space, but other folks might find it useful.

1 Like

Today I investigated how unreadable code would get when @/1 were overridden… :smiling_imp:

EDIT:

defmodule Foo do
  defmacro @(ast) do
    IO.inspect(ast)
    case ast do
      {:@, _, [{name, _, arg}]} ->
        IO.inspect(name);
        quote bind_quoted: [name: name, arg: arg] do
          case arg do
            nil -> IO.inspect("So, you like Super Attribute #{name}, dontcha?")
            [val] -> IO.inspect("Super Attribute #{name} now contains #{val}!")
            others -> IO.inspect("Super Attribute #{name} get all these things: #{inspect(others)}")
          end
        end
      _ ->
        quote do Kernel.@(unquote(ast)) end
    end
  end
end
import Foo
import Kernel, except: [@: 1]

@@foo
@@bar 1
@@baz 2, 3, 5
@thingy 3

Or even better:

defmodule AtAt do
  defmacro __using__(_opts) do
    quote do
      import AtAt
      import Kernel, except: [@: 1]
    end
  end


  defmacro @(val) do
    case val do
      {:@, _, [{name, context, args}]} ->
        {count, inner} = count_ats({name, context, args}, 2)
        quote bind_quoted: [count: count, inner: inner, escaped_inner: Macro.escape(inner)] do
          IO.inspect("Wow! Running #{Macro.to_string(escaped_inner)} with #{count} ats!")
          inner
        end
      _ -> quote do Kernel.@(unquote(val)) end
    end
  end

  defp count_ats({:@, _, [{name, context, args}]}, accum) do
    count_ats({name, context, args}, accum + 1)
  end
  defp count_ats(other, accum) do
    {accum, other}
  end
end
iex> use AtAt
iex> @@@@@@@@@@@@@@@@@@@@@@@@@@self()
"Wow! Running self() with 26 ats!"
#PID<0.85.0>
3 Likes

I’ve just finished Elixir in Action :003: (after reading 50% of Programming Elixir) - definitely feel like I have a fairly good overview of Elixir now.

I’m not sure whether to finish Programming Elixir next, or start Programming Phoenix (or maybe read them together?) - I’m itching to get a Phoenix done… but not sure whether I should wait for the book to be updated for 1.3 (/contexts etc).

Any suggestions? :101:

1 Like

I read part 1 and 2 of Programming Elixir, it is a good book when you are interested in a good prose and are available to learn in a slow pace, it is great for the exercises, but I think that now the Starting Guide from https://elixir-lang.org is enough. I’m now reading Programming Phoenix and Learn You Some Erlang for the Great Good, and after that Elixir in Action and Designing for Scalability with Erlang/OTP (O’Reilly), so I think that start Programming Phoenix would be a good choose.

1 Like

I am probably going to leave any Erlang-specific learning till last (Saša has years of Erlang experience so you definitely get that point of view in Elixir in Action).

I might continue with PE for now then, and see if we hear anymore of when Programming Phoenix might get updated… :slight_smile:

1 Like

Just go for it. That update might take a while and don’t sweat the context stuff - while Phoenix may have tooling that relates to “contexts” - these type of tools cannot choose the right boundaries for you - that is still on you and for that you need practice and lots of time to think (Hammock time).

Just slow the pace a bit and cross-reference everything you run into in the official docs and guides - you’ll probably also run into useful stuff that doesn’t fit in the book.

Hmm… , I wonder if there might be a place where you can ask questions about Phoenix 1.3 when the book doesn’t make any sense …

5 Likes

That does worry me a bit tbh - I am a ‘lazy learner’, which is why I love books (esp from publishers like Pragprog where they are continually updated) because I can just read them and by the end of it I am in possession of a good up-to-date overview - a la Matrix :lol:

Are there many things out of date in the current version of Programming Phoenix?

Well I’m not the best one to answer that question but to put things in context (there is that word again):

  • The book as it stands now will work the smoothest with 1.1.6 (2016-06-03) (through 1.1.9 (2017-05-15) may work as well).
  • Meanwhile 1.2.0 released 2016-06-23 - so if you were using the latest version even back then there were some kinks to work out.
  • I seem recall that Chris proclaimed in a number of talks that 1.3 isn’t that different from 1.2 (though he may have just been referring to the directory structure).

Also if I’m assessing your development background correctly, there is a chance that you may find the current incarnation of the book less jarring (especially if you slavishly stick to 1.1.6) as the first half of the book is pretty much in your typical “lets build a simple web application” style with all the usual trappings of setting up routing, controllers, etc. - it’s only in the second part of the book where the gears shift more toward the “phoenix is not your application” mindset. The new edition could possibly put “phoenix is not your application” more front and centre.

So it may be an idea to get through 1.1.6 now and then switch gears by giving Designing for Scalability with Erlang/OTP a go (given that you already completed Elixir in Action DSEOs Chapter 2 on Erlang is probably enough). Hopefully by the time you’ve finished that, the Phoenix 1.3 version of the book is available and you can skim through it with your new found understanding of OTP and deep dive into the parts that are new to you.

2 Likes

I’m just starting up a major new initiative on our dev team here and I’m using Phoenix 1.3 - just thought I’d let you all know. The first commit just hit the the git repo.

1 Like

I’m building a server-to-server header-bidding application for the digital advertising real-time-bidding space.

1 Like

I started to learn Elixir to implement all my “startup ideas” using this technology and I also started to write a book about my journey here.

2 Likes

Not much at the moment, but as I’ve just won some AppSignal, I’ll just have to get off my butt and write something to use it with! :wink:

1 Like

A phoenix web app currently in beta and an impersonation system for phoenix that allows admins to impersonate users (basically login as the user and show a little banner with a link to go back to being admin).

It’s not particularly impressive, but it looks like a good first hex package

2 Likes

Attacking the exercism games. Only having the programming elixir book, @NobbZ help & a bit of SO. Biggest fun factor: passing the level.

1 Like

Well, I’ve been …

  • Watching José Valim last Keynote at EU Conf and other vids about elixir and phoenix.

  • Working on porting an old Rails app to Phoenix + webpack2 + boostrap4, and expect to introduce it at work when I reach at least 70% parity.

1 Like

are you open source?

Unfortunately no, besides it’s not that interesting project to be open source but very important at work. However, I’m thinking on other ideas that I’d like to open source that are more exciting.

I would like to work on these with you in any case, if you are thinking about open source…

I was just keen how you setup webpack and bootstrap 4 and everything, it didnt work for me at all ,