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
# | |
# Author: Yohei Sasaki <[email protected]> | |
# | |
require 'resource_pool/resource_pool' | |
require 'aws/s3' | |
require 'tmpdir' | |
# | |
# A resource pool implementation to use S3. |
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
{ | |
"http://api.cloud.yssk22.info":"xxxx", | |
"http://api.ec2.yssk22.info":"xxxx", | |
"http://api.aws-cf.yssk22.info":"xxxx", | |
"http://api.ec2-cf.yssk22.info":"xxxx", | |
"http://api.vcap.me":"xxxx", | |
"http://api.s3-support.yssk22.info":"xxxx", | |
"http://api.org-support.yssk22.info":"xxxx", | |
"http://api.flexible-routing.yssk22.info":"xxxx" | |
} |
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
# 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 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 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 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
// 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 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 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 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 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 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
/*** | |
* @function make the parallel request filters and finish with the last filter. | |
* | |
* @example | |
* | |
* misc.parallel( | |
* func1, func2, func3, func4 | |
* ); | |
* | |
* func1 ---+ |
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
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 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
/******************************************* | |
* 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 || {}; | |
* }); |