Skip to content

Instantly share code, notes, and snippets.

View gkemmey's full-sized avatar

Gray Kemmey gkemmey

View GitHub Profile
@gkemmey
gkemmey / init.coffee
Created April 23, 2020 16:03
atom_disable_spell_check_for_html_files
# default to spell check off for html files, but let us toggle it back on with
# command pallete
#
# ref: https://github.com/atom/spell-check/issues/137#issuecomment-613583440
# ref: https://discuss.atom.io/t/how-to-toggle-off-spell-check-on-startup/39062/7
atom.workspace.observeTextEditors (editor) ->
if editor.element.spellcheck
if editor.getGrammar().id? && editor.getGrammar().id.includes("html")
setTimeout ->
atom.commands.dispatch(atom.views.getView(editor), 'spell-check:toggle')
@gkemmey
gkemmey / custom_form_error_rendering.rb
Created June 5, 2019 15:56
Rails remote form error handling
# -------------------------------------------------------------------------------------------------
# monkey patches ActionView::Helpers::Tags module and adds a wrapper tag. additionally,
# patches ActionView::Helpers::FormBuilder to add a `wrapper` method. this will allow you to
# use the following in your forms:
#
# <%= f.wrapper :email, :div, class: "control" do %>
# <%= f.email_field :email, placeholder: "you@example.com", class: "input is-danger" %>
# <% end %>
#
# we do it this way, so the wrapper is aware of the model object it's building, and thus the
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
def click_invisible(element)
script = <<-JS
arguments[0].click();
JS
execute_script(script, element.native)
end
def scroll_to(options = {})
@gkemmey
gkemmey / Gemfile.lock
Last active April 4, 2019 21:31
[fresh_rails_6.0.0beta3_install]
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.0.beta3)
actionpack (= 6.0.0.beta3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.0.beta3)
actionpack (= 6.0.0.beta3)
activejob (= 6.0.0.beta3)
@gkemmey
gkemmey / local_ssl.md
Created August 28, 2017 20:32
HTTPS in development with Rails / Puma

1) Create your private key (any password will do, we remove it below)

$ cd ~/.ssh
$ openssl genrsa -des3 -out local_ssl.orig.key 2048

2) Remove the password

@gkemmey
gkemmey / javascript_driver.rb
Created February 7, 2017 17:52
This is a mixin that configures a test to use Capybara and Selenium. You can include the `JavascriptDriver` module in your `test_helper.rb`, and then include it in any test files that need to execute Javascript code.
module JavascriptDriver
def self.included(base)
base.class_eval do
include Capybara::DSL # make the Capybara DSL available in all javascript tests
# we can't have our tests runnning in separate fixutres or selenium (capybara) won't have
# access to the data created in the test and vice versa
self.use_transactional_fixtures = false
end