Revelry engineering blog header image lightbulb twil this week i learned. Chalkboard style

#RevTWIL: Git Settings for Colorblindness, mix text –failed, and More

At Revelry, we believe in sharing and learning from one another (beliefs that are rooted in our Core Values). Among the many things we do to encourage internal knowledge exchange is to have a different team member present at each week’s Engineering Meeting. These presentations don’t have to be lengthy, formal, or complicated; in fact, many are brief, but also powerful in that they teach our Revelers something new, inspire conversation, and encourage collaboration.

In the spirit of sharing, we share our This Week I Learned presentations (aka RevTWILs”) here. We hope you find them helpful.

THIS WEEK: We offer an assortment of shared learnings from our engineering team.

  1. Github has appearance settings for the various colorblindness types: https://github.com/settings/appearance 
  2. The Enum module used to have a filter_map function! But it has since been deprecated in favor of comprehensions or map + filter.
  3. In older versions of node/npm, if npm thinks you’re running a command as root, it will silently change users on you before executing your command. This is especially relevant for Github workflows and probably other container situations.
  4. This week I learned how to target a child html element from a parent with tailwind and “arbitrary variants”! eg:
<div class="[&_p]:mt-4">
  <p>Lorem ipsum...</p>
  <ul>
    <li>
      <p>Lorem ipsum...</p>
    </li>
    <!-- ... -->
  </ul>
</div>

(the “[&_p]:mt-4” targets the <p> tags)

  1. There is another EEx / HEEx tag: the “EEx quotation”! <%%= %> This is basically an escape, and will return the result without evaluating it. (eg: <p><%%= 1 + 1 %></p> -> <p>1 + 1</p>)
  2. Nodesource install scripts are deprecated and are adding an extra 60 seconds to build times due to a warning message being displayed. You can still use nodesource, but you need to update your Dockerfiles to use their .deb/.rpm packages.
  3. mix text --failed only runs tests that failed the last time they ran. mix test --stale runs test files that reference modules that have been changed since the last time you ran mix test --stale.
  4. If you’re starting an async Task from a liveview, if the liveview gets killed, the Task gets killed, too. This can happen if the task is called before a re-direct! The solution is to use Task.Supervisor.async_nolink/3 This way, even if the liveview is killed, the Task will valiantly continue onwards!

We're building an AI-powered Product Operations Cloud, leveraging AI in almost every aspect of the software delivery lifecycle. Want to test drive it with us? Join the ProdOps party at ProdOps.ai.