Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rrgayhart's full-sized avatar

Romeeka Gayhart rrgayhart

View GitHub Profile

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@rrgayhart
rrgayhart / Level 2
Last active December 23, 2015 02:29
Ruby Warrior by Bloc Level 2 Solution
class Player
def play_turn(warrior)
if warrior.feel.empty?
warrior.walk!
else
warrior.attack!
end
end
end
Beginning Regex
Intro to Regular Expressions by Michael Fitzgeral
http://www.amazon.com/Introducing-Regular-Expressions-ebook/dp/B008K9OGDA/ref=sr_1_2?ie=UTF8&qid=1374171971&sr=8-2&keywords=Regular+Expressions
Using Regular Expressions in Ruby: Part 1 by Nell Shamrell
https://www.bluebox.net/insight/blog-article/using-regular-expressions-in-ruby-part-1-of-3
Intermediate Regex
@rrgayhart
rrgayhart / Nokogiri Links
Last active December 26, 2015 19:49
Nokogiri Links
@rrgayhart
rrgayhart / gist:7308789
Last active December 27, 2015 10:09
Links to CSS and HTML Group Templates
Simon
https://github.com/srt32
http://www.simontaranto.com/
Louisa
https://github.com/LouisaBarrett
http://www.linkedin.com/in/louisabarrett
Kevin
https://github.com/x46672
@rrgayhart
rrgayhart / gist:8188700
Created December 30, 2013 21:43
How to set up database cleaner and selenium testing and rspec
development and test gems
----------------------------------------------
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem "capybara"
gem 'selenium-webdriver'
gem 'shoulda-matchers'
gem 'launchy'
@rrgayhart
rrgayhart / readmelove.md
Created August 25, 2014 14:51
README Love

##PROTIP: README Love

READMEs are AWESOME. They are one of the best things you can add to a repo, (other than quality code), to make it look professional.

####Things that make a README great:

  • A link to the production site on heroku
  • A screenshot (or a few) of what the app does (This is especially important if you don't have the production app up and running yet)
  • Directions on how to clone or fork the repo and run it locally (explain it like you're explaining things to a totally new programmer)
@rrgayhart
rrgayhart / stubbing.md
Last active March 3, 2020 19:45
Webmock vs VCR for Testing External Calls

This is an excellent post that explains a little bit behind the difficulty in testing external services https://robots.thoughtbot.com/how-to-stub-external-services-in-tests How to Stub External Services in Tests

One simple option is to use Webmock

Here is an example of using Webmock in a similar way to what VCR does - which is recording and reading from a file

stub_request(:any, "www.example.com").

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded).

  • Did any of the responsibilities that she lists surprise you?
  • Do you feel like you mentally split your client side code in IdeaBox and other past projects into these responsibilities?

Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.