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.
Blog Archive
2024
Why Dairying Interests Me: Small, Grass-Fed, and Raw
Lake Road Farm: 2023 in Review
2023 was a big year for Lake Road Farm.
Here are some thoughts looking back at the year.
2022
Does it matter what we wear?
I’ve been wondering, besides keeping warm and being decent, does it matter what we wear?
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
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.
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.
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.
GraphQL Dataloader
GraphQL-Ruby 1.12 ships with a new GraphQL::Dataloader
feature for batch-loading data.
Books I Read in 2020
2020 turned out to be a great year for books.
2020
Books I Read in 2019
I thought I’d try to remember what I read last year.
2019
Finding implicit returns with Rubocop
Some notes on a refactor implemented with a Cop.
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’s appropriate.
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.
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.
2018
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.
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”.
Trip Report: Balkan Ruby 2018
This May, I had the opportunity to attend Balkan Ruby and present on my work with graphql-ruby.
How Ripper parses variables
Ruby has a few different kinds of variables, and Ripper expresses them with a few different nodes.
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.
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.
2017
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?
What's new in React-Rails 2.0?
For Planning Center free week, I cooked up react-rails
2.0 🎊.
Watching files during Rails development
You can tell Ruby on Rails to respond to changes in certain files during development.
Prototyping a GraphQL Schema From Definition With Ruby
GraphQL 1.5.0 includes a new way to define a schema: from a GraphQL definition.
Tracking Schema Changes with GraphQL-Ruby
One way to keep an eye on your GraphQL schema is to check the definition into source control.
Optimizing GraphQL-Ruby
Soon, graphql-ruby
1.5.0 will be released. Query execution will be ~70% faster than 1.3.0!
Parallelism in GraphQL-Ruby
It’s possible to get IO operations running in parallel with the graphql
gem.
Introducing GraphQL::Pro
graphql-ruby
is almost two years old! Today, I’m adding a new element to the project, GraphQL::Pro
.
2016
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.
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.
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?
Parameterized styles with React, Rails and Sprockets
css_modules
provides an approach to styling UI components in a local-first way.
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!
Summer Reading: Specializing Ruby
Specialising Dynamic Techniques for Implementing the Ruby Programming Language (“Specializing Ruby”) is approachable and enjoyable (despite being a PhD thesis 😝).
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.
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.
Ruby Class, meet Elixir Module
Elixir modules offer some valuable insight into designing Ruby classes.
Using GraphQL without Relay
2015
How many assertions per test case?
This question is too hard. Instead, ask, “how many behaviors per test case?” and answer, “one.”
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!
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.
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.”
Making Ginger Ale
I had leftover whey after making yogurt, so I made ginger ale.
Making Yogurt
This weekend I tried making yogurt. It worked!
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.
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.
Building up vs Building out
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.
Debugging: Behavior & Purpose
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.
Happy Refactoring by Keeping ApplicationController to a Minimum
Extending ActionController::Base
once, in ApplicationController
, is a great Ruby on Rails practice. However, if ApplicationController
is your only abstract controller, it’s likely to become a maintenance challenge. To avoid this, you should extend ApplicationController
as needed and move as much code as possible into its subclasses.
2014
Defining mruby Methods with C
You can use C code to prepare methods for mruby scripts.
Response to "Why Kids Sext"
The cover article of the November 2014 Atlantic Monthly told the story of sexting and police involvement in Louisa County, VA.
"Hello World" with mruby
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.
Why (I Think) We're Leaving Batman.js
Sadly, PCO is getting out of the batman.js game.
Render Scope in AngularJS and Batman.js
Being the Judge
I was just pondering whether a person ought to have children or not. It’s funny when I try to be the judge.
Computed Properties: Batman.js and Ember.js
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.
Event Handlers in Batman.js
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.
Batman.js and Devise
Model Transactions in Batman.js
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.
Batman.js Accessors as Methods
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!
Build a Blog with Batman.js
Client-Side Image Preview with Batman.js
Implementing image preview is breeze thanks to batman.js observers and JavaScript APIs.
Has Many Through in Batman.js
Batman.js doesn’t support hasManyThrough
out of the box, but it can be implemented fairly easily with Set::mappedTo
.
Jasmine-Friendly Batman.js Accessor Stubs
Batman.Object
accessors are the bread and butter of batman.js. Stubbing them can make testing much easier.
Integrate Batman.js and Leaflet with a Custom View
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 Batman.Model
s with leaflet.js
Getting to Know Batman.Set
Batman.Set
is the array-like enumerable of batman.js. It offers observable properties (which are automatically tracked by @accessor
) and useful change events.
Sending JSON Instead of Form Data with Batman.RestStorage
By default, Batman.Request
sends data as HTTP form data. However, you can override this with Batman.RestStorage
.
Batman.js Controller Testing with Jasmine
Automatic Source Tracking in Batman.js
In batman.js, properties automatically track their sources. This is done by tracking all calls to get
when an accessor function is executed.
Introducing the Batman.js MVC Cookbook
The “Batman.js MVC Cookbook” is a collection of annotated code snippets for getting things done with batman.js.
Is Batman.js Just for Ruby on Rails?
You can use batman.js with any backend!
Prevent and allowAndFire for asynchronous operations on a Batman.Set
Batman.js’s prevent
and allowAndFire
make it easy to fire a callback when you’re finished working on the members of a Batman.Set.
Property Caching in Batman.js
Batman.js objects (Batman.Object
instances) have properties defined with @accessor
. These properties are cached until one of their sources busts their cache.
Using Gulp.js to build Batman.js apps without Rails
If the batman-rails gem isn’t an option, gulp.js is a good candidate for compiling batman.js apps for production.
Batman.Model Lifecycle Callbacks
A Batman.Model
has a lifecycle
object that fires events on the record when it’s being dirtied, cleaned, loaded, saved or destroyed.
Loading Child Records from Embedded IDs in Batman.js
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.
Tips for Batman.RestStorage and Batman.RailsStorage
Just a few things I’ve picked up about Batman.RestStorage
and Batman.RailsStorage
.
Christian Life as a Lazy Enumerable
Living a day at a time sounds a bit like lazy enumeration.
Reload HTML for Batman.Views
When working on HTML for Batman.View
s, it can be annoying to refresh and navigate back to wherever you were. Hacking into Batman.HTMLStore
enables you to reload HTML without refreshing
Dynamically-Generated Headers for ActiveResource Requests
Need to add a header to an ActiveResource request? If you need to do it at dynamically at request-time, redefine .headers
.
Debugging Keypaths in Batman.js Views
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.
Batman.js testing with Karma and Jasmine
2013
Slim Templates with Batman.js and the Rails Asset Pipeline
Dynamic Navigation View with Batman.js
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 object[key] view filter. Here’s how I did it.
Lessons Learned on Google App Engine
My involvement with a Google App Engine-based project is winding down, so I’ll share what I’ve learned.
Load Batman.js Models from Specific Urls
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?
Adding Batman.js to an Existing Rails App
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.
Convert country names and codes with Countrysaurus
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.
Rspec should_receive stubs methods
I learned this the hard way, so I thought I’d share.
Roadtrip part 3
Valerie and I are on the way from Charlottesville, VA, to Carlsbad, CA. Here’s an update from our new home!
Roadtrip Part 2
Valerie and I are on the way from Charlottesville, VA, to Carlsbad, CA. Here’s an update from Gila Bend, AZ!
Roadtrip part 1
Valerie and I are on the way from Charlottesville, VA, to Carlsbad, CA. Here’s an update from Austin, TX!
Using Command-Line Tools for Backends on Google App Engine
It took me quite a while to realize that my GAE backend wasn’t working because I had to use appcfg, not the App Engine Launcher to deploy it. App Engine Launcher’s “deploy” button wouldn’t do it.
Enable filesystem writes in GAE dev_appserver
Google App Engine’s dev_appserver
prevents filesystem writes because GAE has no filesystem – but sometimes you want to write anyways!
Serving static files in WebApp2 reponses
On Google App Engine, I had to display the user-submitted image, if there was one, else display a default image.
Handling Files in WebApp2 and Google App Engine
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 on image, so I was using the NDB BlobProperty: