Skip to content

Instantly share code, notes, and snippets.

<h1>Here's some info about one user:</h1>
<ul>
<li>Id: <%= @user.id %></li>
<li>Name: <%= @user.name %></li>
<li>Email: <%= @user.email %></li>
<li>Phone: <%= @user.phone %></li>
</ul>
<h3>Posts</h3>
<h1>users#index</h1>
<p>Find me in app/views/users/index.html.erb</p>
<% @users.each do |user| %>
<p>
<%= user.first_name %>
<%= user.last_name %>
<%= link_to "Delete This User", user_path(user), method: :delete, data: {confirm: "Are you sure you want to delete this user?"} %>
</p>
<% end %>
<h1>users#index</h1>
<p>Find me in app/views/users/index.html.erb</p>
<% @users.each do |user| %>
<p>
<%= user.first_name %>
<%= user.last_name %>
<%= link_to "Delete This User", user_path(user), method: :delete, data: {confirm: "Are you sure you want to delete this user?"} %>
</p>
<% end %>
@kareemgrant
kareemgrant / sublime_settings.json
Created July 12, 2014 13:53
sublime settings CodeNow
{
"auto_match_enabled" : true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"draw_white_space": "all",
"folder_exclude_patterns": [".git"],
"font_face": "Courier New",
"font_size": 14.0,
"ignored_packages":
[
@kareemgrant
kareemgrant / instructions.md
Created February 15, 2014 17:24
State Capital Assignment - Ruby Hashes and Arrays

State Capital Assignment

This exercise will help you better understand Arrays and Hashes

Use the data provided in state_capitals.rb to write a program that does the following.

  1. Prints out the names of all states that have a population greater than 5 million.

  2. Returns the name of the capital when given the name of the state.

@kareemgrant
kareemgrant / state_capitals.rb
Created November 23, 2013 18:03
Example of array of hashes used to for teaching purposes. #codenow
[{:us_state=>"Alabama", :state_capital=>"Montgomery", :population=>"4822023"},
{:us_state=>"Alaska", :state_capital=>"Juneau", :population=>"731449"},
{:us_state=>"Arizona", :state_capital=>"Phoenix", :population=>"6553255"},
{:us_state=>"Arkansas",
:state_capital=>"Little Rock",
:population=>"2949131"},
{:us_state=>"California",
:state_capital=>"Sacramento",
:population=>"38041430"},
{:us_state=>"Colorado", :state_capital=>"Denver", :population=>"5187582"},
nba_teams = [{"mascot"=>"Thunder", "city"=>"OKC"}, {"mascot"=>"Heat", "city"=>"Heat"}, {"mascot"=>"Knicks", "city"=>"NYC"}, {"mascot"=>"Nets", "city"=>"Brooklyn"}]
@kareemgrant
kareemgrant / interview.md
Created June 25, 2013 19:08 — forked from austenito/interview.md
common programming Interview questions (ruby)

Ruby Questions

  • What is a class?
  • What is an object?
  • What is a module? Can you tell me the difference between classes and modules?
  • Can you tell me the three levels of method access control for classes and modules? What do they imply about the method?
  • There are three ways to invoke a method in ruby. Can you give me at least two?
  • Explain this ruby idiom: a ||= b
  • What does self mean?
@kareemgrant
kareemgrant / sessions_controller_spec.rb
Created June 20, 2013 07:23
Example of mocking and stubbing within a controller_spec
require 'spec_helper'
describe SessionsController do
describe "POST .create" do
it "redirects to profile after authorization" do
user = double('user', id: 1)
User.stub(:from_omniauth).and_return(user)
post :create
expect(response).to redirect_to profile_path
@kareemgrant
kareemgrant / gitignore.txt
Last active March 24, 2017 14:40
Common gitignore
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
*.rbc
*.sassc
.sass-cache
capybara-*.html