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.
- Github has appearance settings for the various colorblindness types: https://github.com/settings/appearance
- The Enum module used to have a filter_map function! But it has since been deprecated in favor of comprehensions or map + filter.
- 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.
- 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)
- 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>)
- 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.
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 ranmix test --stale
.- 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.