サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
体力トレーニング
blog.honeybadger.io
I recently published an article in which I tested most of Ruby's string methods with certain Unicode characters to see if they would behave unexpectedly. Many of them did. One criticism that a few people had of the article was that I was using unnormalized strings for testing. Frankly, I was a bit fuzzy on Unicode normalization. I suspect that many Rubyists are. Using normalization, you can take m
Among the new features shipped with Ruby 2.4 is improved Unicode support. Specifically, methods like upcase and downcase work as expected, turning "ä" to "Ä" and back. This made me curious: what other Unicode improvements have been made since 2013 when I read André Arko's blog post Strings in Ruby are UTF-8 now… right?? I tested all of Ruby's string methods, not looking for technical errors but
Simple tips to make scaling your database easier as you grow By Starr Horne #ruby Feb 6, 2017 When you're working on a young project you're constantly making decisions that will make it either easier or harder to scale later. Sometimes it's good to pick the short-term gain, to accrue a bit of technical debt so you can ship faster. But other times we pick up technical debt because we didn't know th
Introducing our Sidekiq cluster script By Benjamin Curtis #ruby Feb 8, 2017 At Honeybadger we depend heavily on Sidekiq in our processing pipeline. Nearly everything we do runs through a queue at some point. As a result, I want to make sure we are running Sidekiq well. With our recent move to EC2, we changed from having a stable set of long-lived servers to an ever-changing set of instances runnin
Many of the most common ActiveRecord idioms produce SQL which doesn't scale well as your dataset gets larger. In this article I discuss three of the worst offenders and offer work-arounds. I remember the first time I saw rails' ActiveRecord. It was a revelation. This was back in 2005 and I was hand-coding SQL queries for a PHP app. Suddenly, using the database went from being a tedious chore, to b
Remote Debugging with Byebug, Rails and Pow By Starr Horne #rails Jul 15, 2015 If you haven't seen byebug before, I recommend that you check it out. It's a great debugger for Ruby 2.x. In the words of its authors: Byebug is a simple to use, feature rich debugger for Ruby 2. It uses the new TracePoint API for execution control and the new Debug Inspector API for call stack navigation, so it doesn't
Level Up Your Command-Line-Fu With Ruby By Starr Horne #ruby Dec 8, 2015 To really master the command line you have to master dozens — if not hundreds — of small utility programs. Each of these does things slightly differently. It can be pretty overwhelming. Fortunately, it's possible to replace a lot of these single-purpose tools with a general-purpose programming language like Ruby. That way you
Did you know that it's possible to log all method calls as they occur in a running process in real time? How about injecting code to be executed inside of a running process? You can – via the magic of the rbtrace gem. The rbtrace gem comes with two parts. The first is a library that you include in the code that you want to trace. The second is a commandline utility for querying trace data. Let's t
When to use freeze and frozen? in Ruby By Starr Horne #ruby Sep 2, 2015 These days it's pretty common to see #freeze used in Ruby code. But it's often not entirely clear WHY freeze is being used. In this post we'll look at the most common reasons a developer might freeze variables. To illustrate each reason, I've excerpted example code from the Rails codebase and other popular open-source projects
As developers, we spend so much time on making our programs run that it's easy to overlook how they exit. And it's important! When your programs behave correctly on exit, it makes them a lot easier to manage and makes them more likely to work with standard devops tools. There are a lot of ways that you can exit a Ruby program. I've shown some of them below. In this post we'll discuss the details o
Using lazy enumerators to work with large files in Ruby By Starr Horne #ruby Aug 10, 2015 Enumerators are at the heart of what makes Ruby such a powerful, dynamic language. And lazy enumerators take this a step further by allowing you to efficiently work with extremely large collections. Files - it turns out - are just large collections of lines or characters. So lazy enumerators make it possible
How unicorn talks to nginx - an introduction to unix sockets in Ruby By Starr Horne #ruby Jul 14, 2015 Ruby application servers are typically used together with a web server like nginx. When user requests a page from your Rails app, nginx delegates the request to the application server. But how exactly does that work? How does nginx talk with unicorn? One of the most efficient options is to use un
Nothing could be simpler and more boring than the case statement. It’s a holdover from C. You use it to replace a bunch of ifs. Case closed. Or is it? Actually, case statements in Ruby are a lot richer and more complex than you might imagine. Let’s take a look. Nothing could be simpler and more boring than the case statement. It's a holdover from C. You use it to replace a bunch of ifs. Case close
When you use something as much as Ruby developers use Hashes, it's easy to think you've seen it all. But I'm here to tell you that the humble ruby Hash has a few tricks up its sleeve. Far from being a dumb key-value system, the Hash object gives you the power to do some very interesting and sophisticated things. Any object can be a hash key Before we go any farther I'd like to point out one thing
Blocks are such an important part of Ruby, it's hard to imagine the language without them. But lambdas? Who loves lambdas? You could go years without using one. They almost seem like a relic from a bygone age. ...But that's not quite true. Lambdas have some interesting tricks up their sleeves once you investigate them a little. In this article we'll start with the basics of lambda usage, and then
The Rubyist's Guide to Environment Variables By Starr Horne #ruby Jun 9, 2015 If you want to be able to effectively manage web apps in development and in production, you have to understand environment variables. This wasn't always the case. Just a few years ago, hardly anyone was configuring their Rails apps with environment variables. But then Heroku happened. Heroku introduced developers to the
このページを最初にブックマークしてみませんか?
『blog.honeybadger.io』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く