Coder Social home page Coder Social logo

web-guesser's Introduction

Exploration

This is a simple number guessing app built with sinatra. Try it out!

The aim is to guess a number including and in between 1 and 100. Every time you submit a number you will be given a response indicating whether the number was too high or too low. Once you correctly guess the number or run out of guesses, another secret number is randomly generated.

Exposition

Sinatra is a very light-weight framework written in Ruby for setting up web applications. You can think of it as the bare skeleton of a Rails framework since you have to do a lot of manual set up but there are still quite a few things that are happening under the hood. Learning sinatra is really great way to understand how Rails abstracts methods and paths to produce its conventional state.

By using sinatra I learned how to:

  • Set up a basic route: get '/' do ... end
  • Link a route to a view: erb :index
  • Acquire local parameters and embed them into the views: locals => {:key_to_refer => value }

Embedding ruby logic into the views means that the webpage now has a dynamic element to it!

The href attribute in the <link> element by default looks within the public folder. This sort of automatic pathing lends itself to how Rails manages file paths.

As usual, I have adopted BEM CSS syntax which has made the styling easier to manage and has resulted in a skin for the app reflecting the original gameboy.

I have also started using commenting that is seen in the Skeleton responsive design framework. It's quite sleek and it's not jarring at all; it somehow manages to instruct your eye but not distract it - weird. It looks like this: /* Global –––––––––––––––––––––––––––––––––––––––––––––––––– */

From The Odin Project's curriculum following a Jumpstart tutorial.

Excursion

In order to deploy this app successfully I needed to place .bundle into a .gitignore folder. This would have been easy to troubleshoot if I had a closer read of the heroku logs.

Expletives

Since no sessions are put in place, if more than one person is using the app, a user's get or post requests are interacting with each other and the guesses will make strange movements and either drop away really fast or reset to a higher number.

web-guesser's People

Contributors

csrail avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

anistor86

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.