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
# install prerequisites | |
%w(libpcsclite-dev build-essential autoconf pcsc-tools pcscd).each do |p| | |
package p do | |
action :install | |
end | |
end | |
package "linux-headers-#{`uname -r`}" do | |
action :install | |
end |
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 server = new (require('mongodb').Server)('localhost', 27017); | |
> var db = new (require('mongodb').Db)('foo', server); | |
> db.open(function(){ | |
... db.collection('foo', function(_, collection){ | |
... collection.insert([{"_id": 'foo'}, {"_id": 'foo'}], {safe:true}, function(e){ console.log(e); }) | |
... }); | |
... }); | |
> { stack: [Getter/Setter], | |
arguments: undefined, | |
type: undefined, |
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
// insertの結果を待たずに実行 | |
col.insert({}, function(){}); // (a) | |
col.insert({}, function(){}); // (b) | |
// async.parallel を使って a, b は非同期で実行するが、 a, b, のりょうほうが終わったら c を呼ぶ | |
async.parallel({ | |
"a": function(cb){ | |
col.insert(..., cb); | |
}, | |
"b": function(cb){ |
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 tls = require('tls'); | |
var crypto = require('crypto'); | |
var opts = { | |
host: 'proxy.com', | |
port: 8080, | |
method: 'CONNECT', | |
path: 'securehost.com:443', | |
headers: { |
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 rimraf = require('rimraf'), | |
path = require('path'), | |
fs = require('fs'); | |
// add-on modules | |
var cf_modules = ['iconv', 'jsdom']; | |
module.exports = function(cb){ | |
if( process.env.VCAP_APP_PORT ){ | |
// in cloud foundry |
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 make the parallel request filters and finish with the last filter. | |
* | |
* @example | |
* | |
* misc.parallel( | |
* func1, func2, func3, func4 | |
* ); | |
* | |
* func1 ---+ |
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
exports.application = function(server){ | |
server.get('/', | |
newsFeeds, | |
misc.title('Home'), misc.renderWithBindings('index.ejs')); | |
server.get('/login', authorized, misc.redirect('/')); | |
server.get('/logout', oauth.logout, misc.redirect('/')); | |
server.get('/profiles/', authorized, misc.renderWithBindings('profiles/index.ejs')); | |
server.get('/archives/', authorized, misc.renderWithBindings('archives/index.ejs')); | |
server.get('/schedules/list', |
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
/******************************************* | |
* Connect middleware to proxy request to | |
* the specified path on CouchDB. | |
* | |
* Usage: | |
* | |
* app.use(express.bodyDecoder()); | |
* app.use(function(req, res, next){ | |
* res.bindings = res.bindings || {}; | |
* }); |
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
/** | |
* retwis-js.js | |
* | |
* Description: | |
* | |
* redis tutorial program impelmented by node.js | |
* | |
* Usage: | |
* | |
* node redis.js |
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 copy(fileUrl, docUrl, event, trace){ | |
if( !trace ){ | |
trace = 0; | |
} | |
if( !trace ){ | |
event = new EventEmitter(); | |
} | |
if( trace == MAX_TRACE ){ | |
logger.error('Max trace exceeded. ({fileUrl} -> {docUrl})'.format({fileUrl: fileUrl, docUrl: docUrl})); | |
return undefined; |