-
A
hookis a node.js process -
A
hookcan have manyoutputs( servers ) andinputs( client connections ) to other hooks -
The previous line is NOT a typo
-
outputs= servers ( who push messages out ) -
inputs= clients ( who take messages in ) -
inputsandoutputsare independent channels and are both bi-directional -
hookinputsALWAYS re-broadcast to it'soutputsimmediateinputs( siblings )
This file contains hidden or 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
| # booting into arch livecd (thumbdrive) | |
| grab the arch linux iso - https://www.archlinux.org/download/ | |
| open terminal | |
| ```bash | |
| cd /path/to/downloads | |
| diskutil list |
This file contains hidden or 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
| { | |
| "package": { | |
| "properties": { | |
| "author": { | |
| "type": "string" | |
| }, | |
| "created": { | |
| "type": "date", | |
| "format": "dateOptionalTime" | |
| }, |
This file contains hidden or 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 jsdom = require('jsdom'); | |
| jsdom.defaultDocumentFeatures = { | |
| FetchExternalResources : ['script'], | |
| ProcessExternalResources : ['script'], | |
| MutationEvents : '2.0', | |
| QuerySelector : false | |
| }; | |
| var htmlDoc = '<html lang="en-US">' + |
This file contains hidden or 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
| //TO USE JUST save it and FIRE node <filename.js> | |
| //AT THE BOTTOM THERE ARE TWO URL'S. TEST CASE IS FOR URL POINTING TO SUN'S JAVADOC ,A PAGE THAT MAKEE HEAVY //USE OF IFRAMES | |
| // Should process HTML text and dump it on terminal | |
| // Error on terminal with a backtrace | |
| /* | |
| /home/sid/opt/lib/node/.npm/jsdom/0.1.20/package/lib/jsdom/level2/html.js:1400 | |
| this._contentDocument = new HTMLDocument(); | |
| ^ | |
| ReferenceError: HTMLDocument is not defined | |
| at Object.contentDocument (/home/sid/opt/lib/node/.npm/jsdom/0.1.20/package/lib/jsdom/level2/html.js:1400:9) |
This perhaps deserves a blog post, but whatever.
The challenge: What if you wanted to determine what level my Bulgarian language skills were at? Using this sample document:
{
"name": {
"first": "Lloyd",
"last": "Hilaiel"
},
"favoriteColor": "yellow",
This file contains hidden or 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
| Copyright (c) 2011 Elijah Insua, http://tmpvar.com | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to | |
| the following conditions: | |
This file contains hidden or 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
| getdom = function () { | |
| var features = | |
| { FetchExternalResources : [] | |
| , ProcessExternalResources : false | |
| } | |
| , window = jsdom.jsdom(this.dataString, null, {features: features}).createWindow() | |
| ; | |
| return window | |
| } |
This file contains hidden or 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 common = require('../common'), | |
| assert = common.assert; | |
| var Script = process.binding("evals").Script; | |
| var sandbox = Script.createContext({x: "x"}); | |
| sandbox.window = sandbox; | |
| //Script.runInContext("window = this;", sandbox); |
This file contains hidden or 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 sys = require('sys'), | |
| http = require('http'), | |
| cookie = require('cookie'), | |
| count = 0; | |
| initConnect = function(clientID) { | |
| connectSite = http.createClient(80, 'ws30.sync.skoreit.com'); | |
| connectRequest = connectSite.request('POST', '/request.ashx?key=11111111-1111-1111-1111-111111111111&token=' + new Date().getTime(), { | |
| 'host': 'ws30.sync.skoreit.com', | |
| 'Content-type': 'text/json; charset=utf-8', |
NewerOlder