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
query = resource-type, [fields], [condition]; | |
resource-type = string; | |
fields = "(", string, [",", {string}], ")"; | |
condition = ":" , (integer, "..", integer) | |
| (integer, "_", positive-integer) | |
| integer | |
| string | |
| ("~", integer) | |
| "*"; | |
string = alphanumerical, { char }; |
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
function runAfter(times, func) { | |
if (times <= 0) return func(); | |
return function() { | |
if (--times < 1) { return func.apply(this, arguments); } | |
}; | |
}; |
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
#!/usr/bin/env node | |
var env = require('./env'); | |
var cfg = env.cfg; | |
var cp = require('child_process'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var processes = []; |
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; | |
var querystring = require('querystring'); | |
/** | |
* Pre-baked error messages | |
* | |
*/ | |
var missingInfo = 'Password authentication - Missing Mandatory authentication' + | |
' information. A "login" and "password" must be provided.'; |
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
describe('when the route matches', function(){ | |
it('should invoke the callback', function(done){ | |
page('/user', function(ctx){ | |
done(); | |
}) | |
page.show('/user?test=true'); | |
}) |
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 = express() | |
, http = require('http'); | |
http.createServer(app).listen(80, '127.0.0.1'); | |
http.createServer(app).listen(80, '::1'); |
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 proxyServer = require('http-proxy').createServer({ | |
router: { | |
"mydomain.com/rest" : "targetMachine:port" | |
} | |
}); | |
proxyServer.listen(myPort); |
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
//That's your constructor | |
var BaseObject = function(eventObj){ | |
this._ev = $(eventObj || {}); | |
} | |
//There it's the inheritance | |
BaseObject.prototype = Object.create(Object.prototype); | |
//Put your methods there | |
BaseObject.prototype.on = 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
<!-- Small upload form --> | |
<html><body> | |
<form action="/upload" | |
enctype="multipart/form-data" method="post"> | |
Please specify a file, or a set of files:<br> | |
<input type="file" name="myfile" size="40"> | |
</p> | |
<div> | |
<input type="submit" value="Send"> | |
</div> |