start new:
tmux
start new with session name:
tmux new -s myname
using System.Data; | |
using System.Data.Common; | |
using System.Runtime.Remoting.Messaging; | |
using System.Runtime.Remoting.Proxies; | |
using MvcMiniProfiler; | |
using MvcMiniProfiler.Data; | |
using NHibernate.Driver; | |
namespace YourNamespaceHere | |
{ |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.IO; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using FluentAssertions; | |
using NUnit.Framework; | |
using Nancy.Helpers; | |
namespace NancySelfHosting |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
var Feedback = Backbone.Model.extend({ | |
url: '/feedback', | |
validate: function (attrs) { | |
var errors = []; | |
if (!attrs.email || attrs.email === '') { | |
errors.push({name: 'email', message: 'Please fill email field.'}); | |
} |
using NSubstitute; | |
using Ploeh.AutoFixture; | |
using Ploeh.AutoFixture.AutoNSubstitute; | |
using Ploeh.AutoFixture.Xunit; | |
using Xunit.Extensions; | |
namespace AutofixtureDemo | |
{ | |
public class AutoNSubstituteDemo | |
{ |
public class Order { | |
public int Id { get; set; } | |
public DateTime OrderedAt { get; set } | |
public IList<OrderLine> OrderLines { get; set } | |
public Person Customer { get; set } | |
} | |
public class OrderLine { | |
public int Id { get; set; } | |
public int Count { get; set; } |
using System; | |
using System.IO; | |
using System.Web.Http; | |
using System.Web.Http.SelfHost; | |
var address = "http://localhost:8080"; | |
var conf = new HttpSelfHostConfiguration(new Uri(address)); | |
conf.Routes.MapHttpRoute(name: "DefaultApi", | |
routeTemplate: "api/{controller}/{id}", | |
defaults: new { id = RouteParameter.Optional } |
using System; | |
using System.Collections.Generic; | |
using Autofac; | |
using Nancy; | |
using Nancy.Bootstrapper; | |
using Nancy.Bootstrappers.Autofac; | |
using Nancy.Hosting.Self; | |
using Nancy.Routing; | |
public class Bootstrapper : AutofacNancyBootstrapper |
var hello = ""; | |
var enumerable = | |
EnumerableEx.Create<int>(async Yield => { | |
await Yield.Return(100); | |
await Yield.Return(200); | |
hello = "hello world"; | |
await Yield.Return(300); | |
}); | |
Console.WriteLine(enumerable.ElementAt(1)); // 200 | |
Console.WriteLine(hello); // empty |