Skip to content

Instantly share code, notes, and snippets.

public static class BootstrapperExtensions
{
public static void WithSession(this IPipelines pipeline, IDictionary<string, object> session)
{
pipeline.BeforeRequest.AddItemToEndOfPipeline(ctx =>
{
ctx.Request.Session = new Session(session);
return null;
});
}
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<iisnode loggingEnabled="false" debuggingEnabled="true" debuggerPathSegment="debug" />
<rewrite>
<rules>
<clear />
<rule name="Debug" patternSyntax="Wildcard" stopProcessing="true">
@csainty
csainty / ControllerBase.cs
Created March 22, 2012 00:50
Table query wrapper
[NonAction]
protected ActionResult WrapDataTableQuery<T>(IQueryable<T> data, Func<string, Expression<Func<T, bool>>> filter, Func<IQueryable<T>, string, bool, IOrderedQueryable<T>> applyOrderingFunction, Func<T, object[]> decorator)
{
// Fetch query parameters from the form buffer. All queries are POSTs
var queryData = ParseDataTableQueryDetails();
if (!String.IsNullOrWhiteSpace(queryData.SearchTerm))
{
data = data.Where(filter(queryData.SearchTerm.ToLower()));
}
function createPerson(name) {
var _name = name;
return {
sayHello: function () {
console.log("Hello " + _name);
}
}
}
var sue = createPerson('sue');
var bill = createPerson('bill');
// Person.js
(function () {
var Person = WinJS.Class.define(function (name) {
this.name = name;
}, {
sayHello: function () {
console.log("Hello " + this.name);
}
}, {
createPerson: function (name) {
var Person = (function() {
var ctor = function(name) {
var _name = name;
this.get_name = function() { return _name; } // Wrap the private variable with a getter
};
ctor.prototype.sayHello = function () {
console.log("Hello " + this.get_name());
}
var Person = function (name) {
this.name = name;
};
Person.prototype.sayHello = function () {
console.log("Hello " + this.name);
}
var sue = new Person('sue');
sue.sayHello(); // prints Hello sue
var bill = new Person('bill');
function createPerson(name) {
return {
name: name,
sayHello: function () {
console.log("Hello " + this.name);
}
}
}
var sue = createPerson('sue');
var bill = createPerson('bill');
@csainty
csainty / workaround.js
Created March 9, 2012 09:37
jQuery UI on Windows 8
var dm = $.fn.domManip;
$.fn.domManip = function (a, b, c) {
var result;
var that = this;
MSApp.execUnsafeLocalFunction(function () {
result = dm.call(that, a, b, c);
});
return result;
}
_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
Creating directory "D:\temp\vxyr2fjf.bf2\output\app\node_modules\node-logentries".
Copying file from "D:\temp\vxyr2fjf.bf2\input\NodeWorkerRunner\app\node_modules\node-logentries\package.json" to "D:\temp\vxyr2fjf.bf2\output\app\node_modules\node-logentries\package.json".
Copying file from "D:\temp\vxyr2fjf.bf2\input\NodeWorkerRunner\app\node_modules\node-logentries\README.md" to "D:\temp\vxyr2fjf.bf2\output\app\node_modules\node-logentries\README.md".
Copying file from "D:\temp\vxyr2fjf.bf2\input\NodeWorkerRunner\app\index.js" to "D:\temp\vxyr2fjf.bf2\output\app\index.js".
Creating directory "D:\temp\vxyr2fjf.bf2\output\app\node_modules\node-logentries\lib".
Copying file from "D:\temp\vxyr2fjf.bf2\input\NodeWorkerRunner\app\node_modules\node-logentries\lib\logentries.js" to "D:\temp\vxyr2fjf.bf2\output\app\node_modules\node-logentries\lib\logentries.js".