Skip to content

Instantly share code, notes, and snippets.

🏗
🗳️🌱🌷🌐🏗️🏓☢️

clay shentrup ClayShentrup

🏗
🗳️🌱🌷🌐🏗️🏓☢️
Block or report user

Report or block ClayShentrup

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ClayShentrup
ClayShentrup / days.rb
Last active Jan 31, 2020
Calculate number of days at least one employee is working
View days.rb
# frozen_string_literal: true
class DaysBinarySearchTree
attr_reader(:sum)
def initialize
@sum = 0
end
def size
@root.sum
View keybase.md

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:

View foo.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: adama
spec:
selector:
matchLabels:
app: adama
replicas: 1
template:
@ClayShentrup
ClayShentrup / one.rb
Last active Sep 2, 2018
Three ways to do STI factories
View one.rb
# 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
View foo.rb
before(:each) do
ENV['SITE_DOMAIN'] = 'periscopedata.com'
end
after(:each) do
ENV.delete('SITE_DOMAIN')
ActionMailer::Base.deliveries.clear
end
def send_queued_mail_and_expect_subject_to_be(expected_subject)
@ClayShentrup
ClayShentrup / alias_matchers.md
Created Dec 12, 2017 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3
View alias_matchers.md

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
View measurement_year.rb
# frozen_string_literal: true
require('method_object')
# Handles the measurement year window, including scopes to allow querying of QDM
# models within specified date ranges relative to the measurement year.
MeasurementYear = Struct.new(:program) do
def initialize(program:)
super(program)
end
View shock_map.rb
shock_cost_class_map = {
front: FrontShockCost,
lefty: LeftyShockCost,
rear: RearSHockCost,
}
shock_cost_class = shock_cost_class_map.fetch(type, ShockCost)
shock_cost_class.new.compute
@ClayShentrup
ClayShentrup / shock.rb
Last active Dec 29, 2017
Sandi Metz COC
View shock.rb
# Source: https://www.youtube.com/watch?v=f5I1iyso29U&t=23m44s
class Shock
def cost(type)
case type
when :front
FrontShockCost.new.compute
when :rear
RearShockCost.new.compute
when :lefty
LeftyShockCost.new.compute
@ClayShentrup
ClayShentrup / ajax.js
Last active Sep 20, 2016
Jasmine spec helper basics
View ajax.js
App.testHelpers.stubAjaxRequestWithData = function (requestURL, data, status) {
jasmine.Ajax.stubRequest(requestURL)
.andReturn({
status: status,
responseText: data,
contentType: 'text/html',
});
};
App.testHelpers.stubSuccessfulAjaxRequestWithData =
You can’t perform that action at this time.