by clemens (02.22.2022)

Atoms are not automatically converted to strings in heex templates

tl;dr

If you’ve got a heex template where you want to insert some data attribute like true, make sure that you convert it to a string first. Otherwise a blank string "" is inserted.

by kiru (04.11.2022)

Elixir Optional Parentheses

tl;dr

Just discovered that you parentheses in Elixsir are optional.

Saw this example on the ecto documentation page:

case MyRepo.insert %Post{title: "Ecto is great"} do
  {:ok, struct}       -> # Inserted with success
  {:error, changeset} -> # Something went wrong
end
by clemens (08.1212.2021)

Dependencies in the main mix.exs file in umbrella projects are not included in relases

tl;dr

If you’ve got a dependency that one of your apps in your umbrella project depends on, do not put it in the main mix.exs file at the base of the umbrella project. It will not be included in relases in that case.

by clemens (22.1111.2021)

Using avif images with Apache and long cache Times

tl;dr If you want to set long cache times using the headers cache-control and expires for .avif images, you will probably need to add the mime type for avif first like so: <IfModule mod_expires.c> AddType image/avif .avif ExpiresActive On ExpiresDefault "access plus 1 seconds" ... ExpiresByType image/avif A31536000 </IfModule>
by clemens (19.1111.2021)

Using <Source> and 'srcset' to force browser to choose correct image on mobile

tl;dr

When using responsive images using <picture> and the sizes attribute is not enough to force the browser to use a small image on mobile. Instead you need to provide multiple <source> tags with the media="(max-width: 200px)" attribute set.

by kiru (11.1111.2021)

Ecto 3 breaks assoc loaded

tl;dr

After migrating to Ecto 3, the following code did not work:

Ecto.assoc_loaded?(“e9d7edb4-3aef-45d6-851c-e77a464ef352”)

The Ecto.assoc_loaded?() does not accept any objects, check manually before you call assoc_loaded?()

by clemens (27.1010.2021)

Do not log all queries as debug in Ecto

tl;dr

Ecto by default logs all queries as debug to the console when developing. To disable simply add log: false to your ecto config.

by kiru (23.1010.2021)

Create Empty File to Deal with Full Disk

tl;dr

Nice trick to deal with disk full issues on a server:

After setting up the server, create an empty 8GB file in /spacer.img.

Why? In case the server goes out of space, simpley delete the file.

That gives you more to fix the actual issue.

by clemens (21.1010.2021)

Running Erlang and Elixir as Apps on Android or iOS

tl;dr

The guys at diode.io have build a wrapper around the BEAM so that you can run it as a native app on Android and iOS, using LiveView locally on the device.

by clemens (07.1010.2021)

Cleaning Up Digest Files in Phoenix

tl;dr

Digested files in priv/static can be cleaned up using mix phx.digest.clean --all.

by clemens (06.1010.2021)

Beware of Zombie Watchers in Elixir

tl;dr

Running custom background watchers with e.g. watchexec will lead to zombie processes if not wrapped in custom shell script that kills the process once elixir quits.

by clemens (06.1010.2021)

Use the unary plus operator in JS to parse numbers

tl;dr

Of the dozens of variants to parse a number in JS, the unary plus operator is the preferred method.

by clemens (04.1010.2021)

Nesting Anchors not Working in Firefox

tl;dr

Do not try to nest <a> tags in Firefox, that will cause Firefox to mangle up the layout.

by clemens (04.1010.2021)

Find all Elements at Mouse Position in Javascript

tl;dr

Get an array of all elements at the specified coordinates, relative to the viewport, using Document.elementsFromPoint().

by clemens (29.99.2021)

Explizite Ansprache in Stellenanzeige ist Besser als Binnen-I

tl;dr

Eine Studie hat gezeigt, dass eine Stellenanzeige mit der Formulierung “Geschäftsführerin oder Geschäftsführer (m/w/d)" mehr Bewerbungen von Frauen und insgesamt mehr Bewerbungen bringt als die Formulierung “Geschäftsführer (m/w/d)".

by clemens (29.99.2021)

Copy Android App Data Using Backup

tl;dr

When migrating to a new phone, you can copy most app data using the apt backup and restore function.

by clemens (27.99.2021)

For With Reduce in Elixir

tl;dr

You can perform a reduce using for by using the reduce: [] opt.

by clemens (23.99.2021)

beforeunload Deactivated on iOS

tl;dr

On Safari in iOS the event beforeunload does not exist, but it does on Safari for MacOS. Add a global event listener on all clicks on anchor tags as a workaround.

by clemens (23.99.2021)

Using Different Erts Version With Mix Release

tl;dr

If you are using mix release with a different erts version, the path must point to the erts-x.x.x directory inside the erlang installation.

by clemens (23.99.2021)

You Can Simulate iOS Devices on Macos

tl;dr

Use simulator.app from XCode to test your websites on iOS devices.

by clemens (23.99.2021)

Migrations Are Silently Skipped if They Do Not Have an Exs Extension

tl;dr

If you’ve got a migration that has ex as its extension instead of exs its silently skipped.