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 benchrest = require('bench-rest'); //---- https://github.com/jeffbski/bench-rest | |
var flow = 'YOUR-HTTP-URL'; // simple get request | |
var runOptions = { | |
limit: 50, // concurrent connections | |
iterations: 1 // number of iterations to perform | |
}; | |
benchrest(flow, runOptions) | |
.on('error', function (err, ctxName) { console.error('Failed in %s with err: ', ctxName, err); }) | |
.on('end', function (stats, errorCount) { |
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 http = require('http'); | |
var req = http.request('http://api.ews.cdew.net/XYHHM1VJKGZ63/data?key=tempkey&feed=continuous', function(res) { | |
console.log('STATUS: ' + res.statusCode); | |
console.log('HEADERS: ' + JSON.stringify(res.headers)); | |
res.setEncoding('utf8'); | |
res.on('data', function (chunk) { | |
console.log('BODY: ' + chunk); | |
}); |
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
#!/bin/sh | |
# | |
# chkconfig: 35 99 99 | |
# description: Node.js /home/nodejs/sample/app.js | |
# | |
. /etc/rc.d/init.d/functions | |
USER="nodejs" |
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
/** | |
* The functional pattern, defined in Douglas Crockford's "Javascript: The Good Parts", allows for | |
* JavaScript to achieve both inheritance and information hiding (private variables) with a compact syntax. | |
* The specification that is passed in, as well as potentially more vars you may define in each pseudo-class, are not | |
* accessible from the object that is returned, we consider these private variables. Public vars may | |
* be added to the "that" return object as desired. | |
*/ | |
/** | |
* Person is our base pseudo-class |
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
// all objects inherit from Object.prototype, | |
// we can add capabilities like so: | |
console.log('adding capabilities to Object.prototype'); | |
if (typeof Object.prototype.totalBills != 'function') { | |
Object.prototype.totalBills = function () { | |
if (this.bills && this.bills.constructor === Array) { | |
var total = 0; | |
for (var i=0; i<this.bills.length; 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
/** | |
* Constructor Invocation Pattern | |
* Requires use of the "new" keyword, allows for inheritance, but no information hiding | |
* The Functional Pattern is recommended over the Constructor Invocation Pattern | |
*/ | |
// create a constructor function for the base class | |
var Person = function (spec) { | |
// pseudo-class vars | |
spec.name = spec.name || ''; |
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
// | |
// UrlRequest.h | |
// form | |
// | |
// Created by timshultis on 12/26/13. | |
// Copyright (c) 2013 timshultis. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
//requires: | |
//npm install nodegit | |
//npm install fs-extra | |
var git = require('nodegit'), | |
fs = require('fs-extra'), | |
path = './webfiles', | |
repo = 'https://alloyking@bitbucket.org/alloyking/bracket-app-auto-update.git'; | |
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
param = { | |
params: [], | |
set: function(key, value){ | |
if(!this.update(key, value)){ | |
this.add(key, value); | |
} | |
}, | |
add: function(key, value) { | |
param_obj = {}; | |
param_obj[key] = value; |
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
#!/bin/sh | |
# | |
# chkconfig: 35 99 99 | |
# description: Node.js /home/nodejs/sample/app.js | |
# | |
. /etc/rc.d/init.d/functions | |
# Creamos un fichero PID para monit | |
SCRIPT="$(basename $0)" |