SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)

    Lightbulb This Week in JavaScript - 6 January 2014

    Your weekly update of interesting happenings in the world of JavaScript - feel free to discuss, and help to bring some new ideas to light.

    I hope that you enjoyed the new year and the holiday break. A lot has been happening this week and we have even more to look forward to in the forth coming year, for example: five technologies to look forward to in 2014

    Libraries

    A lot of updates have occurred to libraries recently. From minor to extreme, the following are the more interesting ones:

    fluidbox A lightbox with fluid transitions
    wordcount Calculate file newlines, word, and byte counts on client side using HTML5 File API
    math An extensive and powerful math library[/url]
    shifty A flexible tweening engine
    amMap Create interactive animated maps
    planetary - rotating globes that are interactive and customisable
    ocr Optical Character Recognition in JS
    ogv An OGG Theora and Vorbis video decoder in JavaScript
    epub A JavaScript library for rendering ePub documents in the browser, across many devices

    Learning More

    Everything you wanted to know about JavaScript scope, giving a full run-down of different situations with code examples
    Managing the Asynchronous Nature of Node.js, removing deeply nested callbacks
    An Overview of JavaScript Promises, still experimental, but is a standard to look forward to in the future
    An Introduction to the getUserMedia API, learning by playing with your webcam and mic

    Best Practices?

    Are these really best practices? Be careful of what you take for granted, just because something is said to be a best practice.

    45 Useful JavaScript Tips, Tricks and Best Practices, but are all of them worthy? [thanks felgall]
    Better JavaScript selectors, a controversial topic. There may be a lot of push-back on this one
    Pete Hunt: React - Rethinking Best Practices (video), an intro to React, how it helps to speed things up, and provide simpler maintenance

    Testing

    Jasmine celebrates its 5th birthday. with a new release, and Blanket for checking your code coverage has been getting quite a lot of press lately. Articles have been coming out about integrating Mocha with Blanket.

    Jasmine is 5 and 2.0

    blanket.js Seamless javascript code coverage
    Get your Frontend JavaScript Code Covered
    Blanket + Mocha with RequireJS (and Grunt) - code coverage setup guide

    Scaling Up

    handlebars.js Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
    Handlebars.js ties Ghost, Ember and Assemble together
    Single-Page Applications with Thorax.js
    JavaScript performance analysis: Keeping the big picture

    Cool Stuff
    Zero to Nyancat in 30 Seconds Flat!
    Orbit Viewer is a Chrome Experiment by Kevin Gill that helps visualise the orbits of comets and satellites

    Are you feeling like keeping up with all of these updates? One thing's for sure, it's certainly an interesting time to be involved.

    Please PM us if you have anything of interest for the next issue, and happy reading! - Paul & Pullo
    Last edited by paul_wilkins; Jan 6, 2014 at 19:46.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,839
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    With the 45 Useful JavaScript Tips, Tricks and Best Practices number 12 does not randomly shuffle the entries. Using .05 gives a bias toward leaving the entries in their original order. Using a value somewhere between 0.7 and 0.8 gives a more random result but will still be slightly biased. To get a proper shuffle you can't use sort.

    With 14 the built in concat() method has always been available and can join two arrays into one with far less code than shown. Several of the others can also be done in a lot less code by using one of the new methods introduced into JavaScript way back in 2011 (well you might need a polyfill for IE8 but less code in modern browsers).

    The page appears rather old since several of the things it advises against using are no longer able to be used if you specify "use strict" so as to use the latest version of JavaScript - "with" no longer exists, all variables must be declared with "var" or the script will not run
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by felgall View Post
    With the 45 Useful JavaScript Tips, Tricks and Best Practices number 12 does not randomly shuffle the entries. Using .05 gives a bias toward leaving the entries in their original order. Using a value somewhere between 0.7 and 0.8 gives a more random result but will still be slightly biased. To get a proper shuffle you can't use sort.

    With 14 the built in concat() method has always been available and can join two arrays into one with far less code than shown. Several of the others can also be done in a lot less code by using one of the new methods introduced into JavaScript way back in 2011 (well you might need a polyfill for IE8 but less code in modern browsers).

    The page appears rather old since several of the things it advises against using are no longer able to be used if you specify "use strict" so as to use the latest version of JavaScript - "with" no longer exists, all variables must be declared with "var" or the script will not run
    You're dead right there. That article seems to be more of a blog post that has taken ideas from different sources. It deserves some contemplation, to the point where I'm going to update the top post.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •