Giter Club home page Giter Club logo

weather's Introduction

tl;dr (select code samples)

Tech stack

  • Use HAML, SCSS, coffeescript (when required), Rspec & guard (for testing)

Views

Design patterns

Security

Ruby metaprogramming

Testing - use Rspec and guard

Custom rake tasks

Problem statement :

Where should I go hiking in the next week based on weather forecasts ?

Solution :

I decided to build this simple website to answer that question for me. The Pacific NorthWest has a lot of micro-climates which means different parts of WA may have different weather even though they are not that far apart (from a geographic standpoint). I was tired of googling my favorite destinations one by one each time I wanted to decide where I should go to next. Enter this project.

Screenshots :

Weather forecast summary for all the regions selected :

Alt text

Detailed weather forecast for one location :

Alt text

Weather API setup (only needed to run against the real API).

  1. Sign up for a new dev account (only to run in prod mode) https://darksky.net/dev/account
  2. Upgrade Rails credetials as per https://www.engineyard.com/blog/rails-encrypted-credentials-on-rails-5.2
  3. Profit ??

Caching

  1. Typheus is setup to use Rails default cache
  2. To enable caching/disable in development : rails dev:cache

How to run :

  1. Download this code.
  2. on command line, run : rails server
  3. localhost:3000/test for test data, localhost:3000 for real weather information.

Testing :

bundle exec rspec bundle exec guard

Tech details

Installation

# Install rails 6.0.0 : 
gem install rails -v 6.0.0
# Create credentials : 
rails credentials:edit
# Install postgres : 
brew install postgres
# Create postgres user : 
~/homebrew/bin/createuser -s postgres
# Log in and create weather_dev db : 
createdb weather_dev

postgres=# create database weather_dev;
CREATE DATABASE
postgres=# \l
                               List of databases
    Name     |   Owner   | Encoding | Collate | Ctype |    Access privileges
-------------+-----------+----------+---------+-------+-------------------------
 postgres    | akarwande | UTF8     | C       | C     |
 template0   | akarwande | UTF8     | C       | C     | =c/akarwande           +
             |           |          |         |       | akarwande=CTc/akarwande
 template1   | akarwande | UTF8     | C       | C     | =c/akarwande           +
             |           |          |         |       | akarwande=CTc/akarwande
 weather_dev | postgres  | UTF8     | C       | C     |
(4 rows)

Devise

http://railsapps.github.io/tutorial-rails-mongoid-devise.html

MAWS (move to aws)

  1. Move ahoy to mongo : https://github.com/andrewculver/ahoy#mongodb
  2. move devise to mongo : http://railsapps.github.io/tutorial-rails-mongoid-devise.html
  3. setup website on AWS using Elastic Beanstalk
  4. set up CICD with CodePipeline
  5. update travelweather.co to new website.

Deployment to heroku

Based on Procfile at root.

weather's People

Contributors

gadzooks avatar akarwande avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.