Skip to content

Instantly share code, notes, and snippets.

View catm705's full-sized avatar

Cat Gelinas catm705

View GitHub Profile
@catm705
catm705 / gist:10599928
Created April 13, 2014 20:00
partial forms
-------------------------------------------------------------
new.html.erb --> PARTIAL FORMS
-------------------------------------------------------------
<div id="main">
<h1><em>Wish U Were Here</em></h1>
<% if logged_in? %>
<p>Hi, <%= current_user.name %>!<br><br>
<img src=<%= current_user.image_url %> alt="User Profile Pic" />
<br>
<span class="tagline">Where would YOU rather be?</span>
@catm705
catm705 / gist:10985104
Last active August 29, 2015 13:59
API - in Seed Data
###### seed.rb ###################
######################################
Complaint.delete_all
url = "http://data.cityofnewyork.us/resource/erm2-nwe9.json"
response = HTTParty.get(url)
response.each do |incident|
# c = Complaint.new
@catm705
catm705 / gist:11009142
Last active August 29, 2015 14:00
Jasmine Set up in Spec Folder
1.) Add the gem 'jasmine' to your gemfile like so:
group :development, :test do
gem 'launchy'
gem 'capybara'
gem 'pry-rails'
gem 'selenium-webdriver'
gem 'rspec-rails', '~> 3.0.0.beta'
gem 'jasmine'
# gem 'guard'
# gem 'guard-rspec'
@catm705
catm705 / gist:11047278
Last active August 29, 2015 14:00
Palindrome Rails App
----------------------------------------------------------
Palindrome.rb
----------------------------------------------------------
# In ActiveRecord docs as 'validates_with'
class ValidPalindrome < ActiveModel::Validator
def validate(record)
test_string = record.text
unless test_string == test_string.reverse
record.errors[:text] << 'This is not a Palindrome.'
<!-- views/picture/index.html.erb -->
<% if flash[:msg] %>
<%= flash[:msg] %>
<% end %>
<br>
<%= link_to "create picture", new_picture_path(@picture) %>
<br>
<br>
<% @pictures.each do |picture| %>
<img src="<%= picture.image_url %>" alt="" width="300px"/>
@catm705
catm705 / gist:11255842
Last active March 24, 2021 04:02
GIT with GROUPS
________________________________________________________________________
**** GIT HUB WITH GROUP PROJECTS ****
________________________________________________________________________
* git branch -d → Will delete the branch completely if it SUCKS.
* AlWAYS pull first before you start your work.
* git checkout develop → Never work on master branch.
- Your MASTER branch must always work.
________________________________________________________________________
** Beginning of Day: **
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
@catm705
catm705 / gist:2778e238e9536a5afc21
Created May 20, 2014 20:20
AJAX API calls in RAILS
---------------------------------
---- searches_controller.rb -----
---------------------------------
def create
# 1.) js file
# 2.) click event to prevent default route to the controller from js with the url.
# get value from form
# ajax request to send form data
1. Go to herokuapp dashboard
2. Go to your app --> then 'settings'
3. Click on 'Get add ons' --> Then find 'New Relic' and click to read the docs
4. Then from within your app in the terminal type: heroku addons:add newrelic:stark
5. Go back to your app on heroku and click on the "New Relic" icon.
6. Then in the page that opens up click on 'I agree'
7. Add this gem to your gemfile --> gem 'newrelic_rpm' in production - like so:
group :production do
gem 'newrelic_rpm'
@catm705
catm705 / gist:3b4cfc2cc227b3b04b10
Last active August 29, 2015 14:02
GIT adding and committing files.
Whenever you make any changes:
(You must add and commit all changes BEFORE trying to pull or else it won't work)
1.) cd into that folder where the changes are located.
2.) git add . (This will add all changes, if that doesn't work git add -A)
3.) git commit -m "Your commit message goes here...blah, blah."
4.) git pull upstream master --> This will make sure that you have the most recent files.
5.) git push origin master (This pushes up all your changes to your repo)