Today I Learned
So, you’re changing this one file for local development purposes only. Maybe it’s config, maybe some source file, but one thing is certain - you don’t want those changes to be committed. And what’s worse, .gitignore
doesn’t work.
In the world of Elixir programming, there are numerous features and syntactic constructs that contribute to the language's elegance and expressiveness. One such hidden gem is the concept of "implicit try".
Today's Advent of Code puzzle inspired me to create this TIL. It may sound trivial, but in fact, it's tricky if you are unfamiliar with the nuances of guards' functioning.
It's easy to contain absolute positioned elements. Things get a little trickier when you want to contain a fixed positioned element without changing its stylings.
Warnings in Elixir are usually an important sign of a problem in the codebase. There is an easy way to make them gone.
Each of us had a situation, where we had to invoke a few, same commands each time. Making it once is not that problematic, but when we are supposed to repeat given operations, it may be better just to create one function that will handle it all.
Pattern-matching is one of the finest elixir-lang features. Whoever knows the power of this tool once, will want to use it forever.
Did you ever create a commit that you wish never happened? Let's be honest - we all did. There is an easy way to revert it in Git.
TLDR: With jest-extended
package you can write: expect([...set]).toIncludeSameMembers([value1, value2]);
. If you are looking to a native, but longer solution scroll down a bit.
Sometimes we want to store some piece of information while using a terminal, for example, a result of an executed command. We usually save it into some temporary file which is going to be deleted after all. There’s a better way.
If you ever had to count occurrences of values in Elixir's list, this short post might be helpful for you!
There are a bunch of operations you may want to perform before the rendered response in conn is sent to the client, such as minification. In this post I'll show you how to do it easily.
In this post, you'll learn how to easily redirect users to the previous path using the Navigation History plug.
The macro mechanism in Elixir is not only an interesting metaprogramming feature - in fact, it is at the language's very core. And the more awesome fact is that, using macros, you can override the algorithm of defining functions itself!
So you don’t know what’s the type of struct you’re passing somewhere? Maybe it can be one of few types and you have to distinguish them? Or any other reason… But it’s about checking the struct type. Just use one of the coolest Elixir features - pattern matching!
Sooner or later you'll have to change the null constraint in one of your DB relations. How to do it easily in Ecto?
Hey! Have you ever wondered about tests running inside the IEx shell? For a long time, I was convinced that it’s not really possible. And as it turns out - that’s not really straightforward. You won’t easily find information about that in the documentation.
There is a common scenario: You'd like to debug your Phoenix app with break!/4
or IEx.pry/0
. Everything works fine, until... Phoenix server throws a timeout error statement.
Sometimes you may notice that your website displays an unintended horizontal scrollbar. You may be wondering what is the cause.
It's a pretty common scenario - you have to place a few elements in equal distances. E.g. unordered list items.
Did you know that it's possible to set default value in Javascript object destructuring?
By default in the test env, Phoenix doesn't show Logger.debug/Logger.info
outputs in the console.
Sometimes you need to do some database operations at once. A simple example: User-A transfers money to User-B. Updating just one balance at the time creates a risk of data desynchronization. What if the first DB operation goes well but updating the second user’s data fails? Sounds like a hard to catch vulnerability.
Ensuring that GraphQL mutations properly update your Apollo client's cache can be a bit tricky - here's how to manually control that.
Nowadays, with an ever-growing number of web services, we tend to overload Web apps with external resources. As a result, it decreases page load speed and affects SEO score. There is a pretty easy solution for that.
People will tell you it's an antipattern, but what if a library needs you to do this?
In some cases, like for testing purposes, you might want to use an npm package stored on a local machine. Here is how you can do that with one simple command.
Learn a trick that will allow you to manage item order in Postgres tables easier & faster.
With pure function React Components you're not allowed to use lifecycle methods like componentDidMount
or componentWillUnmount
.
Let’s build something together
Ready to turn your curiosity into a successful digital product?
Share your idea, and let's explore the possibilities.
Our experts worked with 20+ worldwide tech innovators
