start http-server to serve a project folder:
http-server -a localhost -p 8000 -c-1 ./dist
For Angular1-2 project, use lite-server
instead
Running the server in the background and run protractor test using that server:
// https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers | |
// app.js | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('/sw-test/sw.js', { scope: '/sw-test/' }).then(function(reg) { | |
if(reg.installing) { | |
console.log('Service worker installing'); | |
} else if(reg.waiting) { | |
console.log('Service worker installed'); |
start http-server to serve a project folder:
http-server -a localhost -p 8000 -c-1 ./dist
For Angular1-2 project, use lite-server
instead
Running the server in the background and run protractor test using that server:
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
// Using toString() to detect object class | |
// toString() can be used with every object and allows you to get its class. To use the Object.prototype.toString() with every object, you need to call Function.prototype.call() or Function.prototype.apply() on it, passing the object you want to inspect as the first parameter called thisArg. | |
var toString = Object.prototype.toString; | |
toString.call(new Date); // [object Date] | |
toString.call(new String); // [object String] | |
toString.call(Math); // [object Math] |
-r: recursive | |
-i: ignore case sensitive | |
-w: match the full words | |
-B: prints the specified N lines before the match | |
-A: prints the specified N lines after the match | |
-C: shows N lines in both the side(before & after) of match | |
grep -r h[1-6] ./*.css | wc -l | |
grep -ir color=auto h[1-6] ./*.css | wc -l |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Javascript nested functions"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<a href="https://jsbin.com/viposub/edit?html,js,output">Jsbin available here</a> |
function test(val) { | |
var n = val || 0; | |
document.write(n, '<br>'); | |
function add(addN) { | |
addN = addN || 0; | |
document.write('[add ', addN, ']<br>'); | |
n += addN; |