Skip to content

Instantly share code, notes, and snippets.

View catm705's full-sized avatar

Cat Gelinas catm705

View GitHub Profile

Moving your project up

When you work on a Rails project you want your .git repo to be in the root of your Rails App.

This is very important for hosting your app on Heroku.

Many of you have the following repo structure:

# A project folder, with a rails app inside of it.
@catm705
catm705 / database.yml
Last active August 29, 2015 13:58
database.yml
#put $ echo $USER cgelinas in the terminal RIGHT AFTER putting this in your database.yml file!
development: &defaults
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
username: <%= `echo $USER`.chomp %>
password:
database: <%= File.basename(Rails.root) %>_development
group :development, :test do
gem 'pry-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'guard'
gem 'guard-rspec'
gem 'guard-bundler', require: false
gem 'terminal-notifier-guard'
gem 'shoulda-matchers'
end
@catm705
catm705 / gist:10011321
Last active March 24, 2021 04:01
Steps for Rails w/Rspec App (initlal - no CRUD, just for :development, :test)
----------------------------------------------------------------------
#### Steps to create Rails App ####
----------------------------------------------------------------------
1.) rails new app_name -d postgresql
'Jesse's way': rails g model Complaint descriptor:string address:string latitude:decimal longitude:decimal zip:integer
2.) database.yml → 'Phil's gist'
- put in: echo $USER in the terminal right after to make sure it works.
3.) rake db:create
4.) Insert ‘gem’ gist for development:
@catm705
catm705 / Gemfile
Last active August 29, 2015 13:58 — forked from phlco/Gemfile
# What about including `pry`, `rspec` or `guard`?
# They're loaded automatically as dependencies
group :development, :test do
# Annotates ActiveRecord Models, routes and others based on the database schema
gem "annotate"
# generates entity relationship diagrams based on Active Record models
# Postscript bugs may be fixed with:
@catm705
catm705 / gist:10171658
Last active March 24, 2021 04:02
Setting up HEROKU (Cat-style) ^^
--- HEROKU STEPS to SET UP: ---
(Make sure you're all pushed/pulled on master before doing anything heroku)
1. git init
2. git add -A
3. git commit -m “blah, blah”
4. heroku create
5. To add heroku ENV keys/variables → (If there are any).
@catm705
catm705 / gist:10308993
Last active August 29, 2015 13:58
Rails CODE SNIPPETS: link_to, image_path, form_form, form_tag
<% if flash[:msg] %>
<%= flash[:msg] %>
<% end %>
-------------------------------
<%= link_to "Sign Up", new_user_path(@user) %>
-------------------------------
edit.html.erb (hipchat history)
<%= render 'form' %>
-------------------------------
<%= form_for(@user) do |f| %>
@catm705
catm705 / Gemfile
Last active August 29, 2015 13:58 — forked from zioplox11/Gemfile
GEMFILE - USE THIS ONE!!
group :development, :test do
gem 'launchy'
gem 'capybara'
gem 'pry-rails'
gem 'rails-erd'
gem 'rspec-rails', '~> 3.0.0.beta'
gem 'jasmine'
gem 'shoulda-matchers'
gem 'factory_girl_rails'
gem 'rubocop'
@catm705
catm705 / gist:10420518
Created April 10, 2014 20:33
Procs, Methods, Blocks, Functions
# def log_before_doing()
# puts "About to do stuff in a block."
# yield
# yield
# end
# log_before_doing() { puts "Doin' stuff in a block."}
# def do_ten_times()
# 10.times { yield }
@catm705
catm705 / gist:10547367
Last active August 29, 2015 13:59
API Parsing - Using Instagram
---------------------------------------------------------------------
user.rb
---------------------------------------------------------------------
# == Schema Information
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# email :string(255)
# password_digest :string(255)