Giter Site home page Giter Site logo

node-workshop's Introduction

node-workshop

NodeJS basic workshop

Base instructions

  • If you did not finish the exercises from the functions/objects workshop, please complete these first. You don't need to do the external Rx exercise, but I recommend you do it on your own time.
  • Fork this repository and clone it in a new Cloud9 workspace.
  • As you open the project in Cloud9, open a new terminal and go into the workspace directory inside your home folder.
  • Do a file listing that shows hidden files, and notice there is a file called .gitignore. Open this file with nano to check its contents.
  • Notice that the .gitignore file contains one line that says "node_modules". What this is doing is telling Git that it should ignore the contents of the node_modules directory. Since the code in there comes from the outside world, we don't need to save it in our repo.

First program

  • Create a branch called hello-world off of master. In it, write a simple node program that outputs "Hello World!" to the console.
  • Add an instruction to your program that will output "Hello World Again!!" 10 seconds after the program was run.
  • Create a pull request so we can look at your code.

Getting some data

  • Create a branch called iss off of master. In it, write a simple node program that will output the latitude and longitude of the International Space Station.
  • Practice your google-fu by searching for "iss api" and figuring out the correct URL to use.
  • Notice that the values provided by the API are very precise. Round off the values to two decimal digits for a nicer display.
  • Create a pull request so we can look at your code.

Augmenting our application

  • Create a branch called iss-augmented off of iss (NOT master).
  • Augment your ISS application to tell the user how "far" the ISS is from them. Here is how you will do it:
  • Using the prompt module, ask the user to enter their location (e.g. "montreal")
  • Using Google's Geolocation API, find out the latitude and longitude of the provided location. Here is how:
  • When you are comfortable with finding the location based on an input address, you can then calculate the distance between the ISS and the user:
    • Look at this URL: http://www.movable-type.co.uk/scripts/latlong.html
    • It specifies a formula for calculating the distance. Scroll the page to the JavaScript portion, and create a function that uses the provided code. You don't need to understand what is going on in there, it is very mathy!
    • NOTE: In order for this code to work, you'll need to add the following code at the beginning of your program:
    Number.prototype.toRadians = function() {
        return this * Math.PI / 180;
    }
  * Finally, display a message to the user telling them what their "distance" to the ISS is.
  * Create a pull request so we can look at your code.
  
### Number guessing game!
  * Create a branch called `number-guessing-game` off of `master`.
  * In this branch, re-write your number guessing game (from the basic javascript workshop) for the command line!
  * Instead of using `prompt` and `alert`, you will have to use capabilities from NodeJS and any external module. **HINT**: there is an npm library called `prompt` that can help you with that :)
  * Create a pull request so we can look at your code.
  
### Challenge: Hangman!
  * Create a branch called `hangman` off of `master`.
  * In this branch, write a program that will let the user play hangman. The program should work as follows:
    * Choose a random word from a list of words.
    * In a loop, do the following:
      * Ask the user to guess a letter
      * If the user guessed a wrong letter, then add one step to the hangman "drawing"
      * Display the current completion of the word next to a hangman ASCII "drawing". You can get some inspiration from either [here](http://www.berkeleyinternet.com/perl/node30.html) or [here](http://ascii.co.uk/art/hangman)
      * Keep looping until either the word is found or the hangman is hanged!
    * Display a message to the user letting them know what happened
  * Create a pull request so we can look at your code.

node-workshop's People

Contributors

ziad-saab avatar

Watchers

 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.