Skip to content

Instantly share code, notes, and snippets.

View alan707's full-sized avatar

Alan Mond alan707

View GitHub Profile
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
@alan707
alan707 / application.js
Created October 13, 2012 22:13
Application file
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
@alan707
alan707 / logo resize fail
Created November 11, 2012 19:53
logo resize fail
<%= link_to (image_tag "logo_black_bg.png", :alt => "1logo", :height => "22.625", :id=>"brand"), root_path, :class => "brand"%>
<img alt="1logo" id="brand" src="/assets/logo_black_bg.png" style="{:height=&gt;&quot;22px&quot;, :width=&gt;&quot;44px&quot;}">
<header class="navbar">
<div class="navbar-inverse navbar-static-top">
<div class="navbar-inner">
<div class="container">
<%= link_to (image_tag "logo_black_bg.png", :alt => "1logo", :style =>"width: 6cm;"), root_path %>
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
@alan707
alan707 / routes.rb
Created November 19, 2012 16:35
Showing user profiles
root :to => "home#index"
match '/users', :to => "users#show"
devise_for :users
resources :users
resources :tools
get "pages/feedback"
get "/tools/index" => "tools#index", :as => "browse"
get "about" => "pages#about", :as => "about"
@alan707
alan707 / UsersController_and_routes.rb
Created November 19, 2012 16:38
Users controller and Routes
#Controller
class UsersController < ApplicationController
before_filter :authenticate_user!
def show
@user=User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
@alan707
alan707 / gist:4111899
Created November 19, 2012 17:03
db error
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
Completed 500 Internal Server Error in 15ms
profiles /profiles(.:format) profiles#show
GET /profiles(.:format) profiles#index
POST /profiles(.:format) profiles#create
new_profile GET /profiles/new(.:format) profiles#new
edit_profile GET /profiles/:id/edit(.:format) profiles#edit
profile GET /profiles/:id(.:format) profiles#show
PUT /profiles/:id(.:format) profiles#update
DELETE /profiles/:id(.:format) profiles#destroy
tools GET /tools(.:format) tools#index
POST /tools(.:format) tools#create
@alan707
alan707 / index.html.erb
Created November 19, 2012 18:05
tools table
<% @tools.each do |tool| %>
<tr>
<td><%= link_to tool.title, tool %></td>
<td><%= tool.price %></td>
<td><%= tool.address %></td>
<td><%= link_to tool.user.try(:email), profiles_path %></td>
<!-- <td><%= link_to 'Show', tool %></td>
<!-- <td><%= link_to 'Edit', edit_tool_path(tool) %></td>
<td><%= link_to 'Destroy', tool, method: :delete, data: { confirm: 'Are you sure?' } %></td> -->