Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am tomdalling on github.
  • I am tomdalling ( on keybase.
  • I have a public key ASDAMWx4M_UpLqjxz-ZUxQCZoDl8Tt18bKoclREuxqQo2go

To claim this, I am signing this object:

View gh.rb
require 'json'
'#' => '#216e39',
'+' => '#30a14e',
':' => '#40c463',
'-' => '#9be9a8',
'.' => '#ebedf0',
' ' => nil,
View minimal_repro.txt
Mutant environment:
Matcher: #<Mutant::Matcher::Config match_expressions: [C]>
Integration: rspec
Jobs: 8
Includes: []
Requires: ["./c"]
Subjects: 1
Total-Tests: 90
Selected-Tests: 1
Tests/Subject: 1.00 avg
View 1_without_details.txt
Running test/automated/zettel/hashtag_query.rb
matches the presence of a hashtag
with syntax: #a
provides logical NOT
with syntax: NOT #a
with syntax: not #a
with syntax: !#a
provides logical AND
with syntax: #a AND #b
tomdalling / delegated_types.rb
Created May 22, 2020
Alternative naming for `DelegatedTypes`
View delegated_types.rb
# Schema: entries[ id, account_id, creator_id, created_at, updated_at, specialization_type, specialization_id ]
class Entry < ApplicationRecord
has_specialization types: %w[ Message Comment ]
belongs_to :account
belongs_to :creator
# Schema: messages[ id, subject ]
class Message < ApplicationRecord
is_specialization_of 'Entry'
tomdalling /
Last active Feb 3, 2019
Tom's Narrow Guide to Melbourne

Tom's Narrow Guide to Melbourne

Places I like, for RubyConf AU attendees.

Coffee + Brunch Spots

  • Queen Victoria Markets
  • Degraves St
  • St Ali (South Melbourne, just outside the CBD. Must try the bottled iced lattes.)
  • Auction Rooms (North Melbourne, just outside the CBD)
tomdalling /
Created Jan 20, 2019
Mutant RSpec error output

When I do puts method_name inside #respond_to_missing?, it outputs begin, so it looks like it's treating self as if it were a Range.

This is the RSpec output:

An error occurred while loading ./spec/value_semantics_spec.rb.
Failure/Error: first_letter = method_name[self]

  stack level too deep
tomdalling /
Last active Apr 18, 2018
jekyll-include_snippet gem usage behind article:
title layout date snippet_source
Super Secret Methods

Here is a quirk of the Ruby language that I discovered a few weeks ago.

Method names can not contain a period character.

tomdalling /
Created Mar 13, 2018
value object stuff

I like the idea of providing an RSpec shared example to test all these behaviours.

For the constructor, I would change "consider using keywords" to "should use keywords". Keywords should be the default, unless the order is really obvious.

Re: "Value construction options could be provided by keyword arguments." I would probably prefer value contruction options to be in separate class methods, instead of #new.

Re: caching. I would be hesitant to do this at the global level (e.g. stored in the class).

tomdalling / after.rb
Last active Jul 7, 2019
Refactoring a controller action
View after.rb
class CommentsController
def create
result =, @user)
if result.ok?
render :partial => "comments/postedreply", :layout => false,
:content_type => "text/html", :locals => { :comment => result.value }
when :story_not_found
render :plain => "can't find story", :status => 400