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
/* Basic HelloWorld Node.JS example */ | |
var http = require('http'); | |
//Node function called each time our event loop receives a new HTTP request | |
function onRequest(req, res){ | |
res.writeHead(200, {'Content-Type':'text/plain'}); | |
res.end('Hello ' + req.connection.remoteAddress + '!'); | |
/* Write the IP addresses of our connecting client to console */ | |
console.log('Incoming connection from ' + req.connection.remoteAddress); |
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
How far can a pickup truck be flung off of an aircraft carrier? | |
333m - length of aircraft carrier deck (Nimitz Class - http://en.wikipedia.org/wiki/Aircraft_carrier) | |
20,411.6567 - weight of jet in kilos | |
2 = number of seconds a jet is active on the catapult (assume it clears all 333ms) | |
165mph takeoff speed = 265.54176 Km/h = 73.7616 m/s | |
Force = weight * (333/4) - Newton's second law of motion (F = MA | F = kg (m/s^2)) | |
1,699,270.420 Netwons |
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
/* | |
* Module dependencies | |
*/ | |
var Post = require('../models/post') | |
, PostValidator = require('../validators/post-validator') | |
, requiresLogin = require('../helpers/requireLogin').requiresLogin | |
, marked = require('marked'); | |
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
[Authorize] | |
[HttpPost] | |
public void ScreenshotsAsync(string appName, HttpPostedFileBase files) | |
{ | |
AsyncManager.OutstandingOperations.Increment(); | |
var fileModel = new UploadedFileModel(); | |
var result = UploadedFileResult.NoFile; |
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
* | |
* Module dependencies | |
*/ | |
var User = require('../models/user') | |
, UserValidator = require('../validators/user-validator') | |
, Promise = require('everyauth').Promise; | |
//Everyauth configuration | |
module.exports = function(everyauth, repository){ |
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
/* This is part of the file that is generated automatically when you install Ninject.MVC3 -pre via Nuget */ | |
/// <summary> | |
/// Creates the kernel that will manage your application. | |
/// </summary> | |
/// <returns>The created kernel.</returns> | |
private static IKernel CreateKernel() | |
{ | |
var kernel = new StandardKernel(); | |
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel); |
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
// Code to execute on Unhandled Exceptions | |
private void Application_UnhandledException(object sender, | |
ApplicationUnhandledExceptionEventArgs e) | |
{ | |
if (System.Diagnostics.Debugger.IsAttached) | |
{ | |
// An unhandled exception has occurred; | |
// break into the debugger | |
System.Diagnostics.Debugger.Break(); | |
} |
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 () { | |
"use strict"; | |
var app = WinJS.Application; | |
var activation = Windows.ApplicationModel.Activation; | |
var nav = WinJS.Navigation; | |
WinJS.strictProcessing(); | |
app.onerror = function (error) { | |
//Log the last-chance exception (as a crash) |
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
//from http://ravendb.net/docs/server/scaling-out/sharding | |
var shards = new Dictionary<string, IDocumentStore> | |
{ | |
{"Asia", new DocumentStore {Url = "http://localhost:8080"}}, | |
{"Middle East", new DocumentStore {Url = "http://localhost:8081"}}, | |
{"America", new DocumentStore {Url = "http://localhost:8082"}}, | |
}; | |
var shardStrategy = new ShardStrategy(shards) | |
.ShardingOn<Company>(company => company.Region) |
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 shards = new Dictionary<string, IDocumentStore> | |
{ | |
{"Shard0", new DocumentStore {Url = "http://localhost:8080"}}, | |
{"Shard1", new DocumentStore {Url = "http://localhost:8081"}}, | |
{"Shard2", new DocumentStore {Url = "http://localhost:8082"}}, | |
}; | |
var shardStrategy = new ShardStrategy(shards) | |
.ShardingOn<FoodOrder>(order => order.CustomerId); | |
OlderNewer