RSSAmplifier

Blog

Robert Mosolgo

Robert Mosolgo's Personal Blog

rmosolgo.github.ioRSS feed ↗100 posts

Latest posts

Lake Road Farm: 2025 in Review

Taking a brief look back at the work of the farm in 2025. Tractor After several busy years, this year, I planned to have no projects: no new garden beds, no new plant or animal species, no building projects. Then I bought a broken-down tractor: a 1976 John Deere 2240 (55hp, 2 wheel drive, 3-cylinder diesel). Turns out I had a project. ...

St. Dunstan's Academy Pasture Walk

Several weeks ago, I took an afternoon to walk the pastures at St. Dunstan’s Academy . Here’s a little report on what I found. It was early June and I had beat the farmer who would eventually come to make first-cutting hay. That means it was basically the perfect time to identify plants: almost everything was either in bloom o...

Building for Perfetto

I recently added a custom profiler to GraphQL-Ruby. It creates traces for viewing in Perfetto , and building it was a bit of an adventure. The final result is <code class="lang...

Lake Road Farm: 2024 in Review

This is a rapid-fire look back and what I was up to farm-wise in 2024. Bonus double-rainbow Dairy 2024 was my second calendar year of running a small dairy...

Why Dairying Interests Me: Small, Grass-Fed, and Raw

I got into milk because I love cheese. The more I learned, the more I loved. Here, I describe why small, grass-fed, raw dairying appeals to me. I’m not attempting to make an even-handed pros-and-cons analysis between all the different approaches to dairy production and consumption, only to summarize my personal interest in one way of doing it. <h2 id="small-dairyi...

Lake Road Farm: 2023 in Review

