Skip to content

Instantly share code, notes, and snippets.

🐢
Merging at a Sustainable Pace ™️

Todd stratigos

🐢
Merging at a Sustainable Pace ™️
Block or report user

Report or block stratigos

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
@stratigos
stratigos / 2019-10-08_remote-video_wuts-gud.md
Last active Nov 13, 2019
Video Conferencing Tool Exploration
View 2019-10-08_remote-video_wuts-gud.md

Explore Video Conferencing Tools

Why

☝ In the spirit of continuous improvement, I would like to explore video conferencing tools to use at work with clients, to see if there are other options available that provide a more smooth, clear, and reliable experience.

View 2019-07-19_elm-language-guide.md

Elm Language Guide

  • 📆 2019-07-19
  • this spans many weeks / investment times
  • 📖 🌳️🕵‍♀️️ The Elm Language Guide
  • 👨‍💻📝️ an experienced OOP programmer learning FP and Elm

Installing Elm

Compared to my experiences using JavaScript over many years, I found installing

@stratigos
stratigos / 2019-04-19_functional-structures-scala.md
Last active Jul 12, 2019
Notes on "FSiS Part 1 - Type Constructors, Functors, and Kind Projector"
View 2019-04-19_functional-structures-scala.md

Functional Structures in Scala

  • 📆 2019-04-19
  • this spans many weeks / investment times
  • 📹 Screencast: Functional Structures
  • 👨‍💻📝️ an experienced OOP programmer learning FP and Scala
    • and maybe category theory? 🤔

On Kindedness

@stratigos
stratigos / clear_swap.sh
Created Nov 11, 2018
Clear Swap Space on Ubuntu Linux (14.04)
View clear_swap.sh
function clearswap { sudo swapoff -a && sudo swapon -a; }
@stratigos
stratigos / rspec_helper_token_auth_sign_in.rb
Last active Apr 19, 2018
RSpec Helper for Token-based Authentication Sign-In
View rspec_helper_token_auth_sign_in.rb
# Helpers to assist with the `devise_token_auth` security features, such as
# generation of new authentication tokens for each request.
# @see [devise_token_auth Github issue](https://github.com/lynndylanhurley/devise_token_auth/issues/75)
module RequestSpecHelper::ApiAuthHelper
module Extensions
# Helper method for authenticating a User for each Request type spec.
# Use `devise_token_auth` callback to generate an authentication token
# for each request.
# Call this on a created User at the beginning of a `describe` or `context`
@stratigos
stratigos / respec_helper_bearer_token_session_headers.rb
Last active Apr 19, 2018
RSpec Helper for Validating Token-based Auth Headers Returned with Request
View respec_helper_bearer_token_session_headers.rb
module RequestSpecHelper::SessionsHelper
# Set single expectation that checks auth headers were returned.
def expect_auth_headers(response)
expect(response.headers.keys).to include('access-token', 'client', 'expiry', 'uid')
end
end
########################################################################
@stratigos
stratigos / rspec_shared_example_defined_constants.rb
Created Apr 19, 2018
RSpec Shared Example Matcher for Class Constant Definition
View rspec_shared_example_defined_constants.rb
# Shared specs for models with frozen CONST values. Expects two String values
# as parameters.
RSpec.shared_examples :has_const_model do |const_name, const_value|
it { expect(described_class).to be_const_defined(const_name.to_sym) }
it { expect("#{described_class}::#{const_name}".constantize).to be_frozen }
it { expect("#{described_class}::#{const_name}".constantize).to eq(const_value) }
end
@stratigos
stratigos / rspec_validates_numericality_with_shoulda_matchers.rb
Created Apr 19, 2018
RSpec Validates Numericality of Active Record Model with Shoulda Matchers
View rspec_validates_numericality_with_shoulda_matchers.rb
# Shared specs for models with the `:validates_numericality_of` validators.
# Usage: pass a hash of each of the symbolized names of each options for the
# numericality validator. If the option has a value with which to evaluate
# against, add it as the value of that option hash name.
# E.g.:
# `it_behaves_like :validates_numericality_model, :numeric_attr, { greater_than_or_equal_to: 0, only_integer: true }`
RSpec.shared_examples :validates_numericality_model do |attribute_name, options|
it { is_expected.to validate_numericality_of(attribute_name) }
@stratigos
stratigos / rspec_soft_delete_shared_example.rb
Created Apr 19, 2018
RSpec Matcher for ActsAsParanoid / Paranoia Active Record Model Specs
View rspec_soft_delete_shared_example.rb
# Shared specs for models with the `acts_as_paranoid` features.
RSpec.shared_examples :soft_delete_model do
it { is_expected.to have_db_column(:deleted_at) }
it 'has a scope to select soft-deleted records' do
expect(described_class).to respond_to(:only_deleted)
end
it 'has a scope to select both not-deleted and soft-deleted records' do
@stratigos
stratigos / rspec_shared_example_with_shoulda_matchers_for_booleans.rb
Created Apr 19, 2018
RSpec Boolean Matcher Shared Example with Shoulda Matchers
View rspec_shared_example_with_shoulda_matchers_for_booleans.rb
# Shared specs for models with the `:validates_inclusion_of` validators, where
# Boolean values are specified. This is for use cases where Booleans are used
# in non-null DB columns, and validation errors need to be returned to actors
# attempting to store a NULL value (e.g., a IoT unit's firmware uploading a
# NULL value for an On/Off sensor reading).
# Additionally, `shoulda` will complain if `validate_inclusion_of` is used
# with the Booleans, and instead of turning off warnings, its best to just
# approach these specs differently. See
# [this github comment](https://github.com/thoughtbot/shoulda-matchers/issues/922#issuecomment-225752673)
# for more info.
You can’t perform that action at this time.