Skip to content

Instantly share code, notes, and snippets.

View lukes's full-sized avatar

Luke Duncalfe lukes

View GitHub Profile
@theorygeek
theorygeek / association_loader.rb
Last active June 6, 2025 19:25
Preloading Associations with graphql-batch
# frozen_string_literal: true
class AssociationLoader < GraphQL::Batch::Loader
attr_reader :klass, :association
def initialize(klass, association)
raise ArgumentError, "association to load must be a symbol (got #{association.inspect})" unless association.is_a?(Symbol)
raise ArgumentError, "cannot load associations for class #{klass.name}" unless klass < ActiveRecord::Base
raise TypeError, "association #{association} does not exist on #{klass.name}" unless klass.reflect_on_association(association)
@klass = klass
@BrianPugh
BrianPugh / State-Blocks.md
Last active April 8, 2018 08:12
State-Blocks

NEP-01: State Blocks

NANO

The implementation of state blocks (known as "universal blocks") is a protocol improvement that encodes all account data in every transaction. This allows the following:

  1. Simplifies account balance computation and block verification
  2. Enables inexpensive hardware to easily and securely sign transactions
  3. Aggressive pruning of the block-lattice

Legacy Blocks