Few things are scarier than a database slowly losing integrity over weeks or years. For a while, nobody notices anything. Then users start reporting bugs, yet you can't find any code that's broken. By the time you realize the problem, it may be happening for so long that your backups are unusable. We can avoid problems like these with skillful use of transactions. In this article, Kingsley Silas introduces us to transactions at the database level, discusses when they should be considered, and shows us how to use them in Rails.
Let me know if this feels familiar. Your users want to "login with GitHub," so you install a gem, follow the setup instructions, then pray it never needs maintenance because you have no real idea how OAuth2 works. Let's fix that. In this article, Diogo Souza shows us the fundamental concepts behind OAuth2 and how to implement them using Devise and Doorkeeper.
Few things are more frustrating than slow, flaky test suites. You're ready to deploy, wait 20 minutes for CI to run, only to find that a test failure in code you've never touched is blocking you. You dig into the source and find the problem: an external API call. It works (slowly) most of the time. But sometimes the network glitches and it fails. What do you do? In this article, José Manuel shows us several techniques for removing external API dependencies from our tests.
Links are so fundamental to web development that they're almost invisible. When we link to a third-party page, we hardly ever consider how it could become an opportunity to exploit our users. In this article, Julien Cretel introduces us to three techniques that bad actors can use to target our users and discusses how to avoid them.
Lexers are magical. They take your messy, hand-typed, human text, and convert it into a clean data structure that the computer can process. Every time you run a ruby program, use structured search or type in a date by hand, you'll find a lexer hard at work. In this article, Alex Braha Stoll pulls back the curtain to show us how lexers work and how to implement one for a simple programming language.
You'll probably never need to implement bubble sort from scratch. Just call Array#sort! But sorting algorithms are a popular interview topic for a reason. They ask a bigger question: "Sure, you know what your code does, but do you know how it works? Do you understand the subtle ways that choices you make can impact performance?" In this article, Julie Kent will walk us through the famous Bubble Sort algorithm, demonstrating how it works, how to implement it in Ruby, and how to predict its performance.
Have you ever wanted to update all your errors at once, or set defaults for incoming errors? Well, we are releasing some helpful tools for error management that we call Honeybadger Actions.
Text encoding is fundamental to programming. Web sites, user data, and even the code we write are all text. When encoding breaks, it can feel like the floor is falling out from under you. You're cast into a dimension of bitmasks and codepoints. Logs and backtraces are useless. You consider trading your text editor for a hex editor. But there's hope! In this article, Jose Manuél will show us how encoding errors happen, how they're expressed in Ruby, and how to troubleshoot them. So the next time one of these errors lands on your desk, you'll be in a better position to handle it.
When you're evaluating a language for your next project, few things are more important than available third-party libraries and the package manager that ties them together. While early versions of Go lacked a package manager, they've made up for lost time. In this article, Ayooluwa Isaiah introduces us to go's module ecosystem to help us decide if go is "a go" for our next project.
Developers make fun of legacy systems because we're scared of them. We're afraid that the tiniest change will cause the app to break in unexpected ways. We're afraid we won't realize it until a customer complains. One way to combat this fear is through testing. In this article, José Manuel shows us how to retrofit legacy systems with acceptance test suites so we can maintain them with less fear and more confidence.