2023 was a big year for Lake Road Farm . Here are some thoughts looking back at the year. The Dairy Definitely the biggest work of the year was getting the dairy going. Calves arrived in May. (Bluebell came first, on the same day as the first picnic at St. Dunsta...

Does it matter what we wear?

I’ve been wondering, besides keeping warm and being decent, does it matter what we wear? The question assumes that we wear clothes (for the love of God and the love of neighbor), and maybe even that our clothing ought to conform to our neighbors’ expectations. Beyond that, do we have any responsibility to dress a certain way? After reading “Il...

Books I Read In 2021

Boy, it’s hard to believe 2021 is already over. At least there was some good reading to be had. 2021 Books Jesus Through Middle Eastern Eyes , Kenneth Bailey I borrowed this one, but bought a copy after finishing it. Bailey investigates many of aspects of the narratives of Jesus’s life, shedding new light based on traditional...

What makes a good ID?

At my job, we’re working on revamping the global ID system we use for GraphQL. Here are a few lessons I’ve learned through my participation in the project. In short, we’ve been considering, “what makes a good global identifier?” I’ve found a few takeaways. (Our sibling team pointed out...

Lesslie Newbigin's Logic of Mission

I recently re-skimmed Lesslie Newbigin’s The Gospel in a Pluralist Society . Although I was looking for a later chapter, “The Congregation as the Hermeneutic of the Gospel,” I was most struck by the chapter “The Logic of Mission.” What follows is a summary and personal interpretation. Law: Not the Logic of Mi...

Lessons learned implementing a sharded, replicated rate limiter with Redis

About a year ago, we migrated an old rate limiter to Redis. In the end, it worked out great, but we learned some lessons along the way. The Problem We had an old rate limiter that was simple enough: For every request, determine a “key” for the current rate limit In Memcached, increment the value of that key, setting...

GraphQL Dataloader

GraphQL-Ruby 1.12 ships with a new GraphQL::Dataloader feature for batch-loading data. It uses Ruby’s Fiber API to manage data dependencies without any intermediary proxy or promise objects. You can enable it in your schema with: <div class="language-...

Books I Read in 2020

2020 turned out to be a great year for books. In roughly chronological order: Secrets of the Blue Ridge , Phil James Cheese and Culture , Paul Kindstedt Hannah Coulter , Wendell Berry In Search of a City , Plough Quarterly Winter 2020 Tree and Leaf , JRR Tolkien <...

Books I Read in 2019

I thought I’d try to remember what I read last year. In roughly chronological order: That Distant Land , Wendell Berry The Good Shepherd and the Child , Sofia Cavaletti et al Albemarle, Jefferson’s County, 1727-1976 , John Hammond Moore Perelandra , C.S. Lewis Modern Technol...

Finding implicit returns with Rubocop

Some notes on a refactor implemented with a Cop. I’ve developed a real affection for Rubocop over the last couple of years. (Sorry to my old coworkers and friends at Planning Center, who put up with my complaining about it back then!) What I’ve come to appreciate is: No fights about style. If it passes the linter, it’s ok to ship. ...

Breaking out of a yield with return

Did you know that calling return in one Ruby method could affect the flow of another method? I discovered it today while hunting a GraphQL-Ruby bugfix . You can get more reliable behavior with ensure , if it’...

How I Make Yogurt

Yesterday I excitedly recommended to a friend that he try making some yogurt at home. Then I realized that my personal recipe is a bit of a hodge-podge, so I thought I’d try writing it out. This recipe isn’t perfect: when using raw milk, a bit of the cream still separates to the top while it’s culturing. (I’d rather have it all mixed in, but I guess you could call it “...

A New Runtime in GraphQL-Ruby 1.9

GraphQL-Ruby 1.9.0 introduces a new runtime called GraphQL::Execution::Interpreter . It offers better performance and some new features. In isolated benchmarks , the new runtime is about 50% faster. We saw about a 10% speedup ...

Notes on Small is Beautiful

I just finished reading E.F. Schumacher’s Small Is Beautiful: A Study of Economics As If People Mattered , so I thought I’d jot down a few impressions before I forgot them. Background Schumacher was a post-WWII Br...

Trampolining

As part of my work on improving GraphQL-Ruby’s runtime performance , I’ve been reading Essentials of Programming Languages . Here, I try to apply their lesson about “trampolining”. TL;DR: I applied a thing I read in a textbook and it: ...

Trip Report: Balkan Ruby 2018

This May, I had the opportunity to attend Balkan Ruby and present on my work with graphql-ruby . Here are a few thoughts about the trip. The Conference Balkan Ruby was a big hit. Personally, some of my favorites were: Zach Ho...

How Ripper parses variables

Ruby has a few different kinds of variables, and Ripper expresses them with a few different nodes. Here are the different variables in Ruby: a # Local variable (or method call on self) $a <span c...

Updating GitHub to GraphQL 1.8.0

GraphQL 1.8.0 was designed and built largely as a part of my work at GitHub. Besides designing the new Schema definition API , I migrated our codebase to use it. Here are some field notes from my migration. If you want to know more about the motivations behind this work, check out this <a href="/blog/2018/03/2...

Why a New Schema Definition API?

GraphQL-Ruby 1.8.0 will have a new class-based API for defining your schema. Let’s investigate the design choices in the new API. The new API is backwards-compatible and can coexist with type definitions in the old format. See <a href="https://github.com/rmosolgo/graphql-ruby/blob/1.8-dev/guides/schema/class_bas...

Ruby Type Checking Roundup

This fall, several people presented their work on Ruby type checkers. So let’s take a look: what’s the big deal, and what have they been up to? Why Type Check? Part of Ruby’s appeal is to be free of the cruft of its predecessors. So why is there so much interest in adding types to Ruby? Large, sprawling pr...

What's new in React-Rails 2.0?

For Planning Center free week, I cooked up react-rails 2.0 🎊. Here are a few highlights. For the full list, see the changelog ! <h2 id="webpa...

Watching files during Rails development

You can tell Ruby on Rails to respond to changes in certain files during development. Rails knows to watch config/routes.rb for changes and reload them when the files change. You can use the same mechanism to watch other files and take action when they change. I used this feature for <a href="https://git...

Prototyping a GraphQL Schema From Definition With Ruby

GraphQL 1.5.0 includes a new way to define a schema: from a GraphQL definition. In fact, loading a schema this way has been supported for while, but 1.5.0 adds the ability to specify field resolution behavior. GraphQL IDL Besides queries, GraphQL has an interface definition language (IDL) for expressing a schema’s structure. ...

Tracking Schema Changes with GraphQL-Ruby

One way to keep an eye on your GraphQL schema is to check the definition into source control. When modifying shared code or reconfiguring, it can be hard to tell how the schema will really change. To help with this, set up a snapshot test for your GraphQL schema! This way: Changes will be clearly visible in GraphQL IDL <...

Optimizing GraphQL-Ruby

Soon, graphql-ruby 1.5.0 will be released. Query execution will be ~70% faster than 1.3.0! Let’s look at how we reduced the execution time between those two versions. Thanks to @theorygeek who optimized the middleware chain helped me pinpoint several other bottlenecks!...

Parallelism in GraphQL-Ruby

It’s possible to get IO operations running in parallel with the graphql gem . I haven’t tried this extensively, but I had to satisfy my curiosity! Setup: Long-Running IO Let’s say we have a GraphQL schema which has...

Introducing GraphQL::Pro

graphql-ruby is almost two years old! Today, I’m adding a new element to the project, GraphQL::Pro . I have three goals with GraphQL::Pro : Provide ro...

Raising Exceptions is Bad

In general, raising exceptions for control flow makes code hard to understand. However, there are other cases when an exception is the right choice. Raise vs Return raise is <code class="language-plaintext highlighte...

GraphQL Query as a State Machine

State machines are applied to a wide variety of programming problems. I found it useful to think of a GraphQL query as a state machine. Part 0: Introduction to State Machines Practically speaking, a state machine is a unit of code with these properties: It has a set of states It is...

Hash#key? vs Hash#[]

I read that Hash#key? was slower than Hash#[] and it made me sad because, shouldn’t Hash#key? generally require less work? Besides that, there are cases where only <code class="lang...

Parameterized styles with React, Rails and Sprockets

css_modules provides an approach to styling UI components in a local-first way. Let’s say you have the same component to render in two contexts: <span class=...

Trip Report: RubyConf Colombia 2016

I just got back from RubyConf Colombia . The content was great, the community was great, and the venue was great! The Content This was a single-track conference, but there were no dud talks! I prefer code-driven talks, and for that reason, these were a few of my favorites: <a href="https://twitt...

Summer Reading: Specializing Ruby

Specialising Dynamic Techniques for Implementing the Ruby Programming Language (“Specializing Ruby”) is approachable and enjoyable (despite being a PhD thesis 😝). Specializing Ruby describes Chris Seaton ’s work on JRub...

Finding a Browser-Ready File for Sprockets

I like using Sprockets, but sometimes it’s hard to find a file to include in the asset pipeline. Here are some methods I use to find browser-ready JavaScript files. There are a few good options for getting browser-ready files for JavaScript libraries: Download a file from the project’s website Download a file from the project’s source code re...

How I Use Sprockets

When reviewing issues for react-rails , I see many questions about how to gather JavaScript dependencies with Sprockets. Here is how I use Sprockets to manage JavaScript dependencies. I’m looking for a few things in a JavaScript bundler: Stability: I don’t want any changes to my dependencies unles...

Ruby Class, meet Elixir Module

Elixir modules offer some valuable insight into designing Ruby classes. Ruby classes combine data and behavior in a typically object-oriented way: data: instances of the class hold state in instance variables behavior: methods on the class alter state. Elixir modules also comb...

Using GraphQL without Relay

Although Relay made GraphQL famous, GraphQL was in use at Facebook for years before Relay took the scene. You can use plain AJAX requests to interact with a GraphQL server, too. Update 18 Feb 2017: For a zero-dependency improvement of this concept, see <a href="http...

How many assertions per test case?

This question is too hard. Instead, ask, “how many behaviors per test case?” and answer, “one.” I presented at Full Stack about unit testing but what I really like is behavior-driven development. A Behavior You can think of a code base as a collection of behaviors: given some inputs (data, events), it makes some outputs (more data, mor...

Crystal First Impressions

The Crystal programming language combines Ruby-like syntax with a really powerful compiler. As a result, it’s fun to write, fast to run, and hard to screw up! My Crystal experience so far: danott mentioned it in our Slack a few weeks ago I read the great <a href="h...

Communion as "Bread from Heaven"

The Christian practice of communion is a reminder of why Jesus is important and how his life affects us. To see the full depth of it, you have to consider pre-Christian religion. Before Jesus: Manna Was “Bread from Heaven” When the Israelites left Egypt, they spent 40 years in the desert as nomads. During this tim...

Authorization in GraphQL

A GraphQL system works differently from a “traditional” RESTful JSON API. Instead of authenticating during controller actions, you can authenticate users with “query context.” UPDATE 23 Jan 2017: For more resources on authorization with graphql-ruby ,...

Making Ginger Ale

I had leftover whey after making yogurt , so I made ginger ale. I followed this recipe . (I also tried making ricotta cheese and it was a total fail: it never curdled.) Overall: It didn’t do anything for 2 days, then it suddently...

Making Yogurt

This weekend I tried making yogurt. It worked! I based it on this great recipe: Dr. David Fankhauser’s Yogurt . Dr. Fankhauser has a ton of illustrated, detailed recipes for other dairy and make-at home foods (eg, <...

Response to "Using a Ruby Class to Write Functional Code"

Pat Shaughnessy’s “Using a Ruby Class to Write Functional Code” gives an example of bringing functional programming principles into object-oriented design. I like it. It Pat’s example, he turns a group of pure functions into a class whose state is immutable-ish (they t...

Move ActiveRecord Scopes into Separate Files

Ruby on Rails models tend to grow and grow. When refactoring scopes, it turns out you can move them into their own classes. The Problem Rails models can get out of hand. Over time they get more associations, more methods, more everything. The resulting huge API and visual clutter makes those classes hard to maintain. Consider...