Tagged with Elixir

13 posts found.

Inhji posted

TIL: You can generate a tree view of your mix dependencies with the following command: mix app.tree

Inhji posted

I used to add folders like node_modules to sublime text’s folder_exclude_patterns to hide them from Goto Anything results. This has the drawback that these folders won’t be shown in the sidebar.

Sometimes (rarely, but still happens) I want to check some files in node_modules. I either need to change the folder_exclude_patterns setting or open the file from outside of sublime text. Both are workarounds at best.

Today I learned that there is a setting called binary_file_patterns which does exactly what I need:

These files will still show up in the side bar, but won’t be included in Goto Anything or Find in Files

So, I added this to my config:

"binary_file_patterns": [
    ...
    "deps/**/*",
    "_build/**/*",
    "docs/**/*",
    "**/node_modules/**/*"
]

These patterns not only hide node_modules but also a few elixir/phoenix specific folders.

Inhji posted

TIL a neat way to try a few different strategies to get some thing:

Enum.reduce_while(
      [
        &maybe_get_favicon_from_hcard/1,
        &maybe_get_favicon_from_head/1
      ],
      nil,
      fn strategy, acc ->
        case strategy.(url) do
          {:error, _} -> {:cont, acc}
          {:ok, favicon} -> {:halt, favicon}
        end
      end
    )

Source: koype by jacky

Inhji posted

TIL you can make development in iex even smoother by adding an .iex.exs file to your home and/or project directory to automatically alias common modules. 🚀