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
private TPart ComposePartWith<TPart, TImport>(TImport import) | |
{ | |
var catalog = new TypeCatalog(typeof(TPart)); | |
var childContainer = new CompositionContainer(catalog, Container); | |
childContainer.ComposeExportedValue(import); | |
return childContainer.GetExportedValue<TPart>(); | |
} |
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
//child catalog is a filtered catalog that contains only parts that should appear in the child (including TPart) | |
private TPart ComposePartWith<TPart>(ComposablePartCatalog childCatalog, CompositionContainer parentContainer, out IDisposable disposable, params object[] imports) | |
{ | |
var childContainer = new CompositionContainer(childCatalog, parentContainer); | |
childContainer.ComposeParts(imports); | |
disposable = childContainer; | |
return childContainer.GetExportedValue<TPart>(); | |
} |
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
using Microsoft.Practices.Composite.Presentation.Events; | |
using Microsoft.Practices.Composite.Regions; | |
using Microsoft.Practices.Unity; | |
namespace SomeNamespace | |
{ | |
public class SomeViewModel | |
{ | |
private readonly IUnityContainer _container; | |
private readonly IEventAggregator _eventAggregator; |
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
node-inspector & | |
node --debug-brk myapp.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
exports.filepath = function (webroot, url) { | |
var pathSep=process.platform ==='win32' ? '\\' : '/'; | |
// Unescape URL to prevent security holes | |
url = decodeURIComponent(url); | |
// Append index.html if path ends with '/' | |
fp = path.normalize(path.join(webroot, (url.match(/\/$/)=='/') ? url+'index.html' : url)); | |
// Sanitize input, make sure people can't use .. to get above webroot | |
if (webroot[webroot.length - 1] !== pathSep) webroot += pathSep; | |
if (fp.substr(0, webroot.length) != webroot) | |
return(['Permission Denied', null]); |
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 express = require('express'); | |
var server = express.createServer(); | |
var dnode = require('dnode'); | |
server.use(express.static(__dirname)); | |
dnode(function (client) { | |
this.sayHello = function (callback) { | |
callback('Hello from Node land'); | |
client.sayAnotherMessage('enjoy your day'); |
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
<html> | |
<head> | |
<script src="/dnode.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
window.onload = function () { | |
var client = {}; | |
client.sayAnotherMessage = function(message) { | |
document.getElementById('message').innerHTML += " and " + message; | |
}; | |
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
http = require 'http' | |
server = http.createServer (req, res) -> | |
res.writeHead 200, {'Content-Type': 'text/plain'} | |
res.end 'Hello World' | |
server.listen 1337, "127.0.0.1" | |
console.log 'Server running at http://127.0.0.1:1337/' |
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 TableQuery = require('./../../lib/azure').TableQuery; | |
module.exports = Home; | |
var uuid = require('node-uuid'); | |
function Home(client) { | |
this.client = client; | |
}; | |
Home.prototype = { |
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
public class OrderLinkService : IOrderLinkService, ILinkService<Order> { | |
public ILinkable<Order> AddLinks(Order order) { | |
var linkedOrder = new Linkable<Order>(); | |
if (order.State == OrderStates.Created) { | |
linkedOrder.Links.Add(OrderLinks.Approval, GetApprovalUri(order.ID)); | |
} | |
//other state logic here | |
return linkedOrder; | |
} |
OlderNewer