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

Friday, January 29, 2016

GRADLE & NODE NPM - gradle task for execute npm install and bower install

https://gist.github.com/spikeheap/8558786

import org.gradle.api.tasks.Exec
defaultTasks 'bower'
// Get the path for the locally installed binaries
task npmBin << {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'npm'
args = ['bin']
standardOutput = os
}
ext.binPath = os.toString().trim() + "/"
}
}
// Install packages from package.json
task npm(type: Exec) {
description = "Grab NodeJS dependencies (from package.json)"
commandLine = ["npm", "install"]
inputs.file "package.json"
outputs.dir "node_modules"
tasks.npmBin.execute()
}
// Install the bower components for front-end library management
task bower(dependsOn: 'npm', type: Exec){
commandLine "${npmBin.binPath}bower", 'install'
}

JAVASCRIPT vs ANGULARJS - copy object by value, not by reference

In JavaScript copy of object is done by reference:
var newObj = Object.create(oldObj); //Modification in newObj would be reflected in oldObj.

JavaScript solution 1: Inline deep copying (if you know its structure)
var newObj = {
   name: source.name,
   type: source.type
}

JavaScript solution 2: Use JSON parse (it could be more slower)
var newObject = JSON.parse(JSON.stringify(oldObject));

Angular way:
var newObject = angular.copy(oldObject);

WINDOWS - port, process PID tracking with CurrPorts application

If you need to track on WINDOWS which process PID is running on which port, consider to use:
CurrPorts (CPorts) application:
http://www.download3k.com/Install-CurrPorts.html