Skip to content

Instantly share code, notes, and snippets.

View johnmeehan's full-sized avatar
:octocat:

John Meehan johnmeehan

:octocat:
  • Meetyl
  • Ireland
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@leesmith
leesmith / commit-message-syntax.txt
Created December 31, 2011 06:05
Pivotal Tracker post-commit message syntax
https://www.pivotaltracker.com/help/api?version=v3#github_hooks
https://www.pivotaltracker.com/help/api?version=v3#scm_post_commit_message_syntax
SCM Post-Commit Message Syntax
To associate an SCM commit with a specific Tracker story, you must include a special syntax in the commit message to indicate one or more story IDs and (optionally) a state change for the story. Your commit message should have square brackets containing a hash mark followed by the story ID. If a story was not already started (it was in the "not started" state), a commit message will automatically start it. For example, if Scotty uses the following message when committing SCM revision 54321:
[#12345677 #12345678] Diverting power from warp drive to torpedoes.
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@xuncheng
xuncheng / spec_has_many_through.rb
Created July 2, 2013 10:30
rspec testing has_many :through association
# video.rb
class Video < ActiveRecord::Base
has_many :categorizations
has_many :categories, through: :categorizations
end
# category.rb
class Category < ActiveRecord::Base
has_many :categorizations
has_many :videos, through: :categorizations
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 27, 2024 08:12
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@johnmeehan
johnmeehan / basic_rails_template.rb
Last active August 29, 2015 14:11
A basic Rails Application Template- Haml-Rspec-Capybara-Guard-Livereload-Bootstrap-FactoryGirl
# require 'pry'; binding.pry
# Rails Project Template
# Run with:
# rails new MyApp -T -m http://.............
# John Meehan 2015
# Set the ruby version to that of the RVM
insert_into_file('Gemfile', "ruby '#{RUBY_VERSION}'\n", :before => /^ *gem 'rails'/, :force => false)
# Set the Gemset name based on the Rails app name
insert_into_file('Gemfile', "#ruby-gemset=#{@app_name}\n", :before => /^ *gem 'rails'/, :force => false)
@emilio2hd
emilio2hd / docker-pocket.txt
Last active April 25, 2018 09:18
Docker Pocket
# Build an image
docker build -t <image_name> <dockerfile_path>
# Run a container
docker run -d -p <host_port>:<container_port> --name <container_name> <image_name>
PS1: In this sample, I'm mapping ports with option '-p'. For more details, see below.
PS2: You can add links among containers using --link <container_name>:<alias> option.
# Start a bash session at a running container
docker exec -it <nome_container> bash
@Arjeno
Arjeno / circle.yml
Created August 17, 2016 13:57
Always use the latest version of Chrome on CircleCI
# This makes sure Chrome is always up to date in your test suite
# On average this adds about 10 seconds to your build suite
# Be sure to use Ubuntu 14.04 (Trusty) in the CircleCI's OS setting (Settings > Build Environment)
dependencies:
pre:
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome.deb
- sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
- rm google-chrome.deb