Tag Archives: development notes 2014

Notes of Week 1228 2014

    Dealing with the styles for IE8 and earlier:

  1. html5shiv
  2. response.js
  3. detect the version of the browser
    navigator.sayswho= (function(){
    var ua= navigator.userAgent, tem,
    M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
    if(/trident/i.test(M[1])){
    tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
    return 'IE '+(tem[1] || '');
    }
    if(M[1]=== 'Chrome'){
    tem= ua.match(/\bOPR\/(\d+)/)
    if(tem!= null) return 'Opera '+tem[1];
    }
    M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
    if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
    return M.join(' ');
    })();
  4. others

  5. windows.location.replace()
Tagged

Notes of Week 1221 2014

  1. url arg of requirejs
  2. rendering time
  3. jasper
    jrxml
Tagged

Notes of Week 1207 2014

    learning automating building application

  1. Managing Frontend Dependencies & Deployment Part 2: Gulp
    where everything begins.
  2. Why you shouldn’t create a gulp plugin
  3. Getting started with gulp
  4. Gulp + Browserify: The Everything Post
  5. npmawesome: 9 gulp.js plugins for a great build system
  6. Environment-specific Builds With Grunt, Gulp or Broccoli
  7. others

  8. glob pattern, such as /**/*.scss
  9. check out “Browser Sync”
  10. Visualizing a modern web development stack with a diagram
    The blog described how the client side stack gets more complex and starts to do heavy lifting during the past two years.
  11. And just like that Grunt and RequireJS are out, it’s all about Gulp and Browserify now
    How Gulp and Browserify are emerging and taking over the Grunt and RequireJS.
  12. tilde and caret in versioning
  13. check this out:
    Introduction to JavaScript Source Maps
  14. and this:
    irc
  15. to uninstall node module installed by npm:
    npm uninstall <module>
    note that module cannot be omitted, and –save-dev can be added as a option
Tagged

Notes of Week 1123 2014

  1. how to debug after r.js building the project:
    optimize: 'none',

    //Introduced in 2.0.2: a bit experimental.
    //Each script in the build bundle will be turned into
    //a JavaScript string with a //# sourceURL comment, and then wrapped in an
    //eval call. This allows some browsers to see each evaled script as a
    //separate script in the script debugger even though they are all combined
    //in the same file. Some important limitations:
    //1) Do not use in IE if conditional comments are turned on, it will cause
    //errors:
    //http://en.wikipedia.org/wiki/Conditional_comment#Conditional_comments_in_JScript
    //2) It is only useful in optimize: 'none' scenarios. The goal is to allow
    //easier built bundle debugging, which goes against minification desires.
    useSourceUrl: true,

  2. http://www.gitguys.com/topics/tracking-branches-and-remote-tracking-branches/
  3. need to look at

  4. http://api.jquery.com/category/offset/
Tagged

Notes of Week 1116 2014

  1. check if an array is empty.
  2. how to clear a file upload input
    function resetFormElement(e) {
    e.wrap('').closest('form').get(0).reset();
    e.unwrap();
    }​

    or
    var control = $("#control");

    $("#clear").on("click", function () {
    control.replaceWith( control = control.clone( true ) );
    });

  3. From stack overflow

    Unlike innerText, though, innerHTML lets you work with HTML rich text and doesn’t automatically encode and decode text. In other words, innerText retrieves and sets the content of the tag as plain text, whereas innerHTML retrieves and sets the same content but in HTML format.

    firefox has bug with innerText

Tagged

Notes of Week 1109 2014

  1. excel delete (and remove) row: ctrl + “-”
  2. http://answers.microsoft.com/en-us/office/forum/office_2007-excel/reverting-back-to-default-border-lines/e6d796ea-099f-4eee-93b9-a67196f5a341

  3. /*
    * object.watch polyfill
    *
    * 2012-04-03
    *
    * By Eli Grey, http://eligrey.com
    * Public Domain.
    * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
    */
    // object.watch
    if (!Object.prototype.watch) {
    Object.defineProperty(Object.prototype, "watch", {
    enumerable: false
    , configurable: true
    , writable: false
    , value: function (prop, handler) {
    var
    oldval = this[prop]
    , newval = oldval
    , getter = function () {
    return newval;
    }
    , setter = function (val) {
    oldval = newval;
    return newval = handler.call(this, prop, oldval, val);
    }
    ;
    if (delete this[prop]) { // can't watch constants
    Object.defineProperty(this, prop, {
    get: getter
    , set: setter
    , enumerable: true
    , configurable: true
    });
    }
    }
    });
    }
    // object.unwatch
    if (!Object.prototype.unwatch) {
    Object.defineProperty(Object.prototype, "unwatch", {
    enumerable: false
    , configurable: true
    , writable: false
    , value: function (prop) {
    var val = this[prop];
    delete this[prop]; // remove accessors
    this[prop] = val;
    }
    });
    }

    view raw

    object-watch.js

    hosted with ❤ by GitHub

  4. how to sort in excel including filling
  5. .after()

Tagged

Notes of Week 1026 2014

  1. var currentDate = (new Date()).getTime();
  2. moment().get("MM-DD-YYYY")
  3. deep copy
    _.clone();
  4. .closet()
    .nextAll()
  5. .on()
    .one()
  6. !important
    copy reference or value, deep copy
    in the _.each(list, function(element, index){}), the element is a copy of the list[index], but the keys inside element are passed by reference.
  7. http://stackoverflow.com/questions/3390396/how-to-check-for-undefined-in-javascript
Tagged