Code Monkey home page Code Monkey logo

astronomers's Introduction

Astronomers logo

A web application for space nerds to share links to interesting space related articles out there as well as interact with their fellow nerds.

The live demo can be viewed here.

How to use

The site homepage features recent links posted by users and are sorted via popularity.

landing

An unregistered user cannot post a link, neither can he upvote, downvote or comment on a link. He can however see the number of comments, upvotes and downvotes a link has.

After signup/login however, these abilities are granted to the user.

after_signin

The user can add links after clicking the add link button and upon submitting, the link will be added in the index page.

submit

The user can click on the comments icon to view more about the link as well as comments.

comment

The user can comment on given link.

after_comment

The user can also click on newest to list out links via posted time.

Enjoy! ๐Ÿ˜„

Technologies

Front-end

  • Bootstrap framework.
  • CSS3.
  • HTML 5.
  • Google Fonts.
  • Font Awesome Icons.

Back-end

  • Ruby On Rails.
  • PostgreSQL database.
  • WebBrick web server.
  • Active Record.

Popularity Algorithm

The posted links are sorted depending on popularity( the hot score) and time. This is to ensure links posted long ago, no matter how popular, do not occupy the front page.

the hot score
  • The difference between the upvotes and downvotes is obtained points = upvotes - downvotes

  • Time when the link was posted is obtained via the created_at method and formatted to a number posted_time = ((Time.now - created_at) / 3600).round

  • The link score is then calculated using the hot score formula that takes two values, the points and the posted_time score = hot_score(points, posted_time)

  • Calculating the hot score

def hot_score(points, posted_time, gravity = 1.8)
  (points - 1) / (posted_time + 2) ** gravity
end

On creating a link, the link is assigned a value of 1 point hence the minus above. The gravity value can be anything, depending on how fast you want the link popularity to decline.

Make it your own

Ensure you have the following installed before proceeding.

  • PostgreSQL.
  • Ruby.
  • Bundler.
  • Rails.
  • Git.

Once you have installed these do the following:

  • Clone this repository by clickin the clone/download button.

  • Navigate to the directory via your terminal. Something like cd /downloads/astronomers/

  • Type bundle in your terminal and press enter to install gems.

If gem conflicts, navigate to the app folder and delete the Gemfile.lock file and then run bundle again.

  • Once bundling is complete, run the command rails db:create && rails db:migrate to create the database and migrate the different tables.

  • Run the comand rails s to start the rails server.

  • Navigate to https://localhost:3000

  • To deploy, you can look up this link for details. Heroku Deployment

Happy Coding!

Author

Kinuthia Samwel

Known Bugs

None

License

The contents of this repository are bounded by the Apache License Version 2.0,

forthebadge

ยฉ 2017

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.