Git Product home page Git Product logo

bike-parkway's Introduction

Bike Parkway

Bike Parkway is an app that allows users to sign up, add their friends, and compete in bike mile challenges. A fitness tracker purely for bike riding/commuting. BP integrates the Google Maps API to provide optimal bike directions and a clean user interface.

Motivation

There are many fitness tracking/direction apps out there these days. I wanted to provide a landing spot purely for bike riding and those who commute by bicycle. As the subway gets worse every day here in NYC, anything we can do to encourage cycling needs to be done!

Tech/framework used

Built with

Screenshots

alt text

Features

  • User login/signup
  • Tracks miles by day, week, lifetime
  • Provides bike route on custom map
  • Single-page Application Activity Feed

Code Example

Adding a comment to Activity Feed

  addComment: function(rideId) {
    var commentText = document.getElementById(rideId).value;
    var commentData = {'comment': commentText};
    var userId = document.getElementById("userId").innerHTML;
    $.get("/api/v1/users/" + userId, function(response) {
      var userFirstName = response.firstName;
      if (document.getElementById('comment' + rideId)) {
        document.getElementById('comment' + rideId).innerHTML += '<div class="commentClass">' + "<a href='/users/" + userId.toString() + "'> " + userFirstName + "</a> " + commentText + '</div>' ;
      }
    });
    $.ajax({
      url: '/api/v1/rides/' + rideId, 
      method: "PUT",
      data: commentData
    }
    ).done( function() {
      console.log(commentText);
      document.getElementById(rideId).value = '';
      console.log(document.getElementById(rideId));
      console.log(document.getElementById(rideId).value);

    });
  },

Writing a User class with friendships

  class User < ApplicationRecord
    has_secure_password

    has_many :friendships
    has_many :friends, through: :friendships
    has_many :inverse_friendships, :class_name => "Friendship", :foreign_key => "friend_id"
    has_many :inverse_friends, :through => :inverse_friendships, :source => :user
    has_many :rides
    has_many :comments
    has_many :likes

    def friend?(input_id)
      friendships = Friendship.all.where(user_id: self.id)
      friendships.each do |friendship|
        if friendship.friend_id == input_id
          return true
        end
      end
      false
    end
  end

bike-parkway's People

Contributors

andrewsouthard1 avatar snyk-bot avatar

Watchers

James Cloos 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.