Wednesday, February 24, 2016

ANGULARJS - how dynamically set templateUrl to derective

emanuel.directive('hymn', function() {
   return {
       restrict: 'E',
       link: function(scope, element, attrs) {
           // some ode
       },
       templateUrl: function(elem,attrs) {
           return attrs.templateUrl || 'some/path/default.html'
       }
   }
});
 <hymn template-url="contentUrl"><hymn>
http://stackoverflow.com/questions/21835471/angular-js-directive-dynamic-templateurl

JAVASCRIPT - Introduction to JavaScript by Yakov Fain (video)

Friday, February 19, 2016

Wednesday, February 10, 2016

ANGULARJS 2 - infinite scroll (link)

https://dzone.com/articles/angular-2-attribute-directive-creating-an-infinite

ANGULARJS 2 - Webinar video of Building Awesome Apps with Firebase and Angular 2

Building Awesome Apps with Firebase and Angular 2

https://www.youtube.com/watch?v=A1dpvZqoM_w


My notes:

Angular 2 Cool features:
https://github.com/angular/angularfire2
https://www.npmjs.com/package/angularfire2

In Angular 1 promises guaranteed that you will receive the response, but only once. Working with Firebase needs response working as STREAMS.

Zones + Change Detection
Zones - Asynchronous execution context. It let you know when the synchronous action are completed. Also Zones will allow to have continuous stack-trace of errors.
Change Detection - will take a look at what is changed and it knows what to do with it.

Pipes
It is like Filters in Angular 1, but now they can manage state.
You can take URL where is your data and pipe it, so that it could be used in your template. When data changes then your its value automatically changes in your template.

Observables
Promises will give you callback just one time. Observables will fire off as a continuous stream, it is like a promises but they continue to fire off.

Installation
npm install --save angularfire2
npm install --save angular-cli

ng new my-awesome-app
cd my-awesome-app
ng serve

1. Instantiate our Firebase URL
For instance AngularfireDemoApp is a component. Everything in Angular 2 is based on Components.

bootstrap(AngularfireDemoApp, [
   defaultFirebase('https://FB-URL.firebase.com'),
   FIREBASE_PROVIDERS
]);

2. Push data to Firebase

return PromiseObservable
    .create(this._fbRef.child('message').push({
        message,
        user
}));


Pipes - transform data as input a desired output

Statless pipes - transform data without remembering or detecting anything about it
Stateful pipes (async) - receive a Promise or Obsorvable as input, maintain a subscription to that

Stateful pipes (async) - example of use Async Pipes in html template:

'<div *ngFor="#message of messages | async"><div>'

sadfsadf



Wednesday, February 3, 2016

ANGULARJS - angular + breeze application with saving data into Local Storage

Angular application could save Work In Process files (WIP) in Local Storage. The Breeze framework is widely used for this purpose. John Papa gives good explanation how it works:
https://www.youtube.com/watch?v=JLij19xbefI

Tuesday, February 2, 2016

ANGULARJS - John Papa Angular style guide in pdf format

https://mayflower.de/wp-content/uploads/2015/11/AngularJS-Poster.pdf

COUCHBASE - query tutorial

http://query.pub.couchbase.com/tutorial/#2

COUCHBASE - how to create primary index for N1QL

C:\Users\andriypa>cbq
Couchbase query shell connected to http://localhost:8093/ . Type Ctrl-D to exit.
cbq> CREATE PRIMARY INDEX ON `default`;
{
    "requestID": "65230d77-9d8f-4f13-9590-776ad6309f9c",
    "signature": null,
    "results": [
    ],
    "status": "success",
    "metrics": {
        "elapsedTime": "3.1251858s",
        "executionTime": "3.1241875s",
        "resultCount": 0,
        "resultSize": 0
    }
}

GIT - create a new remote branch from the local one

First, you must create your branch locally
git checkout -b your_branch

After that, you can work locally in your branch, when you are ready to share the branch, push it. The next command push the branch to the remote repository origin and tracks it
git push -u origin your_branch

Teammates can reach your branch, by doing: 
git fetch
git checkout origin/your_branch
http://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch

HTTP 2 - Chrome dev tools settings for view live HTTP/2 sessions

In order to capture HTTP/2 sessions in Chrome for live view enter this url in Chrome and choose HTTP/2 option:
chrome://net-internals/#http2