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

#RevTWIL: Debugging, Session Cookies, 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. If you’re debugging tests on a LiveView, you can call open_browser(view) at any point to see what has been rendered to the page so far. 
  1. Phoenix cookies by default don’t set an expiration, which makes them session cookies. When the browser is closed, session cookies are removed and the user is logged out. However, you can set the max_age value on Plug.Session in endpoint.ex and it will add max-age and expiry to the cookie, which overrides this.
  1. If you’re testing that an element does not exist in the html of a page, remember that if it’s hidden, it’s still in the html. 
  1. Phoenix LiveDashboard allows you to easily monitor the performance of your LiveView app. It comes with a great GUI and a super simple set up. 
  1. In a livebook you can cmd+enter to re-evaluate a code block, and you can alt+shift+f to format a given code block.
  1. While connecting your LiveBook to your project is a lot of fun, it also runs an instance of your project, which can lead to confusing outcomes if your project runs Oban workers…especially if your LiveBook is running slightly older code (since it doesn’t hot-reload) and ends up processing the jobs that you expect to use the newer code.
  1. In Bash, always wrap your “$variables” in quotes. If the value of the variable contains symbols – especially an asterisk – it can cause headaches if you don’t.

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.