понедельник, 15 декабря 2014 г.

several points on Angular JS usage

Just things in random order, I've came across last days.

четверг, 20 ноября 2014 г.

Webdev workflow schema

  • http://yeoman.io/ and install npm install -g yo
  • http://bower.io/ and install npm install -g bower
  • http://gruntjs.com/ and install npm install -g grunt-cli

воскресенье, 9 ноября 2014 г.

more AngularJS details

AngularJS scope and watch

1) $scope.$watch(VAR, CALLBACK)
2) $scope.$apply() - notify about changes
3) AngularJS scopes are organized in a tree structure and a scope can access its ancestor’s variables. Well, this means that $digest() needs to happen on every child scope in every iteration! Internally, this code is a bit messy in AngularJS, but each iteration of the $digest() loop does a depth-first search and performs the watcher check on every child scope. If any child scope is dirty, the loop has to run again!
4) UI is blocked while $digest() is running
5) angular.equals(A, B) - internal angular function for comparing

среда, 5 ноября 2014 г.

services and factories in angular explained

Compilation of very-very useful explanations for beginners what are services and factories and what are their key useful details. Credentials go mostly to stackoverflow.com threads.

Keep in mind all providers in AngularJS ( = value, constant, services, factories) are singletons !

If you want your function to be called like a normal function, use factory. If you want your function to be instantiated with the new operator, use service. If you don't know the difference, use factory.

среда, 10 сентября 2014 г.

REST APIs documentation tools

Good article about the topic: Automated Documentation for REST APIs

i/o docs
https://github.com/mashery/iodocs
runs on Node.js, needs Reddis, express, jade and some connectors

Swagger
http://swagger.io/https://github.com/wordnik/swagger-ui
the whole toolbox for creating/documenting REST services

JSON Doc
http://jsondoc.org/getting-started.html

..
and there are several more.

lodash (Lo-Dash) and its performance

Lo-Dash is a js library with loooong list of utility methods, originally forked from Underscore.js and now super-optimized for high productivity.

Also see a nice talk about approaches towards performance in JS by John-David Dalton the creator of lodash lib:

Way to stop page load and rendering using javascript

window.stop(); //works in all browsers but IE    
if (IE) {document.execCommand("Stop");}; //works in IE,