Java Script
===============================
    
********************************************************************************
## CallBack Functions
********************************************************************************
    <!DOCTYPE html>
    <html>
    <body>

    <p>Click the button to wait 2 * 3 seconds, then alert "Hello".</p>

    <button onclick="myFunction()">Try it</button>

    <script>


    function myFunction() {
        var date = new Date();
        console.log("#1 " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());
        setTimeout(function(){myFunction3(myFunction2)}, 3000);
    }

    function myFunction3(callback) {
        var date = new Date();
        console.log("#3 " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());
        setTimeout(callback, 3000);
    }

    function myFunction2() {
        var date = new Date();
        console.log("#2 " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());
        alert("Hello");
    }
    </script>

    </body>
    </html>
********************************************************************************
## Grunt
********************************************************************************
npm install -g grunt-cli<br>
npm install -S grunt<br>
npm init<br>
npm install grunt-contrib-concat --save-dev<br>
npm install grunt-contrib-uglify --save-dev<br>
npm install grunt-contrib-htmlmin --save-dev<br>

###Gruntfile.js
    module.exports = function (grunt) {
    // Project configuration. 
    grunt.initConfig({
      
      concat: {
        js: {
          src: ['ui/modules/**/*.js'],
          dest: 'dist/built.js',
        },
        css: {
          src: ['ui/css/**/*.css'],
          dest: 'dist/built.css',
      },
     },
     uglify : { 
        my_target: {
          files: {
            'dist/built-min.js': ['dist/built.js']
          }
        }
    },
     htmlmin: {                                     // Task 
        dist: {                                      // Target 
          options: {                                 // Target options 
            removeComments: true,
            collapseWhitespace: true
          },
          files: {                                   // Dictionary of files 
            'templates/index-min.html': 'templates/index.html'     // 'destination': 'source' 
          }
        },
      }
    });

        grunt.loadNpmTasks('grunt-contrib-htmlmin');    
        grunt.loadNpmTasks('grunt-contrib-uglify');
         grunt.loadNpmTasks('grunt-contrib-concat');    
        grunt.registerTask('both',['speak','yell']); 

        grunt.registerTask('speak',function() {
            console.log("I'm Speaking");
        });

        grunt.registerTask('yell',function() {
            console.log("I'm yelling");

        });


    };

_BY: Farid Ahmadian_  
_TAG: javascript, callback, grunt_  
_DATE: 2016-08-27 19:36:53_