This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
name: 'basic', | |
'get': function() { | |
}, | |
'post': function({ | |
request, | |
response, | |
sendResponseObj, | |
db, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Object deep clone | |
var deepClone = (src) => { | |
let objToReturn = {}; | |
Object.keys(src).forEach(item => { | |
if (typeof src[item] === 'object' && !(src[item] instanceof Array)) { | |
objToReturn[item] = deepClone(src[item]); | |
} else { | |
if (typeof src[item] === 'object' && src[item] instanceof Array) { | |
objToReturn[item] = [...src[item]]; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pubSub } from '../../services/pubsub.service'; | |
//subscribe the event for pageloader to listen the event | |
pubSub.subscribe('pageloader', (event) => { | |
if (event.show) { | |
this.setState({ | |
isLoading: true | |
}); | |
} else { | |
this.setState({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Returns true incase of `child` element is child element of `parent` element */ | |
function isDescendant(parent, child) { | |
let node = child.parentNode; | |
while (node != null) { | |
if (node == parent) { | |
return true; | |
} | |
node = node.parentNode; | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = ['','one ','two ','three ','four ', 'five ','six ','seven ','eight ','nine ','ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen ']; | |
var b = ['', '', 'twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety']; | |
function inWords (num) { | |
if ((num = num.toString()).length > 9) return 'overflow'; | |
n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/); | |
if (!n) return; var str = ''; | |
str += (n[1] != 0) ? (a[Number(n[1])] || b[n[1][0]] + ' ' + a[n[1][1]]) + 'crore ' : ''; | |
str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + ' ' + a[n[2][1]]) + 'lakh ' : ''; | |
str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + ' ' + a[n[3][1]]) + 'thousand ' : ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var static = require('node-static'); | |
var rootRequest = require('request'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var buildInProgress = false; | |
module.exports = function(options) { | |
console.log('options', options); | |
var baseUrl = 'https://dev.azurewebsites.net'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title></title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Creating Virtual DOM</title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var App = {}; | |
var addRoutes = function () { | |
$NB.addRoute('/books/:id', function (params) { | |
console.log('Route is ', params.Title, params.id); | |
}, 'books'); | |
$NB.addRoute('/:category/:id', function (params) { | |
console.log('Route is ', params.Title, params.category, params.id); | |
}, 'category'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Behind the scenes of Two Way binding simple example for text</title> | |
<!-- Adding JS reference --> | |
<script src="two-way-binding.js"></script> | |
</head> | |
<!-- Invoking the binding Manager after completion of DOM load--> | |
<body onload="bindManager.init()"> | |
<div class="demo-page"> |
NewerOlder