Skip to content

Instantly share code, notes, and snippets.

@Tasha25
Tasha25 / Sinatra - Startup App
Created May 3, 2014 19:38
Sinatra - Possible startup app
Name
mkdir config db helpers lib models public routes views
mkdir db/migrate
touch config.ru Gemfile main.rb Procfile README
touch database.yml environments.rb unicorn.rb
touch helpers/helper1.rb
touch helpers/init.rb
@Tasha25
Tasha25 / Ajax_Will_Paginate
Created January 30, 2014 16:23
Ajax request with will paginate
1. Create javascript file in folder with data you want to render. For example, I want a list of service providers so I ahve to go into views>service_providers and I will put my javascript index file in there:
I will be rendering out of the index page so I am going to label my file
index.js.erb
2. In my views>service_providers>>index.html.erb I have a partial with the list of service providers. I wrapped that content in a div with an id called "service-providers-list". This will allow me to pull that information into jquery
<section class="main col col-lg-7">
<div id="service-providers-list">
@Tasha25
Tasha25 / Rspec setup for Zombie
Created November 21, 2013 22:36
Zombie Rspec setup, gemfile not as awesome as candy_app
Creating a rails rspec document
$rails _3.2.14_ new zombie_rails -d postgresql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
@Tasha25
Tasha25 / Active Record Migration
Last active December 29, 2015 00:29
Active record when you have to add a column
rails generate migration AddIqToZombie iq:integer
You have to tell the ActiveRecord what they are doing Add
You have to tell them to what column to add Iq
You have to tell them to what table Zombie
You have to tell them the type of material that it will be, in this case iq will be an integer
@Tasha25
Tasha25 / Rspec-rails, Nokogiri, Httparty
Last active September 17, 2020 17:49
`rspec-rails`, `nokogiri`, and `httparty` in a rails project.
Create a new rails app called `gray_lady_app` outside of your kick_hash folder.
__It should not be in a git repo.__
Add `rspec-rails`, `nokogiri`, and `httparty` to your gemfile and create a model called `Scraper`
=====================================================
$ rails _3.2.14_ new gray_lady_app -d postgresql
In Gemfile
@Tasha25
Tasha25 / Rspec and Guard
Created November 19, 2013 00:11
Rspec and Guard in order to run rspec
Go into the folder you want rspec to run in
$ rspec --init
Go into folder
$cd spec/
Create your files that will end with the '_spec.rb'
ex: "school_spec.rb"
@Tasha25
Tasha25 / Nothing
Created November 14, 2013 01:19
Having people not get to the edit page unless authorized
Nothing to add
@Tasha25
Tasha25 / Another version for session
Created November 14, 2013 00:03
Fully explain session
## This is saying the same thing
def current_user
if session[:user_id]
@current_user ||= User.find(session[:user_id])
end
end
helper_method :current_user
@Tasha25
Tasha25 / Paperclip rough draft
Created November 13, 2013 18:39
Paperclip for images draft.
rails new app
rake db:create; rake db:migrate
Added new input fied so you can add photos.
If you have folder you can just click on the button and we will upload it
@Tasha25
Tasha25 / Steps to create a repo
Created November 13, 2013 14:15
Ways to create a repo off of an existing project.
Create a new Repository aside from the one that already exists for a project.
Go into the file you want to push up.
ex: CourtPOv1
Get the git name and push up to it in the terminal. I substitute tasha for origin. That can be anything you want it to be.
$ git remote add tasha git@github.com:Tasha25/CourtPOv1.git