This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{:message=>"We are in awe of this #toxinfree #moss #garden in #SagHarbor. Wow! It is #PRFCT http://t.co/icRmnwxTTT", :created_at=>2015-08-26 18:16:11 +0000, :source=>"Twitter"}, {:message=>"This how to guide includes cutting back on pesticides and herbicides.", :created_at=>"2015-08-26T18:25:34+0000", :source=>"Facebook", :picture=>"https://fbexternal-a.akamaihd.net/safe_image.php?d=AQDPHuCOo9Q2V7aa&w=130&h=130&url=http%3A%2F%2Fnorthforker.com%2Fwp-content%2Fuploads%2F2015%2F08%2FScreen-Shot-2015-08-19-at-10.11.31-AM.png&cfs=1", :link=>"http://ow.ly/Ronqs"}, {:message=>"Fertilizers and #pesticides make pets sick. In honor of #NationalDogDay, commit to going toxin-free, for Fido http://t.co/MSq1IxUjho", :created_at=>2015-08-26 20:35:20 +0000, :source=>"Twitter"}, {:message=>"This little guy wouldn't be happy laying on a chemical lawn. Pesticides and fertilizers make pets sick. In honor of #NationalDogDay, commit to going toxin-free for the sake Fido, your family and the environment.", :created_at=>"2015-08-26 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= content_tag_for(:tr, @stations) do |station| %> | |
<div dom_id(station)> | |
<td><%= link_to station.name, station %></td> | |
<td><%= fmt_coord station.latitude.to_f %></td> | |
<td><%= fmt_coord station.longitude.to_f %></td> | |
<% if station.forecasts.any? %> | |
<td style="width: 3em;"> | |
<strong>High: </strong> <%= number_with_precision(station.forecasts.first.maxtemp, precision: 2) %> °F<br/> | |
<strong>Low: </strong><%= number_with_precision(station.forecasts.first.mintemp.to_f, precision: 2) %> °F | |
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ <% if @station != nil %> | |
<td><%= station.flow_readings.last.date_time.in_time_zone.strftime("%A %e %B %Y,%I:%M:%S %Z") %></td> | |
<td><%= format_flow_rate station.flow_readings.last.flow_rate %></td> | |
<% unless station.favorite?(current_user) %> | |
<td><%= button_to 'Claim River', claim_station_path(station) %></td> | |
<% end %> | |
+ <% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |config| | |
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures | |
config.fixture_path = "#{::Rails.root}/spec/fixtures" | |
config.before :all do | |
response = File.read(Rails.root.join("spec/fixtures/weather_mock.json")) | |
stub_request(:get, /api.forecast.io/).to_return(:body => response, :headers => {"Content-Type" => 'text/json'}).times(10) | |
usgs_response = File.read(Rails.root.join("spec/fixtures/station_mock.json")) | |
stub_request(:get, /waterservices.usgs.gov/).to_return(:body => usgs_response, :headers => {"Content-Type" => 'text/json'}).times(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
feature 'Google Maps' do | |
scenario 'user can see map with a location maker of the station' do | |
Station.create! name: 'Nofish River', latitude: '39', longitude: '-104', code: '1234' | |
visit '/' | |
click_link('Show') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p><%= notice %></p> | |
<%= link_to 'New Car', new_car_path %><br> | |
<% if current_user %> | |
<%= link_to 'My Cars', my_cars_path %> | |
<% end %> | |
<br/> | |
<br/> | |
<table> | |
<tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This class mimics a houseplant | |
# You can <.water> the plant to increase the soil moisture. | |
# Unlike other plants, this plant will tell you when to stop watering it. | |
# You can use <.moisture_check> to see how many units of water the soil has. | |
# You can <.whisper> to the plant. | |
# You can <.fertilize> the plant | |
# You can <.wait> one week to see what happens. | |
# If the soil is wetter than a 2 and you have fertilized the plant, it will | |
# grow a new leaf. |
NewerOlder