Skip to content

Instantly share code, notes, and snippets.

View alexbrinkman's full-sized avatar

Alex Brinkman alexbrinkman

View GitHub Profile
#!/usr/bin/env ruby
if `grep -rls --include "*.rb" --include "*.js" "debugger" .` != ""
puts "A debugger statement was found, remove before committing."
exit(1)
end
if `grep -rls --include "*.rb" "binding.pry" .` != ""
puts "A pry statement was found, remove before committing."
exit(1)
@alexbrinkman
alexbrinkman / .pryrc
Created October 21, 2019 21:31
.pryrc
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
@alexbrinkman
alexbrinkman / vscode-keybindings.json
Last active October 21, 2019 21:27
VSCode Key Bindings
// Place your key bindings in this file to overwrite the defaultsauto[]
[
{
"key": "shift+cmd+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus"
},
{
"key": "ctrl+cmd+down",
"command": "-editor.action.moveLinesDownAction",
@alexbrinkman
alexbrinkman / example2.rb
Created July 22, 2016 18:21
medium-open-closed-principle-within-devise-example2
class RegistrationsController < Devise::RegistrationsController
def create
super do
resource.add_role(:moderator)
resource.save
end
end
end
@alexbrinkman
alexbrinkman / example1.rb
Last active July 22, 2016 18:19
medium-open-closed-principle-within-devise-post-gist1
# POST /resource
def create
build_resource(sign_up_params)
resource.save
yield resource if block_given?
if resource.persisted?
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_flashing_format?
sign_up(resource_name, resource)
@alexbrinkman
alexbrinkman / RSpec Cheat Sheet.md
Last active February 21, 2017 16:01
RSpec Cheat Sheet

Controller Tests

render_views # If called within a describe, context, or whole spec will allow to use: 
expect(response.body).to have_content "..."

Built-in matchers

Equivalence

@alexbrinkman
alexbrinkman / Capybara Cheat Sheet.md
Last active October 17, 2024 12:06
A List of Methods for Capybara

Navigating

visit "/projects"
visit post_comments_path(post)

Clicking links and buttons

click_link "id-of-link"
click_link "Link Text"
@alexbrinkman
alexbrinkman / gist:ff81b92292d07256e57f
Last active August 29, 2015 14:01
Notes from my Ember meetup group presentation about Ember Conf 2014

Ember Conf 2014

Opening Keynote

Yehuda Katz & Tom Dale

Set the stage for the expectations and feel of the community - inclusive and welcoming