30 May 2019

Function

Promise

RegExp

  • https://regex101.com/#javascript

XMLHttpRequest

JSONP

  • http://www.json-p.org/
  • http://en.wikipedia.org/wiki/JSONP

Bower

Bootstrap

Build documentation, run jekyll build.

ECMAScript

Angular

[{name: ‘John’, no: 1}, {name: ‘Mike’, no: 2}] fitler filter. Object filter ‘filter: {no: 1}’ is equivalent to ‘filter: search.no’ if there is ‘’. JS built-in functions can be used inside an expression.

Use underscore Set up:

var underscore = angular.module('underscore', []);
underscore.factory('_', function() {
  return window._; // assumes underscore has already been loaded on the page
});

Use it:

// Declare it as a dependency of your module
var app = angular.module('app', ['underscore']);

// And then inject it where you need it
app.controller('Ctrl', function($scope, _) {
  // do stuff
});

$resource all returns a object or an array. $resource doc says:

It is important to realize that invoking a $resource object method immediately returns an empty reference (object or array depending on isArray).

@ in $resource will extract a property value. It will not remove the property from the object. For example, {id : '@id'} will extract id property from the following JSON object. And the whole JSON object will be sent untouched.

{
 id: 1,
 name: 'xiaoyu'
}

Protractor

console.log logs message to terminal console when running proractor.

Node

Installing Node.js via package manager will install an old version of Node. For new versions of Node, install from https://nodejs.org/.

Upgrade node:

sudo n stable
sudo npm install npm -g

Install Node 10 with brew:

brew install node@10
brew link node@10 --force

brew link links /usr/local/Cellar/node@10/10.16.0/include/node into /usr/loca/include. It also creates folder dtrace and node_modules inside /usr/local/lib. Files inside there directories are linked to files inside /usr/local/Cellar/node@10/10.16.0/lib.

Engine

Charting

https://plot.ly/javascript

Resources

MISC

var myLog = console.log;
myLog('abc');

The above code works in Node. But in Chrome brower, there is the following error:

Uncaught TypeError: Illegal invocation