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
// Usage from some other file: | |
// | |
// var app = require('./proxy')({proxyUrl: '//your-remote.com', proxyBase: '/api'}) | |
var path = require('path'), | |
request = require('request'), | |
express = require('express'), | |
app = express(); | |
app.use(express.logger('dev')); |
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 passport = require('passport'); | |
var util = require('util'); | |
var GitHubStrategy = require('passport-github').Strategy; | |
passport.serializeUser(function(user, done) { | |
done(null, user); | |
}); | |
passport.deserializeUser(function(obj, done) { | |
done(null, obj); |
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 exportsToContext() { | |
var alen = arguments | |
for (var a = 0; a < alen; a++) { | |
this.exports[el] = arguments[0][a]); | |
}); | |
} | |
var foo = 1, bar = 2, zoo = function() { return "z" }; | |
function export( argArr ) { |
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
class Engine | |
def initialize | |
#... | |
# elsewhere a named pipe has been created in filesys using: | |
# system("mkfifo #{fpath}") unless File.exists? fpath | |
# call named_pipe method which wraps IO.open( fpath, flag ) | |
@pipe_from_ui = named_pipe( Pipes[:engine_in], "r" ) | |
msg_ui = @pipe_from_ui.gets # blocks until ui writes in there:w |
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
ValueObject = function(value) { | |
this.value = value; | |
} | |
$.extend(ValueObject.prototype, { | |
get: function() { | |
return this.value; | |
} | |
}); |