Skip to content

Instantly share code, notes, and snippets.

View ClayShentrup's full-sized avatar
🏗️
🗳️🌱🌷🌐🏗️🏓☢️

Clay Schöntrup ClayShentrup

🏗️
🗳️🌱🌷🌐🏗️🏓☢️
  • portland, oregon
View GitHub Profile
@ClayShentrup
ClayShentrup / one.rb
Last active September 2, 2018 05:59
Three ways to do STI factories
# assets.rb
FactoryBot.define do
factory(:asset) do
# definition
end
end
# audio_assets.rb
FactoryBot.define do
factory(:audio_asset, parent: :asset, class: AudioAsset) do
apiVersion: apps/v1
kind: Deployment
metadata:
name: adama
spec:
selector:
matchLabels:
app: adama
replicas: 1
template:

Keybase proof

I hereby claim:

  • I am clayshentrup on github.
  • I am clayshentrup (https://keybase.io/clayshentrup) on keybase.
  • I have a public key ASDQMBm3QhQ8qacuRk6T0E-1Fe-zjr9QhB6oHIM8emj6PQo

To claim this, I am signing this object:

@ClayShentrup
ClayShentrup / days.rb
Last active January 31, 2020 22:17
Calculate number of days at least one employee is working
# frozen_string_literal: true
class DaysBinarySearchTree
attr_reader(:sum)
def initialize
@sum = 0
end
def size
@root.sum
@ClayShentrup
ClayShentrup / testing_helpers.rb
Created January 22, 2021 19:41
Some fake db testing techniques I've used a bunch
# frozen_string_literal: true
RSpec.shared_context('customer_records') do
let!(:customer_record_model) do
stub_const('CustomerRecord', Class.new(AbstractCustomerRecord))
.tap { |model| model.establish_connection(test_db) }
end
let!(:customer_record_factory) do
FactoryBot::Factory.new(:customer_record)
end
import { mintNft } from "../lib/mint-nft"
import {ethers, waffle} from "hardhat";
import { Contract } from "@ethersproject/contracts"
describe("MyNFT", function () {
let signerAddress: string;
const tokenURI = "http://example.com";
let env: NodeJS.ProcessEnv;
let deployedContract: Contract;
@ClayShentrup
ClayShentrup / ethics.md
Created April 16, 2025 19:08
what is ethics?

what is ethics? remarkably few people seem to fully understand the subject, including most moral philosophers. thus, as you might imagine, this piece is going to be written at a fairly deep level, suitable for those with some background in ethics or utilitarian thought. that said, we’ll generally aim to use terms and concepts that any smart and attentive individual could understand. the goal is to illuminate these ideas as clearly as possible without diluting their intellectual depth.

when we see a bird tending to its egg at great personal cost, or stags engaging in ritualized dominance contests rather than fighting to the death, or humans instinctively rushing to help someone having a medical emergency—these are all just biological phenomena, which we can understand in the same way we understand why moths are attracted to light or why we crave sugar.

to see how fundamentally subjective ethics is, let's start with a classic ethical thought experiment known as the trolley problem. the basic scenario invo