Skip to content

Instantly share code, notes, and snippets.

@CH-JesseMa
CH-JesseMa / CRUD_controller.rb
Created May 12, 2014 21:06
CRUD Controller (template)
class AppointmentsController < ApplicationController
def index
@appointments = Appointment.all
end
def show
@appointment = Appointment.find(params[:id])
end
def new
Backbone.Collection = {
fetch: function() {
var requestUrl;
if (isAFunction(this.url)) {
requestUrl = this.url();
} else {
requestUrl = this.url;
}
@CH-JesseMa
CH-JesseMa / test_setup
Last active August 29, 2015 14:00 — forked from catm705/gist:10011321
Setting Up App for Testing
---------------------------------------------------------------------------------------
#### If you want to create a new GIT repo + ADD travis-ci.org #####
--------------------------------------------------------------------------------------
1.) cd into your app
2.) git init --> from inside your folder
3.) Create the new repo on Github
(Below should show up after creating new Repo)
* git remote add origin git@github.com:catm705/registry_app.git
* git push -u origin master
@CH-JesseMa
CH-JesseMa / .travis.yml
Created April 25, 2014 19:13
Travis.yml file
language: ruby
rvm:
- 2.1.0
before_script:
- "sh -e /etc/init.d/xvfb start"
- "export DISPLAY=:99.0"
- "export JASMINE_SPEC_FORMAT=documentation"
env:
- PG_USERNAME='postgres'
script:
@CH-JesseMa
CH-JesseMa / Heroku Instructions
Created April 9, 2014 19:42
Heroku Instructions
#Steps for Heroku
git init
git add .
git commit -m "first commit"
heroku create
git push heroku master
# add rails 12factorgem
ruby -v
declare a ruby version
@CH-JesseMa
CH-JesseMa / form_for
Created April 9, 2014 18:20
form_for
<%= form_for :article do |f| %>
<p>
<%= f.label :title %><br>
<%= f.text_field :title %>
</p>
<p>
<%= f.label :text %><br>
<%= f.text_area :text %>
</p>
@CH-JesseMa
CH-JesseMa / Spec Helper Template
Created April 9, 2014 15:52
Spec Helper Template
require 'spec_helper'
describe "the site" do
describe "new user visits homepage" do
it "says Cappy App" do
visit("/")
expect(page).to have_content "Cappy App"
end
@CH-JesseMa
CH-JesseMa / Gem for Development and Test
Last active March 24, 2021 04:01
Gem for Development and Test
gem 'rails_12factor'
group :development, :test do
gem 'pry-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'guard'
gem 'guard-rspec'
gem 'guard-bundler', require: false
development: &defaults
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
username: <%= `echo $USER`.chomp %>
password:
database: <%= File.basename(Rails.root) %>_development
test:
@CH-JesseMa
CH-JesseMa / guard_setup.md
Created April 6, 2014 15:08 — forked from phlco/guard_setup.md
How to Setup Guard

Setting up Guard with Rspec

Guard watches a directory and runs commands when it sees changes to files.

This is great for automating your rspec tests!

Set up

Add guard and guard-rspec to your Gemfile