Skip to content

Instantly share code, notes, and snippets.

View libbyschuknight's full-sized avatar
🏡
Working remotely

Libby Schumacher-Knight libbyschuknight

🏡
Working remotely
View GitHub Profile
@libbyschuknight
libbyschuknight / env.rb
Created January 4, 2018 20:47
Getting fixtures working for features when using cucumber
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require 'cucumber/rails'
require_relative 'fixture_access'
# Capybara defaults to CSS3 selectors rather than XPath.
#!/usr/bin/env ruby
require "pathname"
root = Pathname.new(".")
libs = root.children.select(&:directory?).collect(&:realpath)
libs.each do |lib|
Dir.chdir(lib.realpath.to_s) do
system "yard"
@libbyschuknight
libbyschuknight / pr_emojis.md
Last active November 5, 2017 23:05
Pull Request Emojis

PR Emojis

When reviewing a Pull Request, the more Emoji the better ✨. These ones have a defined meaning:

  • 💡 FYIs (such as: "💡In another service, we solve a similar problem in this way")
  • ⚠️ blocking (such as: "⚠️ I don't think this will work for these edge cases")
  • 🐘 non-blocking (such as: "🐘 This could be more elegant by doing it a different way")
  • 🍄 code smell (such as: "🍄 This seems like a lot of logic for a view")
  • 💭 thought (such as: "💭I wonder if we could use this pattern in other services?")
  • compliments (such as: "✨This is some great code, computer friend!")
# Built-in config:
# https://github.com/bbatsov/rubocop/blob/master/config/default.yml
# We do not typically use/need class documentation
Documentation:
Enabled: false
Metrics/LineLength:
Max: 120
@libbyschuknight
libbyschuknight / if-unless.rb
Last active February 26, 2016 02:16
how to re-write if/else with unless
json_error = JSON.parse(error.response.body)["error"]
if json_error == "error:price_not_found"
nil
else
raise error
end
# better like this, does same thing
json_error = JSON.parse(error.response.body)["error"]
raise error unless json_error == "error:price_not_found"
begin
raise BadRequest
rescue => error
p error.inspect
end
sjdflksdf
;dflsf
if adslalhsdfds
tadslhfalshdflhdf
else
lkdsflshd
end
@libbyschuknight
libbyschuknight / erb-helper-atom.txt
Created November 15, 2015 04:40
atom erb-helper
ERB Helper
Command Name ERB Value Key Binding
ERB Output <%= %> CTRL + SHIFT + .
ERB Eval <% %> CTRL + .
ERB Comment <%# %> CTRL + SHIFT + 3
@libbyschuknight
libbyschuknight / trick_Create.rb
Created November 15, 2015 04:39
trick rails create
def create
fail
end
# will show
{"utf8"=>"✓",
"authenticity_token"=>"Kg0ES4VZZOeqhk+Axold+asCEkNKodWT+T77iIxRvKRdfYe0r9YBjbrcBgLuPyR74XBMLDa7Bc7IHcxcfkSogw==",
"article"=>{"title"=>"From page",
"body"=>"This is quite a cool css"},
@libbyschuknight
libbyschuknight / rspec_ideas.rb
Last active December 21, 2015 20:25
rspec ideas / ways of doing
expect( this action ).to change( something ).by(1)
# trick
expect(response.body).to eql ""
### Use of 'anything' below
# old? - https://www.relishapp.com/rspec/rspec-mocks/v/2-7/docs/argument-matchers/general-matchers
# http://blog.endpoint.com/2014/09/rspecs-anything-argument-matcher.html
# http://www.rubydoc.info/gems/rspec-mocks/RSpec/Mocks/ArgumentMatchers