Skip to content

Instantly share code, notes, and snippets.

View jonathanroehm's full-sized avatar

Jonathan Roehm jonathanroehm

View GitHub Profile
@jonathanroehm
jonathanroehm / Testing Your Gem Locally.md
Last active October 10, 2023 01:33
How to test a gem you're working on locally in your development host ruby on rails app

Setting up your bundle config to allow your host app to use the local version of your gem

What we don't want:

Having to test your gem on your host app after having to commit changes to your gem... and then having to rebundle your gemfile ... which forces you to refer to your gem-in-process like:

gem 'nfg_ui', git: 'https://github.com/network-for-good/nfg_ui', branch: 'feature/some_feature_branch_that_im_working_on'

And then have to:

$ bundle update gem_name`
@jonathanroehm
jonathanroehm / Gemfile
Last active March 27, 2019 20:29
How to add `spring` to your rails plugin / engine for use with RSpec and beyond.
# In `your_engine/Gemfile` add the pertinent spring gems:
# Note, do not add spring gems as `spec.add_development_dependency`'s in your gemspec.
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gemspec
group :development do
gem 'spring'
gem 'spring-watcher-listen'
@jonathanroehm
jonathanroehm / Initialize Flatpickr with Rails Turbolinks and JQuery 3
Last active January 8, 2018 14:57
How to initialize flatpickr.js plugin in Rails with turbo links and JQuery 3
@jonathanroehm
jonathanroehm / Flatpickr styles for Bootstrap4 - validation & standard appearance
Last active January 8, 2018 14:55
When using flatpickr with alt input (for pretty formatting but submitting a conventional date, e.g for Rails), the form-control looks like a disabled input. This also fixes the appearance of validation states once a form has been validated.
.form-control.flatpickr-input{
&:disabled, &[readonly]{ background-color: #fff; }
}
// Be explicit on aria-invalid instead of pseudoclass :invalid / :valid
// Will allow error state to show on inputs like select2 and flatpickr
.form-control[aria-invalid='true']{
.was-validated & + .flatpickr-input,
.was-validated &{
border-color: $form-feedback-invalid-color;
@jonathanroehm
jonathanroehm / RubyTest.sublime-settings
Last active November 13, 2017 14:37
Sublime Text 3: RubyTest package user settings for RSpec, Test::Unit and Cucumber
// OSX Location: /Users/[username]/Library/Application Support/Sublime Text 3/Packages/User/RubyTest.sublime-settings
// To access RubyTest's user settings in Sublime Text 3:
// Sublime Text > Preferences > Package Settings > RubyTest > Settings - User
// Hot Keys when editing a (spec) file:
// Cmd + Shift + R -- Test this line
// Cmd + Shift + T -- Test this document
// Cmd + Shift + E -- Re-run previous test (can be executed from any file, does not need to be the spec file in question)