Skip to content

Instantly share code, notes, and snippets.

@ornerymoose
ornerymoose / textbook_controller.rb
Created March 26, 2012 03:39
Gmaps4rails gem-Issue with map not being displayed, minimum distance is being calculated fine
def show
@textbook = Textbook.find(params[:id])
@this_user = User.find_by_id(session[:user_id])
@textbook.user_textbook_statuses.each do |attribute|
@map = Map.new(:to_location_id => attribute.user.location_id, from_location_id:
@this_user.location_id)
@from_address = @map.from_location.as_json(:only => [:latitude, :longitude])
@ornerymoose
ornerymoose / application.css
Created March 26, 2012 14:58
Application.js file for using gmaps4rails gem
/*
* 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.
*
@ornerymoose
ornerymoose / textbooks_controller.rb
Created March 27, 2012 20:45
Error Message: nil cannot be coerced into float
def show
@textbook = Textbook.find(params[:id])
@this_user = User.find_by_id(session[:user_id])
@textbook.user_textbook_statuses.each do |attribute|
@map = Map.new(:to_location_id => attribute.user.location_id, :from_location_id =>
@this_user.location_id)
@from_address = @map.from_location.as_json(:only => [:latitude, :longitude])
@to_address = @map.to_location.as_json(:only => [:latitude, :longitude])
@ornerymoose
ornerymoose / maps_controller.rb
Created April 2, 2012 05:30
Show of Map Controller
def show
@map = Map.find(params[:id])
loc_one = @map.to_location_id.as_json(:only => [:latitude, :longitude])
loc_two = @map.from_location_id.as_json(:only => [:latitude, :longitude])
dave_loc = [ loc_one, loc_two]
dave_loc = dave_loc.map do |marker|
{ lng: marker['longitude'], lat: marker['latitude'] }
end
map = [ dave_loc ]
@mapz = map.to_json
@ornerymoose
ornerymoose / maps_controller.rb
Created April 2, 2012 21:34
Cannot convert string into integer error message
def show
@map = Map.find(params[:id])
loc_one = @map.from_location_id.as_json(:only => [:latitude, :longitude])
loc_two = @map.to_location_id.as_json(:only => [:latitude, :longitude])
dave_loc = [ loc_one, loc_two ]
dave_loc = dave_loc.map do |marker|
{ lng: marker['longitude'], lat: marker['latitude'] }
end
map = [ dave_loc ]
@mapz = map.to_json
@ornerymoose
ornerymoose / show.html.erb
Created April 22, 2012 22:56
Map Show Page
<ul id="markers_list">
<%= gmaps({
"map_options" => { "auto_zoom" => true },
"markers" => { "data" => @markers, "options" => { "draggable" => true} }
})
%>
</ul>
#if I just have "zoom" and change the value it does not change anything.
@ornerymoose
ornerymoose / Gemfile
Created April 30, 2012 18:58
Terminal
source "http://rubygems.org"
gem "rails", "3.0.7"
gem "active_hash"
gem "dynamic_form"
gem "formtastic"
gem "geocoder", ">= 1.0.1"
gem "humanizer"
gem 'httparty'
@ornerymoose
ornerymoose / application.js
Created May 1, 2012 23:24
Doing the opposite of what I want it to do
//the text should initially be hidden, then when you click the link, it should show the text.
//weird thing is: for another section of the website, it works just fine. Thoughts?
//this is the one that works fine:
$("#about.faq .question h3 a").click(function(event){
event.preventDefault();
$(this).parents(".question").children(".answer").slideToggle(100);
$(this).toggleClass("active");
@ornerymoose
ornerymoose / bulk.html.haml
Created May 2, 2012 16:10
FAQ Page is Working Correctly.
= render :partial => "shared/sidebar_nav"
#about.static
.page-header
%h1 Bulk Buying
%section.content
%p.cursive Give the Gift of Choice!
%p CouponTrade now offers access to over 300 nationally recognized gift card brands. We have established direct relationships with key distributors to ensure that you receive maximum discounts.
%p If you're looking to upload Daily Deals and Gift Cards by the boatload, just give one of our listing representatives a shout and we'll walk you through the process.
%p.bold
@ornerymoose
ornerymoose / test.html
Created May 4, 2012 15:39
Not recognizing css reference
<html>
<head>
<link rel="stylesheet" type="text/css" href="static/bulk_order_form_style.scss" />
</head>
<body>
<div class="container">
...content