Code Monkey home page Code Monkey logo

freecodecamp's People

Contributors

nsuri1 avatar

Watchers

 avatar  avatar

freecodecamp's Issues

Weather Script

  • jQuery has a more readable way of assigning click event listeners that is the format $('selector').click( callbackFunction() )
  • You have a global variable holding the current temperature which is OK (of course there is another way to hold the value that isn't global but its no worries for such a small project), but you keep manipulating its value whenever you click on Celsius versus Fahrenheit and rounding the output. There may exist a number where you click on the conversion and it rounds off the value making it imprecisely.
    • So in order to fix this I would keep the temperature stored in Fahrenheit as that seems to be how it is sent from the weather API, and if the user wants to see it in Celsius make the conversion and do not store the result just display the string in the GUI.
  • The page takes a long time to load the weather info because you are calling it from document.ready it's pretty safe to assume that the initial page load will always be faster than making two ajax requests so I suggest calling it outside of the document.ready and just within the script itself. That should speed it up by about 500 ms or so
  • I'm not a huge fan of switch cases (just a matter of preference) I say you should make an object literal to store the mappings and if the key does not exist in your predefined object that should be your default case
  • so something like var mappings={clearDay:"clear-day.jpg",clearNight:"clear-night.jpg"}
  • When you are showing and hiding the background using the animate function, jQuery has properties called show and hide respectively that use this function signature $('.background').show( timeInMilliseconds, callbackFunction ).hide( timeInMilliseconds , callbackFunction )
  • Sorry to be annoying but it just makes it a little more clear what you are animating for

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.