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 EventEmitter = require('events').EventEmitter, | |
path = require('path'), | |
fs = require('fs'); | |
module.exports = { | |
createMonitor: createMonitor | |
}; | |
function equalStats(a, b) { |
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> | |
<head> | |
<title></title> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet/less" type="text/css" href="test.less"> | |
<script type="text/javascript" src="less.js"></script> | |
<script type="text/javascript"> | |
window.onload = function() { |
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>Defiant.js</title> | |
<script type="text/javascript" src="/res/js/defiant.js"></script> | |
</head> | |
<body> | |
<!-- output element --> |
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 str = '<data><author>Isaac Asimov</author><genre>Science Fiction</genre></data>', | |
doc = Defiant.xmlFromString(str), | |
node = Defiant.node.selectSingleNode(doc, '//author'); | |
console.log( node.nodeValue ); | |
// 'Isaac Asimov' |
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 str = '<data><movie>Star Wars</movie><movie>Indiana Jones</movie></data>', | |
doc = Defiant.xmlFromString(str), | |
node = Defiant.node.selectSingleNode(doc, '//movie'); | |
console.log( Defiant.node.prettyPrint( node ) ); | |
// '<movie>Star Wars</movie>' | |
console.log( Defiant.node.prettyPrint( doc ) ); | |
/* |
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 str = '<data><brand>Sony</brand><brand>Apple</brand>'+ | |
'<brand>Panasonic</brand></data>', | |
doc = Defiant.xmlFromString(str), | |
node = Defiant.node.selectSingleNode(doc, '//brand'); | |
console.log( Defiant.node.prettyPrint( node ) ); | |
// '<brand>Sony</brand>' | |
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 str = '<data><company name="Apple"/>'+ | |
'<user email="steve@apple.com"/>'+ | |
'<movie name="The Godfather"/></data>', | |
doc = Defiant.xmlFromString(str), | |
node = Defiant.node.selectNodes(doc, '//*[@name]'); | |
for (var i=0; i<node.length; i++) { | |
console.log( Defiant.node.prettyPrint( node[i] ) ); | |
} |
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 str = '<data><user id="1" name="Hakan Bilgin">'+ | |
'<mail>hbi@bredband.net</mail></user></data>', | |
doc = Defiant.xmlFromString(str), | |
obj = Defiant.node.toJSON(doc.documentElement); | |
console.log( JSON.stringify(obj, null, '\t') ); | |
/* | |
{ | |
"user": { |
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 obj = { | |
"car": [ | |
{"@id": 10, "@color": "silver", "name": "Volvo"}, | |
{"@id": 11, "@color": "red", "name": "Saab"}, | |
{"@id": 12, "@color": "red", "name": "Peugeot"}, | |
{"@id": 13, "@color": "yellow", "name": "Porsche"} | |
], | |
"bike": [ | |
{"@id": 20, "@color": "black", "name": "Cannondale"}, |
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 data = { | |
"product": [ | |
{"active": 1, "name": "MacBook Air", "price_us": 999}, | |
{"active": 0, "name": "Mac mini", "price_us": 599}, | |
{"active": 1, "name": "MacBook Pro", "price_us": 1299} | |
] | |
}, | |
SEK_USD = 6.57, | |
res = JSON.search( data, '//product[active=1]' ); |
OlderNewer