I've been a developer for over 20 years and every few years I like to learn something new. When I first started it was all C/C++. Then it was Java. I moved completely to Ruby in 2007 and today I'm using Elixir.
As I learn new things I use this site to keep a record of what worked for me.
Note: This site may not have the best or most efficient solutions. It is simply my guide to Getting S**t Done.
When using external services (usually via an api call) I sometimes want to cache the results for a period of time. Here’s a technique that works for me
In this example I have a cached version of a lookup_function
called lookup_function_cached
that takes a key and returns a result
Here’s a script I wrote to backup my MySQL database and upload to S3. It’s. based on a Ruby version I’ve been using for years.
Mix.env/0 works correctly in mix phoenix.server, but it fails to call in a production environment which is built with distillery.
It makes sense because mix isn’t included in the release build. Here is an equivalent
One of the ways I keep up with projects and what things do is to keep code in locations that logically represent the functionality they perform.
From libs, tasks, database schemas, and domain logic all have their place. Here is how I organize my code