St. Dunstan's Academy Pasture Walk July 28, 2025 Several weeks ago, I took an afternoon to walk the pastures a...| rmosolgo.github.io
St. Dunstan's Academy Pasture Walk July 28, 2025 ...| rmosolgo.github.io
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| Robert Mosolgo
Lake Road Farm: 2024 in Review January 10, 2025 ...| rmosolgo.github.io
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.| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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:| Robert Mosolgo
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 <...| Robert Mosolgo
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...| Robert Mosolgo
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. ...| Robert Mosolgo
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’...| Robert Mosolgo
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 “...| Robert Mosolgo
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 ...| Robert Mosolgo
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...| Robert Mosolgo
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: ...| Robert Mosolgo
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...| Robert Mosolgo
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| Robert Mosolgo
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| Robert Mosolgo
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| Robert Mosolgo
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...| Robert Mosolgo
For Planning Center free week, I cooked up react-rails 2.0 🎊. Here are a few highlights. For the full list, see the changelog!| Robert Mosolgo
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| Robert Mosolgo
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. ...| Robert Mosolgo
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 <...| Robert Mosolgo
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!...| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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| Robert Mosolgo
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...| Robert Mosolgo
I read thatHash#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| Robert Mosolgo
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:| Robert Mosolgo
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:| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
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| Robert Mosolgo
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...| Robert Mosolgo
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| Robert Mosolgo
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...| Robert Mosolgo
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,...| Robert Mosolgo
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...| Robert Mosolgo
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, <...| Robert Mosolgo
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...| Robert Mosolgo
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...| Robert Mosolgo
While adding a big feature to PCO Check-Ins, I was struck with this way of describing my approach to adding complexity to the system. Suppose you’re given the task: “Our system only handles data of type X, it also needs to handle data of type Y. Everywhere.” All over the program, you need to ...| Robert Mosolgo
To resolve a bug, a developer must know the behavior and the purpose of the program at hand. I’ve been reading Lesslie Newbingin and it made me think of this. There are at least two kinds of bugs: The program crashes The program does not crash, but it does not accom...| Robert Mosolgo
Extending ActionController::Baseonce, in ApplicationController, is a great Ruby on Rails practice. However, if ApplicationController is your only abstract controller, it’s likely to become a maintenance challen...| Robert Mosolgo
You can use C code to prepare methods for mruby scripts. The steps are: Defining a method Getting argument values Adding the method to the mrb_state Defining a Method To define a Ruby function...| Robert Mosolgo
The cover article of the November 2014 Atlantic Monthly told the story of sexting and police involvement in Louisa County, VA. Sexting is not part of my life, but it’s part of our culture (if Snapchat’s $2 billion valuation shows anything). ...| Robert Mosolgo
mruby is an implementation of Ruby that’s designed to be lightweight & integrated with C. To get started, you can run a bit of Ruby code from inside C code. “Hello World” with mruby looks like this: Set up a new project and include mruby as a submodule Write some C code that loads mruby and exec...| Robert Mosolgo
Sadly, PCO is getting out of the batman.js game. From where I sit, I think it boils down to: The framework never hit critical mass (and lost what it had) The framework’s magic made some problems impossible to debug Client-side apps aren’t good for business Rails, Turbolin...| Robert Mosolgo
Batman.js and AngularJS both create hierarchical view scopes, but their implementations are very different. (please forgive my inconsistent rendering of AngularJS/Angular/Angular.js/angular, I don’t know which one is right!) In batman.js and Angular, there is a view scope hierarch...| Robert Mosolgo
I was just pondering whether a person ought to have children or not. It’s funny when I try to be the judge. Propagation of the human race is a funny business. There’s no test for it. You don’t even have to get a license, like you do for driving or for getting married. You just … do it. Even if you think about it carefully and make the decision with solemnity, ...| Robert Mosolgo
Batman.js is a front-end MVC framework with an unrivaled implementation of key-value observing. I will explore computed properties in batman.js by contrasting them with Ember.js’s computed properties. First, disclaimers! I didn’t write any of the Batman.Property ...| Robert Mosolgo
In batman.js, event handlers respond to user interactions like “click” and “submit”. You can use them to modify application state in response to those interactions. Let’s look at: What event handlers are and where they’re defined How you can connect handlers to DOM events How you can pass arguments...| Robert Mosolgo
Using batman.js with Devise is pretty straightforward. It’s also pretty cool-looking, because when you define App.User.current, all your view bindings are instantly updated to reflect the user’s signed-in status! You ...| Robert Mosolgo
Model::transaction provides a deep-copied, “shadow-realm” version of a record which is great for rendering into edit forms. Any changes made to it can be saved (which updates the original record too), or just forgotten. Here’s the problem transactions exist to solve: You want your user to edit so...| Robert Mosolgo
Batman.js is a CoffeeScript front-end MVC framework. One of its core features is accessors, which can be used like properties or methods of a Batman.Object. They can even take arguments! Batman.Object has propert...| Robert Mosolgo
In this whirlwind tutorial, we’ll build a blog with batman.js and Firebase. To get a feel for batman.js, let’s build an blog where: People may sign in (with Github) The owner may create, edit and destroy posts Other signed-in users may leave comments and delete the...| Robert Mosolgo
Implementing image preview is breeze thanks to batman.js observers and JavaScript APIs. The goal is to have a user add an image to a file input and immediately preview that image. To accomplish this, we’ll turn the uploaded file into a data URI, then set that to the| Robert Mosolgo
Batman.js doesn’t support hasManyThrough out of the box, but it can be implemented fairly easily with Set::mappedTo. This feature was just merged into the master branch – download the latest batman.js| Robert Mosolgo
Batman.Object accessors are the bread and butter of batman.js. Stubbing them can make testing much easier. I haven’t figured out| Robert Mosolgo
batman.js views are one of the best ways to integrate other JS libraries with batman.js data structures like Batman.Object and Batman.Set. For example, you can use a custom view to display Batm...| Robert Mosolgo
Batman.Set is the array-like enumerable of batman.js. It offers observable properties (which are automatically tracked by @accessor) and useful change events. In b...| Robert Mosolgo
By default, Batman.Request sends data as HTTP form data. However, you can override this with Batman.RestStorage. Simply pass serializeAsForm: false to| Robert Mosolgo
You can use jasmine to test batman.js controllers by looking them up from the controller directory, then executing actions with executeAction. Setup To set up, make sure the app is| Robert Mosolgo
In batman.js, properties automatically track their sources. This is done by tracking all calls to get when an accessor function is executed. I hope to cover automatic dependency tracking in batman.js by describing: The “source” relationship between properties| Robert Mosolgo
The “Batman.js MVC Cookbook” is a collection of annotated code snippets for getting things done with batman.js. When I heard that Michael Hartl (of Rails Tutorial fame) was releasing a web publishing platform, I was itching...| Robert Mosolgo
You can use batman.js with any backend! Batman.js is not just for Ruby on Rails! Here are batman.js’s dependencies: A RESTful JSON API A way to compile the CoffeeScript app (may I recommend gulp.js?) A w...| Robert Mosolgo
Batman.js’s prevent and allowAndFire make it easy...| Robert Mosolgo
Batman.js objects (Batman.Object instances) have properties defined with @accessor. These properties are cached until one of...| Robert Mosolgo
If the batman-rails gem isn’t an option, gulp.js is a good candidate for compiling batman.js apps for production. To prepare your app for production, you need to: compile your CoffeeScript files into a JavaScript file preload your HTML into| Robert Mosolgo
A Batman.Model has a lifecycle object that fires events on the record when it’s being dirtied, cleaned, loaded, saved or destroyed. Hooking up callbacks Love ‘em or hate ‘em, Active Record callbacks can be just the thin...| Robert Mosolgo
Batman.js provides a powerful model associations inspired by Ruby on Rails. But, if you’re loading child items from ids, it’s not going to work out of the box. The problem Batman.js @h...| Robert Mosolgo
Just a few things I’ve picked up about Batman.RestStorage and Batman.RailsStorage. Use Model.url for hooking up to your API You can set the UR...| Robert Mosolgo
Living a day at a time sounds a bit like lazy enumeration. Jesus said not to worry about your life: “Do not be anxious about tomorrow, for tomorrow will be anxious for itself.” It’s a bit like...| Robert Mosolgo
When working on HTML for Batman.Views, it can be annoying to refresh and navigate back to wherever you were. Hacking into Batman.HTMLStore enables you to reload HTML without refreshing| Robert Mosolgo
Need to add a header to an ActiveResource request? If you need to do it at dynamically at request-time, redefine .headers. I needed to include header in my requests, but I didn’t just want to set it in the class definition.| Robert Mosolgo
Debugging can be tedious, especially when cntl-R is your only resort for trying new options. Instead, use batman.js’s $context function to access the context of a specific node. As I’m working with batman.js views, I use this technique for debugging in th...| Robert Mosolgo
Here’s how I set up Karma & Jasmine to test a Batman.js app on Ruby on Rails. (Actually, this is how we use it at work. Credit to Dan, as this is modeled af...| Robert Mosolgo
You can use Slim (or Haml) to serve your Batman.js templates in the Rails Asset Pipeline. 1. Include Slim in your gemfile Add this line to your Gemfile: ```ruby Gemfile gem “slim”| Robert Mosolgo
Creating a dynamic, context-based navigation menu is a breeze with batman.js and batman-rails thanks to Batman’s data-route view binding and the| Robert Mosolgo
My involvement with a Google App Engine-based project is winding down, so I’ll share what I’ve learned. Building for App Engine is tough If you’re thinking about starting a project on GAE, think about it carefully. I had a hard time with it for several reasons, bu...| Robert Mosolgo
Batman.js’s REST Storage Adapter provides a clean interface for operating on records with vanilla REST urls – but what about when you need a lil’ something more? First of all, the magic happens in| Robert Mosolgo
I had an existing app, but I wanted to take the front end to the next level. Batman.js is a full-featured, developer-friendly, Rails-inclined CoffeeScript (or JavaScript) framework with powerful Rails integration. Installing Batman.js I was alrea...| Robert Mosolgo
Countrysaurus is an online tool for merging country codes into a CSV spreadsheet with country names in it. You can also download a CSV of country codes or access it via REST API. In my old job, I often had spreadsheets with (sometimes misspelled) country...| Robert Mosolgo
I learned this the hard way, so I thought I’d share. A great feature of Rspec is its should_receive method, which checks if a message was sent to an object sometime during that spec. For example, this test would pass:| Robert Mosolgo
Valerie and I are on the way from Charlottesville, VA, to Carlsbad, CA. Here’s an update from our new home! Prose by Robert, photos by Valerie August 14 Driving to Gila Bend, AZ From Marfa, TX to Carlsbad, CA, was too long for a single day of driving, so we broke it up. The landsc...| Robert Mosolgo
Valerie and I are on the way from Charlottesville, VA, to Carlsbad, CA. Here’s an update from Gila Bend, AZ! Prose by Robert, photos by Valerie August 12 Austin, TX We started our day with a donut from Gourdough’s (pronounced like “Gordo’s”). It’s a famous fo...| Robert Mosolgo
Valerie and I are on the way from Charlottesville, VA, to Carlsbad, CA. Here’s an update from Austin, TX! Prose by Robert, photos by Valerie August 10 Panama City Beach, FL For the week of August 3-10, we were on vacation with the Wilders in Panama City Beach, FL. We had a great week...| Robert Mosolgo
It took me quite a while to realize that my GAEbackend wasn’t working because I had to use appcfg, not the| Robert Mosolgo
Google App Engine’s dev_appserver prevents filesystem writes because GAE has no filesystem – but sometimes you want to write anyways! I was working over a big set of data from the| Robert Mosolgo
On Google App Engine, I had to display the user-submitted image, if there was one, else display a default image. The given object could only have one image, so I was using the NDB BlobProperty:| Robert Mosolgo
Handling Files in WebApp2 and Google App Engine August 4, 2013 ...| rmosolgo.github.io
What makes a good ID? July 26, 2021 At my job, ...| rmosolgo.github.io